mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2026-06-11 02:56:32 +00:00
Lock user mode selection when Automatically check currently applied tweaks is checked
This commit is contained in:
@@ -800,7 +800,7 @@
|
|||||||
</Popup>
|
</Popup>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<CheckBox x:Name="ShowCurrentlyAppliedTweaksCheckBox" Grid.Column="2" Content="Check applied tweaks" IsChecked="True" Foreground="{DynamicResource FgColor}" VerticalAlignment="Center" AutomationProperties.Name="Check applied tweaks" ToolTip="Check all tweaks currently active on this system. Unchecking clears all selections."/>
|
<CheckBox x:Name="ShowCurrentlyAppliedTweaksCheckBox" Grid.Column="2" Content="Automatically check currently applied tweaks" IsChecked="True" Foreground="{DynamicResource FgColor}" VerticalAlignment="Center" AutomationProperties.Name="Check applied tweaks" ToolTip="Check all tweaks currently active on this system for the current user. Unchecking clears all selections."/>
|
||||||
|
|
||||||
<Border x:Name="TweakSearchBorder" Grid.Column="4">
|
<Border x:Name="TweakSearchBorder" Grid.Column="4">
|
||||||
<Border.Style>
|
<Border.Style>
|
||||||
|
|||||||
@@ -1402,6 +1402,34 @@ function Show-MainWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$script:SuppressAppliedTweaksUserSync = $false
|
||||||
|
|
||||||
|
function UpdateAppliedTweaksUserModeState {
|
||||||
|
$showAppliedTweaksMode = ($ShowCurrentlyAppliedTweaksCheckBox -and $ShowCurrentlyAppliedTweaksCheckBox.IsChecked -eq $true)
|
||||||
|
|
||||||
|
if ($showAppliedTweaksMode) {
|
||||||
|
if ($userSelectionCombo.SelectedIndex -ne 0 -and -not $script:SuppressAppliedTweaksUserSync) {
|
||||||
|
$script:SuppressAppliedTweaksUserSync = $true
|
||||||
|
try {
|
||||||
|
$userSelectionCombo.SelectedIndex = 0
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
$script:SuppressAppliedTweaksUserSync = $false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$userSelectionCombo.IsEnabled = $false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($script:Params.ContainsKey('Sysprep') -or $script:Params.ContainsKey('User')) {
|
||||||
|
$userSelectionCombo.IsEnabled = $false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
$userSelectionCombo.IsEnabled = $true
|
||||||
|
}
|
||||||
|
|
||||||
function UpdateTweaksResponsiveColumns {
|
function UpdateTweaksResponsiveColumns {
|
||||||
if (-not $tweaksGrid -or -not $col0 -or -not $col1 -or -not $col2) { return }
|
if (-not $tweaksGrid -or -not $col0 -or -not $col1 -or -not $col2) { return }
|
||||||
if ($tweaksGrid.ColumnDefinitions.Count -lt 3) { return }
|
if ($tweaksGrid.ColumnDefinitions.Count -lt 3) { return }
|
||||||
@@ -1545,8 +1573,8 @@ function Show-MainWindow {
|
|||||||
|
|
||||||
# Only show changed settings checkbox
|
# Only show changed settings checkbox
|
||||||
if ($ShowCurrentlyAppliedTweaksCheckBox) {
|
if ($ShowCurrentlyAppliedTweaksCheckBox) {
|
||||||
$ShowCurrentlyAppliedTweaksCheckBox.Add_Checked({ ResetTweaksToSystemState -loadSystemState $true })
|
$ShowCurrentlyAppliedTweaksCheckBox.Add_Checked({ ResetTweaksToSystemState -loadSystemState $true; UpdateAppliedTweaksUserModeState })
|
||||||
$ShowCurrentlyAppliedTweaksCheckBox.Add_Unchecked({ ResetTweaksToSystemState -loadSystemState $false })
|
$ShowCurrentlyAppliedTweaksCheckBox.Add_Unchecked({ ResetTweaksToSystemState -loadSystemState $false; UpdateAppliedTweaksUserModeState })
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add Ctrl+F keyboard shortcut to focus search box on current tab
|
# Add Ctrl+F keyboard shortcut to focus search box on current tab
|
||||||
@@ -1647,6 +1675,17 @@ function Show-MainWindow {
|
|||||||
|
|
||||||
# Update user selection description and show/hide other user panel
|
# Update user selection description and show/hide other user panel
|
||||||
$userSelectionCombo.Add_SelectionChanged({
|
$userSelectionCombo.Add_SelectionChanged({
|
||||||
|
if ($ShowCurrentlyAppliedTweaksCheckBox -and $ShowCurrentlyAppliedTweaksCheckBox.IsChecked -eq $true -and $userSelectionCombo.SelectedIndex -ne 0 -and -not $script:SuppressAppliedTweaksUserSync) {
|
||||||
|
$script:SuppressAppliedTweaksUserSync = $true
|
||||||
|
try {
|
||||||
|
$userSelectionCombo.SelectedIndex = 0
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
$script:SuppressAppliedTweaksUserSync = $false
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
switch ($userSelectionCombo.SelectedIndex) {
|
switch ($userSelectionCombo.SelectedIndex) {
|
||||||
0 {
|
0 {
|
||||||
$userSelectionDescription.Text = "Changes will be applied to the currently logged-in user profile."
|
$userSelectionDescription.Text = "Changes will be applied to the currently logged-in user profile."
|
||||||
@@ -1680,6 +1719,7 @@ function Show-MainWindow {
|
|||||||
|
|
||||||
# Keep enabled/disabled state in sync with both app selection and user mode.
|
# Keep enabled/disabled state in sync with both app selection and user mode.
|
||||||
UpdateAppSelectionStatus
|
UpdateAppSelectionStatus
|
||||||
|
UpdateAppliedTweaksUserModeState
|
||||||
})
|
})
|
||||||
|
|
||||||
# Helper function to update app removal scope description
|
# Helper function to update app removal scope description
|
||||||
@@ -2104,6 +2144,7 @@ function Show-MainWindow {
|
|||||||
$otherUsernameTextBox.IsEnabled = $false
|
$otherUsernameTextBox.IsEnabled = $false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UpdateAppliedTweaksUserModeState
|
||||||
UpdateNavigationButtons
|
UpdateNavigationButtons
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user