mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2026-02-19 00:46:33 +00:00
Add option to quickly apply default settings from home page (#479)
This commit is contained in:
@@ -787,12 +787,21 @@
|
||||
<Run Text="Your clean Windows experience is just a few clicks away!"/>
|
||||
</TextBlock>
|
||||
|
||||
<!-- Start Button -->
|
||||
<Button x:Name="HomeStartBtn" Width="125" Height="53" Style="{StaticResource PrimaryButtonStyle}" HorizontalAlignment="Center" Margin="0,20,0,0" AutomationProperties.Name="Start">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<TextBlock Text="Start" FontWeight="SemiBold" VerticalAlignment="Center" FontSize="24" Margin="0,0,0,3"/>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<!-- Action Buttons -->
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,20,0,0">
|
||||
<Button x:Name="HomeDefaultModeBtn" Width="180" Height="50" Style="{StaticResource PrimaryButtonStyle}" Margin="0,0,12,0" AutomationProperties.Name="Default Mode">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<TextBlock Text="" FontFamily="Segoe Fluent Icons" FontSize="16" VerticalAlignment="Center" Margin="0,0,8,0"/>
|
||||
<TextBlock Text="Default Mode" ToolTip="Quickly select the recommended settings" FontWeight="SemiBold" VerticalAlignment="Center" FontSize="17" Margin="0,0,0,2"/>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button x:Name="HomeStartBtn" Width="180" Height="50" Style="{StaticResource SecondaryButtonStyle}" AutomationProperties.Name="Custom Setup">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<TextBlock Text="" FontFamily="Segoe Fluent Icons" FontSize="14" VerticalAlignment="Center" Margin="0,0,8,0"/>
|
||||
<TextBlock Text="Custom Setup" ToolTip="Manually select your preferred settings" FontWeight="SemiBold" VerticalAlignment="Center" FontSize="17" Margin="0,0,0,2"/>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
@@ -1245,6 +1245,27 @@ function Show-MainWindow {
|
||||
UpdateNavigationButtons
|
||||
})
|
||||
|
||||
# Handle Home Default Mode button - apply defaults and navigate directly to overview
|
||||
$homeDefaultModeBtn = $window.FindName('HomeDefaultModeBtn')
|
||||
$homeDefaultModeBtn.Add_Click({
|
||||
# Load and apply default settings
|
||||
$defaultsJson = LoadJsonFile -filePath $script:DefaultSettingsFilePath -expectedVersion "1.0"
|
||||
if ($defaultsJson) {
|
||||
ApplySettingsToUiControls -window $window -settingsJson $defaultsJson -uiControlMappings $script:UiControlMappings
|
||||
}
|
||||
|
||||
# Select default apps
|
||||
foreach ($child in $appsPanel.Children) {
|
||||
if ($child -is [System.Windows.Controls.CheckBox]) {
|
||||
$child.IsChecked = ($child.SelectedByDefault -eq $true)
|
||||
}
|
||||
}
|
||||
|
||||
# Navigate directly to the Overview tab
|
||||
$tabControl.SelectedIndex = 3
|
||||
UpdateNavigationButtons
|
||||
})
|
||||
|
||||
# Handle Overview Apply Changes button - validates and immediately starts applying changes
|
||||
$overviewApplyBtn = $window.FindName('OverviewApplyBtn')
|
||||
$overviewApplyBtn.Add_Click({
|
||||
|
||||
Reference in New Issue
Block a user