mirror of
https://github.com/ChrisTitusTech/winutil
synced 2026-04-05 22:28:31 +00:00
Fix import / export config issue (#4189)
* apply toggle fix * apply fix that disables all toggles outside of config
This commit is contained in:
@@ -94,7 +94,14 @@ function Invoke-WPFImpex {
|
||||
Update-WinUtilSelections -flatJson $flattenedJson
|
||||
|
||||
if (!$PARAM_NOUI) {
|
||||
Reset-WPFCheckBoxes -doToggles $true
|
||||
# Set flag so toggle Checked/Unchecked events don't trigger registry writes
|
||||
# while we're programmatically restoring UI state from the imported config
|
||||
$sync.ImportInProgress = $true
|
||||
try {
|
||||
Reset-WPFCheckBoxes -doToggles $true
|
||||
} finally {
|
||||
$sync.ImportInProgress = $false
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
|
||||
@@ -193,13 +193,19 @@ function Invoke-WPFUIElements {
|
||||
$sync[$entryInfo.Name].Add_Checked({
|
||||
[System.Object]$Sender = $args[0]
|
||||
Invoke-WPFSelectedCheckboxesUpdate -type "Add" -checkboxName $Sender.name
|
||||
Invoke-WinUtilTweaks $Sender.name
|
||||
# Skip applying tweaks while an import is restoring toggle states
|
||||
if (-not $sync.ImportInProgress) {
|
||||
Invoke-WinUtilTweaks $Sender.name
|
||||
}
|
||||
})
|
||||
|
||||
$sync[$entryInfo.Name].Add_Unchecked({
|
||||
[System.Object]$Sender = $args[0]
|
||||
Invoke-WPFSelectedCheckboxesUpdate -type "Remove" -checkboxName $Sender.name
|
||||
Invoke-WinUtiltweaks $Sender.name -undo $true
|
||||
# Skip undoing tweaks while an import is restoring toggle states
|
||||
if (-not $sync.ImportInProgress) {
|
||||
Invoke-WinUtiltweaks $Sender.name -undo $true
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user