diff --git a/scripts/main.ps1 b/scripts/main.ps1 index c1d476f4..29867f4b 100644 --- a/scripts/main.ps1 +++ b/scripts/main.ps1 @@ -87,6 +87,14 @@ try { $xaml.SelectNodes("//*[@Name]") | ForEach-Object {$sync["$("$($psitem.Name)")"] = $sync["Form"].FindName($psitem.Name)} +#Persist the Chocolatey preference across winutil restarts +$ChocoPreferencePath = "$env:LOCALAPPDATA\winutil\preferChocolatey.ini" +$sync.WPFpreferChocolatey.Add_Checked({New-Item -Path $ChocoPreferencePath -Force }) +$sync.WPFpreferChocolatey.Add_Unchecked({Remove-Item $ChocoPreferencePath -Force}) +if (Test-Path $ChocoPreferencePath){ + $sync.WPFpreferChocolatey.IsChecked = $true +} + $sync.keys | ForEach-Object { if($sync.$psitem) { if($($sync["$psitem"].GetType() | Select-Object -ExpandProperty Name) -eq "CheckBox" `