winutil/functions/private/Set-DownloadEngine.ps1

35 lines
1.4 KiB
PowerShell
Raw Normal View History

2024-08-20 15:33:01 -05:00
function Set-DownloadEngine {
$CheckBoxes = $sync.GetEnumerator() | Where-Object { $_.Value -is [System.Windows.Controls.CheckBox] }
2024-08-20 16:41:17 -05:00
2024-08-20 15:33:01 -05:00
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"
2024-08-20 16:41:17 -05:00
$sync."$($CheckBox.Key)Link".Visibility = "Collapsed"
2024-08-20 15:33:01 -05:00
}
else{
$CheckBox.Value.Visibility = "Visible"
2024-08-20 16:41:17 -05:00
$sync."$($CheckBox.Key)Link".Visibility = "Visible"
2024-08-20 15:33:01 -05:00
}
}
"Chocolatey"{
if ($($sync.configs.applications.$($CheckBox.Name).chocolatey) -eq "na"){
$CheckBox.Value.Visibility = "Collapsed"
2024-08-20 16:41:17 -05:00
$sync."$($CheckBox.Key)Link".Visibility = "Collapsed"
2024-08-20 15:33:01 -05:00
}
else {
$CheckBox.Value.Visibility = "Visible"
2024-08-20 16:41:17 -05:00
$sync."$($CheckBox.Key)Link".Visibility = "Visible"
2024-08-20 15:33:01 -05:00
}
}
default{
$CheckBox.Value.Visibility = "Visible"
2024-08-20 16:41:17 -05:00
$sync."$($CheckBox.Key)Link".Visibility = "Visible"
2024-08-20 15:33:01 -05:00
}
}
}
}
}