First Selector and Logic

This commit is contained in:
Marterich
2024-08-20 22:33:01 +02:00
parent 2748767a47
commit bd730b5418
3 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,28 @@
function Set-DownloadEngine {
$CheckBoxes = $sync.GetEnumerator() | Where-Object { $_.Value -is [System.Windows.Controls.CheckBox] }
foreach ($CheckBox in $CheckBoxes) {
if ($CheckBox.Key.StartsWith("WPFInstall")) {
Switch ($sync.DownloadEngine) {
"Winget" {
if ($($sync.configs.applications.$($CheckBox.Name).winget) -eq "na"){
$CheckBox.Value.Visibility = "Collapsed"
}
else{
$CheckBox.Value.Visibility = "Visible"
}
}
"Chocolatey"{
if ($($sync.configs.applications.$($CheckBox.Name).chocolatey) -eq "na"){
$CheckBox.Value.Visibility = "Collapsed"
}
else {
$CheckBox.Value.Visibility = "Visible"
}
}
default{
$CheckBox.Value.Visibility = "Visible"
}
}
}
}
}