mirror of
https://github.com/rbalsleyMSFT/FFU.git
synced 2026-06-14 02:09:35 -06:00
Refactors CU checkbox initialization logic
Moves the initial state logic for the "Latest CU" and "Preview CU" checkboxes from the main UI script to the core initialization module. This change centralizes UI default settings into the `Initialize-UIDefaults` function, improving code organization and maintainability.
This commit is contained in:
@@ -135,12 +135,6 @@ $window.Add_Loaded({
|
||||
|
||||
Register-EventHandlers -State $script:uiState
|
||||
|
||||
# CU interplay (Keep existing logic)
|
||||
# Set initial state based on defaults
|
||||
$script:uiState.Controls.chkPreviewCU.IsEnabled = -not $script:uiState.Controls.chkLatestCU.IsChecked
|
||||
$script:uiState.Controls.chkLatestCU.IsEnabled = -not $script:uiState.Controls.chkPreviewCU.IsChecked
|
||||
|
||||
|
||||
# APPLICATIONS tab UI logic (Keep existing logic)
|
||||
$script:uiState.Controls.chkInstallWingetApps.Visibility = if ($script:uiState.Controls.chkInstallApps.IsChecked) { 'Visible' } else { 'Collapsed' }
|
||||
$script:uiState.Controls.applicationPathPanel.Visibility = if ($script:uiState.Controls.chkInstallApps.IsChecked) { 'Visible' } else { 'Collapsed' }
|
||||
|
||||
@@ -216,6 +216,9 @@ function Initialize-UIDefaults {
|
||||
$State.Controls.chkUpdateLatestMSRT.IsChecked = $State.Defaults.generalDefaults.UpdateLatestMSRT
|
||||
$State.Controls.chkUpdateLatestMicrocode.IsChecked = $State.Defaults.generalDefaults.UpdateLatestMicrocode
|
||||
$State.Controls.chkUpdatePreviewCU.IsChecked = $State.Defaults.generalDefaults.UpdatePreviewCU
|
||||
# Set initial state for CU checkbox interplay
|
||||
$State.Controls.chkPreviewCU.IsEnabled = -not $State.Controls.chkLatestCU.IsChecked
|
||||
$State.Controls.chkLatestCU.IsEnabled = -not $State.Controls.chkPreviewCU.IsChecked
|
||||
|
||||
# Applications tab defaults from General Defaults
|
||||
$State.Controls.chkInstallApps.IsChecked = $State.Defaults.generalDefaults.InstallApps
|
||||
|
||||
Reference in New Issue
Block a user