Files
winutil/functions/private/Initialize-WinUtilTabContent.ps1
T
Vinicius Costa AmorimandGitHub 8860caf357 fix: apply imported config selections to lazily-built tabs (#4938)
Tabs other than Install build their checkboxes lazily on first visit.
Import populates $sync.selected* and calls Reset-WPFCheckBoxes, but
that only touches checkboxes that already exist in $sync, so any tab
not yet visited gets its controls built later with default (unchecked)
state and never reflects the import. Re-apply Reset-WPFCheckBoxes right
after a tab's controls are built so it picks up existing selections.
2026-08-09 12:59:13 -05:00

43 lines
1.4 KiB
PowerShell

function Initialize-WinUtilTabContent {
param(
[Parameter(Mandatory = $true)]
[string]$TabName
)
if ($null -eq $sync.InitializedTabs) {
$sync.InitializedTabs = @{}
}
if ($sync.InitializedTabs[$TabName]) {
return
}
switch ($TabName) {
"Install" {
Invoke-WPFUIElements -configVariable $sync.configs.appnavigation -targetGridName "appscategory" -columncount 1
Initialize-WPFUI -targetGridName "appscategory"
Initialize-WPFUI -targetGridName "appspanel"
}
"Tweaks" {
Invoke-WPFUIElements -configVariable $sync.configs.tweaks -targetGridName "tweakspanel" -columncount 2
}
"Config" {
Invoke-WPFUIElements -configVariable $sync.configs.feature -targetGridName "featurespanel" -columncount 2
}
"AppX" {
Invoke-WPFUIElements -configVariable $sync.configs.appx -targetGridName "appxpanel" -columncount 2
}
"Win11ISO" {
if ($sync.Form -and $sync.Form.Dispatcher) {
$sync.Form.Dispatcher.BeginInvoke([System.Windows.Threading.DispatcherPriority]::Background, [action]{ Invoke-WinUtilISOCheckExistingWork }) | Out-Null
}
}
}
$sync.InitializedTabs[$TabName] = $true
# Sync freshly built controls to any selections already in $sync.selected* (import/preset).
Reset-WPFCheckBoxes -doToggles $true
}