From bde3cdd09f62ad3a7e838e1466c6614ef65010f7 Mon Sep 17 00:00:00 2001 From: rbalsleyMSFT <53497092+rbalsleyMSFT@users.noreply.github.com> Date: Mon, 26 May 2025 18:12:32 -0700 Subject: [PATCH] Update LoadConfig logic to manage Optional Features checkboxes based on loaded configuration. Added functionality to check/uncheck feature checkboxes according to the loaded features string, enhancing user interface responsiveness and clarity. --- FFUDevelopment/BuildFFUVM_UI.ps1 | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/FFUDevelopment/BuildFFUVM_UI.ps1 b/FFUDevelopment/BuildFFUVM_UI.ps1 index 17e6a84..0e9a8c6 100644 --- a/FFUDevelopment/BuildFFUVM_UI.ps1 +++ b/FFUDevelopment/BuildFFUVM_UI.ps1 @@ -2743,6 +2743,31 @@ $btnLoadConfig.Add_Click({ Set-UIValue -ControlName 'txtProductKey' -PropertyName 'Text' -ConfigObject $configContent -ConfigKey 'ProductKey' -WindowInstance $window Set-UIValue -ControlName 'txtOptionalFeatures' -PropertyName 'Text' -ConfigObject $configContent -ConfigKey 'OptionalFeatures' -WindowInstance $window # This will update the text box; checkboxes need separate logic if desired for load. + # Update Optional Features checkboxes based on the loaded text + $loadedFeaturesString = $window.FindName('txtOptionalFeatures').Text + if (-not [string]::IsNullOrWhiteSpace($loadedFeaturesString)) { + $loadedFeaturesArray = $loadedFeaturesString.Split(';') + WriteLog "LoadConfig: Updating Optional Features checkboxes. Loaded features: $($loadedFeaturesArray -join ', ')" + foreach ($featureEntry in $script:featureCheckBoxes.GetEnumerator()) { + $featureName = $featureEntry.Key + $featureCheckbox = $featureEntry.Value + if ($loadedFeaturesArray -contains $featureName) { + $featureCheckbox.IsChecked = $true + WriteLog "LoadConfig: Checked checkbox for feature '$featureName'." + } + else { + $featureCheckbox.IsChecked = $false + } + } + } + else { + # If no optional features are loaded, uncheck all + WriteLog "LoadConfig: No optional features string loaded. Unchecking all feature checkboxes." + foreach ($featureEntry in $script:featureCheckBoxes.GetEnumerator()) { + $featureEntry.Value.IsChecked = $false + } + } + # M365 Apps/Office tab Set-UIValue -ControlName 'chkInstallOffice' -PropertyName 'IsChecked' -ConfigObject $configContent -ConfigKey 'InstallOffice' -WindowInstance $window Set-UIValue -ControlName 'txtOfficePath' -PropertyName 'Text' -ConfigObject $configContent -ConfigKey 'OfficePath' -WindowInstance $window # Assuming OfficePath is in config