Removes redundant optional features textbox

Eliminates the read-only field and derives the features list directly from the checked items, producing a sorted semicolon string when collecting config. Avoids duplicated state, prevents desynchronization between UI elements, and yields deterministic ordering for persistence.
This commit is contained in:
rbalsleyMSFT
2025-08-19 18:40:09 -07:00
parent 0c373e6b2c
commit 9aed707a77
4 changed files with 4 additions and 9 deletions
@@ -71,7 +71,7 @@ function Get-UIConfig {
OfficeConfigXMLFile = $State.Controls.txtOfficeConfigXMLFilePath.Text
OfficePath = $State.Controls.txtOfficePath.Text
Optimize = $State.Controls.chkOptimize.IsChecked
OptionalFeatures = $State.Controls.txtOptionalFeatures.Text
OptionalFeatures = (($State.Controls.featureCheckBoxes.GetEnumerator() | Where-Object { $_.Value.IsChecked } | ForEach-Object { $_.Key } | Sort-Object) -join ';')
OrchestrationPath = "$($State.Controls.txtApplicationPath.Text)\Orchestration"
PEDriversFolder = $State.Controls.txtPEDriversFolder.Text
Processors = [int]$State.Controls.txtProcessors.Text
@@ -419,10 +419,9 @@ function Update-UIFromConfig {
Set-UIValue -ControlName 'cmbWindowsSKU' -PropertyName 'SelectedItem' -ConfigObject $ConfigContent -ConfigKey 'WindowsSKU' -State $State
Set-UIValue -ControlName 'cmbMediaType' -PropertyName 'SelectedItem' -ConfigObject $ConfigContent -ConfigKey 'MediaType' -State $State
Set-UIValue -ControlName 'txtProductKey' -PropertyName 'Text' -ConfigObject $ConfigContent -ConfigKey 'ProductKey' -State $State
Set-UIValue -ControlName 'txtOptionalFeatures' -PropertyName 'Text' -ConfigObject $ConfigContent -ConfigKey 'OptionalFeatures' -State $State
# Update Optional Features checkboxes based on the loaded text
$loadedFeaturesString = $State.Controls.txtOptionalFeatures.Text
# Update Optional Features checkboxes
$loadedFeaturesString = $ConfigContent.OptionalFeatures
if (-not [string]::IsNullOrWhiteSpace($loadedFeaturesString)) {
$loadedFeaturesArray = $loadedFeaturesString.Split(';')
WriteLog "LoadConfig: Updating Optional Features checkboxes. Loaded features: $($loadedFeaturesArray -join ', ')"