mirror of
https://github.com/rbalsleyMSFT/FFU.git
synced 2026-06-14 02:09:35 -06:00
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:
@@ -221,7 +221,6 @@
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Margin="0,5,0,0">
|
||||
<StackPanel x:Name="stackFeaturesContainer" Margin="15,5">
|
||||
<TextBlock Text="Selected features (semicolon):" Margin="0,10,0,5" FontStyle="Italic"/>
|
||||
<TextBox x:Name="txtOptionalFeatures" IsReadOnly="True" Width="350" Margin="0,0,0,10" ToolTip="Provide a semicolon-separated list of Windows optional features you want to include in the FFU (e.g., netfx3;TFTP)."/>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Expander>
|
||||
|
||||
@@ -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 ', ')"
|
||||
|
||||
@@ -28,7 +28,6 @@ function Initialize-UIControls {
|
||||
$State.Controls.cmbWindowsSKU = $window.FindName('cmbWindowsSKU')
|
||||
$State.Controls.cmbMediaType = $window.FindName('cmbMediaType')
|
||||
$State.Controls.MediaTypeStackPanel = $window.FindName('MediaTypeStackPanel')
|
||||
$State.Controls.txtOptionalFeatures = $window.FindName('txtOptionalFeatures')
|
||||
$State.Controls.featuresPanel = $window.FindName('stackFeaturesContainer')
|
||||
$State.Controls.chkDownloadDrivers = $window.FindName('chkDownloadDrivers')
|
||||
$State.Controls.cmbMake = $window.FindName('cmbMake')
|
||||
@@ -274,7 +273,6 @@ function Initialize-UIDefaults {
|
||||
$State.Controls.cmbWindowsLang.SelectedItem = $State.Defaults.windowsSettingsDefaults.DefaultWindowsLang
|
||||
$State.Controls.cmbMediaType.ItemsSource = $State.Defaults.windowsSettingsDefaults.AllowedMediaTypes
|
||||
$State.Controls.cmbMediaType.SelectedItem = $State.Defaults.windowsSettingsDefaults.DefaultMediaType
|
||||
$State.Controls.txtOptionalFeatures.Text = $State.Defaults.windowsSettingsDefaults.DefaultOptionalFeatures
|
||||
$State.Controls.txtProductKey.Text = $State.Defaults.windowsSettingsDefaults.DefaultProductKey
|
||||
|
||||
# Updates tab defaults from General Defaults
|
||||
|
||||
@@ -608,7 +608,6 @@ function UpdateOptionalFeaturesString {
|
||||
foreach ($entry in $State.Controls.featureCheckBoxes.GetEnumerator()) {
|
||||
if ($entry.Value.IsChecked) { $checkedFeatures += $entry.Key }
|
||||
}
|
||||
$State.Controls.txtOptionalFeatures.Text = $checkedFeatures -join ";"
|
||||
}
|
||||
function BuildFeaturesGrid {
|
||||
param (
|
||||
|
||||
Reference in New Issue
Block a user