mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-01-17 18:27:42 -06:00
Changed labels to a hashtable for faster access
This commit is contained in:
parent
f453534f74
commit
0e613f029a
@ -368,7 +368,8 @@ $filter = Get-WinUtilVariables -Type CheckBox
|
||||
$CheckBoxes = $sync.GetEnumerator() | Where-Object { $psitem.Key -in $filter }
|
||||
|
||||
$filter = Get-WinUtilVariables -Type Label
|
||||
$labels = $sync.GetEnumerator() | Where-Object {$PSItem.Key -in $filter}
|
||||
$labels = @{}
|
||||
$sync.GetEnumerator() | Where-Object {$PSItem.Key -in $filter} | ForEach-Object {$labels[$_.Key] = $_.Value}
|
||||
|
||||
$allCategories = $checkBoxes.Name | ForEach-Object {$sync.configs.applications.$_} | Select-Object -Unique -ExpandProperty category
|
||||
|
||||
@ -415,14 +416,14 @@ $sync["CheckboxFilter"].Add_TextChanged({
|
||||
$activeCategories = $activeApplications | Select-Object -ExpandProperty category -Unique
|
||||
|
||||
foreach ($category in $activeCategories){
|
||||
$label = $Labels | Where-Object {$_.Key -eq "WPFLabel"+$($category -replace '[^a-zA-Z0-9]','')}
|
||||
$label.Value.Visibility = "Visible"
|
||||
$label = $labels["WPFLabel"+$($category -replace '[^a-zA-Z0-9]')]
|
||||
$label.Visibility = "Visible"
|
||||
}
|
||||
if ($activeCategories -ne $null){
|
||||
$inactiveCategories = Compare-Object -ReferenceObject $allCategories -DifferenceObject $activeCategories -PassThru
|
||||
foreach ($category in $inactiveCategories){
|
||||
$label = $Labels | Where-Object {$_.Key -eq "WPFLabel"+$($category -replace '[^a-zA-Z0-9]','')}
|
||||
$label.Value.Visibility = "Collapsed"}
|
||||
$label = $labels["WPFLabel"+$($category -replace '[^a-zA-Z0-9]')]
|
||||
$label.Visibility = "Collapsed"}
|
||||
}
|
||||
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user