mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-08-10 10:01:16 +10:00
* Turn the Install category filters into toggle chips - Replace the filter buttons with toggles that show which ones are active - Add ctrl click to select more than one category - Keep the search box and the category filter independent of each other - Expand matching categories while a filter is active * Fix the filter interactions the category chips missed - Pass the selected categories to the lazy rendering batches, the old call used a parameter that no longer exists and threw while typing - Keep the category filter when switching tabs, the chips stayed checked while the filter itself was dropped - Put a category back to collapsed once the filter that expanded it is gone * Document the Install category filters - Add a guide section for the chips, ctrl click and clearing the filter - Note that search and the category chips apply together * Correct the category filter guide wording - Clearing by clicking the chip only applies when it is the only one selected - Only categories with matches expand, and only auto expanded ones re-collapse
65 lines
2.2 KiB
PowerShell
65 lines
2.2 KiB
PowerShell
function Invoke-WinUtilInstallAppRenderBatch {
|
|
param(
|
|
[Parameter(Mandatory = $true)]
|
|
$CategoryBatch
|
|
)
|
|
|
|
foreach ($appKey in $CategoryBatch.AppKeys) {
|
|
$sync.$appKey = Initialize-InstallAppEntry -TargetElement $CategoryBatch.TargetElement -AppKey $appKey
|
|
}
|
|
|
|
# Entries render in batches, so a filter that is already active has to be applied to each new
|
|
# batch. Categories count as an active filter just like search text does.
|
|
if ($sync.currentTab -eq "Install" -and $sync.SearchBar) {
|
|
$selectedCategories = if ($sync.SelectedAppCategories) { $sync.SelectedAppCategories.ToArray() } else { @() }
|
|
|
|
if (-not [string]::IsNullOrWhiteSpace($sync.SearchBar.Text) -or $selectedCategories.Count -gt 0) {
|
|
Find-AppsByNameOrDescription -SearchString $sync.SearchBar.Text -Categories $selectedCategories
|
|
}
|
|
}
|
|
}
|
|
|
|
function Complete-WinUtilInstallAppRendering {
|
|
$sync.InstallAppEntriesRendered = $true
|
|
}
|
|
|
|
function Invoke-WinUtilInstallAppRenderNextBatch {
|
|
if ($sync.InstallAppRenderQueue.Count -gt 0) {
|
|
$categoryBatch = $sync.InstallAppRenderQueue.Dequeue()
|
|
Invoke-WinUtilInstallAppRenderBatch -CategoryBatch $categoryBatch
|
|
}
|
|
|
|
if ($sync.InstallAppRenderQueue.Count -gt 0) {
|
|
$sync.Form.Dispatcher.BeginInvoke(
|
|
[System.Windows.Threading.DispatcherPriority]::Background,
|
|
[action]{ Invoke-WinUtilInstallAppRenderNextBatch }
|
|
) | Out-Null
|
|
return
|
|
}
|
|
|
|
Complete-WinUtilInstallAppRendering
|
|
}
|
|
|
|
function Start-WinUtilInstallAppRendering {
|
|
if ($null -eq $sync.InstallAppRenderQueue) {
|
|
return
|
|
}
|
|
|
|
$sync.InstallAppEntriesRendered = $false
|
|
|
|
if ($sync.Form -and $sync.Form.Dispatcher) {
|
|
$sync.Form.Dispatcher.BeginInvoke(
|
|
[System.Windows.Threading.DispatcherPriority]::Background,
|
|
[action]{ Invoke-WinUtilInstallAppRenderNextBatch }
|
|
) | Out-Null
|
|
return
|
|
}
|
|
|
|
while ($sync.InstallAppRenderQueue.Count -gt 0) {
|
|
$categoryBatch = $sync.InstallAppRenderQueue.Dequeue()
|
|
Invoke-WinUtilInstallAppRenderBatch -CategoryBatch $categoryBatch
|
|
}
|
|
|
|
Complete-WinUtilInstallAppRendering
|
|
}
|