From 1826d6d8beaf21c08f84315ea07786fe3d091a10 Mon Sep 17 00:00:00 2001 From: Jeffrey <9938813+Raphire@users.noreply.github.com> Date: Mon, 27 Apr 2026 15:37:09 +0200 Subject: [PATCH] Refactor app removal scope handling & styling --- Scripts/GUI/Show-MainWindow.ps1 | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/Scripts/GUI/Show-MainWindow.ps1 b/Scripts/GUI/Show-MainWindow.ps1 index e8b93f4..f6be6b3 100644 --- a/Scripts/GUI/Show-MainWindow.ps1 +++ b/Scripts/GUI/Show-MainWindow.ps1 @@ -504,6 +504,19 @@ function Show-MainWindow { } } $appSelectionStatus.Text = "$selectedCount app(s) selected for removal" + + if ($appRemovalScopeCombo -and $appRemovalScopeSection -and $appRemovalScopeDescription) { + if ($selectedCount -gt 0) { + if ($userSelectionCombo.SelectedIndex -ne 2) { + $appRemovalScopeCombo.IsEnabled = $true + } + UpdateAppRemovalScopeDescription + } + else { + $appRemovalScopeCombo.IsEnabled = $false + $appRemovalScopeDescription.Text = "No apps selected for removal." + } + } } # Applies a preset by checking/unchecking apps that match the given filter @@ -1563,21 +1576,7 @@ function Show-MainWindow { $changesList += "Remove $selectedAppsCount application(s)" } - # Update app removal scope section based on whether apps are selected - if ($selectedAppsCount -gt 0) { - # Enable app removal scope selection (unless locked by sysprep mode) - if ($userSelectionCombo.SelectedIndex -ne 2) { - $appRemovalScopeCombo.IsEnabled = $true - } - $appRemovalScopeSection.Opacity = 1.0 - UpdateAppRemovalScopeDescription - } - else { - # Disable app removal scope selection when no apps selected - $appRemovalScopeCombo.IsEnabled = $false - $appRemovalScopeSection.Opacity = 0.5 - $appRemovalScopeDescription.Text = "No apps selected for removal." - } + UpdateAppSelectionStatus # Collect all ComboBox/CheckBox selections from dynamically created controls if ($script:UiControlMappings) {