mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2026-02-17 07:56:24 +00:00
Add titlebar menu and MessageBox styling (#470)
This commit is contained in:
253
Assets/Schemas/AboutWindow.xaml
Normal file
253
Assets/Schemas/AboutWindow.xaml
Normal file
@@ -0,0 +1,253 @@
|
||||
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="About Win11Debloat"
|
||||
Width="500"
|
||||
SizeToContent="Height"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
WindowStyle="None"
|
||||
AllowsTransparency="True"
|
||||
Background="Transparent"
|
||||
Topmost="True"
|
||||
ShowInTaskbar="False">
|
||||
|
||||
<Window.Resources>
|
||||
<Style x:Key="HyperlinkStyle" TargetType="TextBlock">
|
||||
<Setter Property="Foreground" Value="#0078D4"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Foreground" Value="#106EBE"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!-- Button Style -->
|
||||
<Style x:Key="MessageBoxButton" TargetType="Button">
|
||||
<Setter Property="Background" Value="{DynamicResource SecondaryButtonBg}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource FgColor}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderColor}"/>
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
<Setter Property="Height" Value="32"/>
|
||||
<Setter Property="MinWidth" Value="80"/>
|
||||
<Setter Property="Margin" Value="4,0"/>
|
||||
<Setter Property="FontWeight" Value="Normal"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border x:Name="Border"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="4"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,1"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Border" Property="Background" Value="{DynamicResource SecondaryButtonHover}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="Border" Property="Background" Value="{DynamicResource SecondaryButtonPressed}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- Primary Button Style -->
|
||||
<Style x:Key="PrimaryMessageBoxButton" TargetType="Button" BasedOn="{StaticResource MessageBoxButton}">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonBg}"/>
|
||||
<Setter Property="Foreground" Value="white"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBg}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="4"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,1"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonDisabled}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDisabled}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonTextDisabled}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonHover}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonHover}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonPressed}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonPressed}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
|
||||
<Border BorderBrush="{DynamicResource BorderColor}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="8"
|
||||
Background="{DynamicResource CardBgColor}"
|
||||
Margin="25">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Color="Black"
|
||||
Opacity="0.15"
|
||||
BlurRadius="20"
|
||||
ShadowDepth="0"
|
||||
Direction="0"/>
|
||||
</Border.Effect>
|
||||
|
||||
<Grid Margin="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Title Bar -->
|
||||
<Grid Grid.Row="0" x:Name="TitleBar" Height="48" Background="Transparent">
|
||||
<TextBlock Text="About Win11Debloat"
|
||||
Foreground="{DynamicResource FgColor}"
|
||||
FontSize="18"
|
||||
FontWeight="SemiBold"
|
||||
VerticalAlignment="Center"
|
||||
Margin="20,0,0,0"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Message Content -->
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Message Text -->
|
||||
<Grid Grid.Row="0" Margin="24,12,24,20">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Version -->
|
||||
<TextBlock Grid.Row="0" Grid.Column="0"
|
||||
Text="Version:"
|
||||
FontSize="14"
|
||||
Foreground="{DynamicResource FgColor}"
|
||||
FontWeight="SemiBold"
|
||||
Margin="0,0,16,8"/>
|
||||
<TextBlock x:Name="VersionText"
|
||||
Grid.Row="0" Grid.Column="1"
|
||||
Text="0.0.0"
|
||||
FontSize="14"
|
||||
Foreground="{DynamicResource FgColor}"
|
||||
Margin="0,0,0,8"/>
|
||||
|
||||
<!-- Author -->
|
||||
<TextBlock Grid.Row="1" Grid.Column="0"
|
||||
Text="Author:"
|
||||
FontSize="14"
|
||||
Foreground="{DynamicResource FgColor}"
|
||||
FontWeight="SemiBold"
|
||||
Margin="0,0,16,8"/>
|
||||
<TextBlock Grid.Row="1" Grid.Column="1"
|
||||
Text="Raphire"
|
||||
FontSize="14"
|
||||
Foreground="{DynamicResource FgColor}"
|
||||
Margin="0,0,0,8"/>
|
||||
|
||||
<!-- Project Link -->
|
||||
<TextBlock Grid.Row="2" Grid.Column="0"
|
||||
Text="Project:"
|
||||
FontSize="14"
|
||||
Foreground="{DynamicResource FgColor}"
|
||||
FontWeight="SemiBold"
|
||||
Margin="0,0,16,0"/>
|
||||
<TextBlock x:Name="ProjectLink"
|
||||
Grid.Row="2" Grid.Column="1"
|
||||
Text="https://github.com/Raphire/Win11Debloat"
|
||||
FontSize="14"
|
||||
Style="{StaticResource HyperlinkStyle}"
|
||||
Margin="0,0,0,0"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Separator -->
|
||||
<Border Grid.Row="1"
|
||||
Height="1"
|
||||
Background="{DynamicResource BorderColor}"
|
||||
Margin="10,0"/>
|
||||
|
||||
<!-- Content -->
|
||||
<StackPanel Grid.Row="2" Margin="24,20">
|
||||
<!-- Donation Message -->
|
||||
<TextBlock Text="If you found this tool helpful, please consider making a small donation to help keep it going."
|
||||
FontSize="14"
|
||||
Foreground="{DynamicResource FgColor}"
|
||||
TextWrapping="Wrap"
|
||||
Margin="0,0,0,15"/>
|
||||
|
||||
<!-- Ko-fi Link -->
|
||||
<Grid HorizontalAlignment="Left">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock x:Name="KofiLinkIcon"
|
||||
Grid.Column="0"
|
||||
FontSize="14"
|
||||
Style="{StaticResource HyperlinkStyle}"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="SemiBold"
|
||||
FontFamily="Segoe Fluent Icons"
|
||||
Text=""
|
||||
Foreground="{DynamicResource CloseHover}"
|
||||
Margin="0,0,8,0"/>
|
||||
|
||||
<TextBlock x:Name="KofiLink"
|
||||
Grid.Column="1"
|
||||
FontSize="14"
|
||||
Style="{StaticResource HyperlinkStyle}"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="SemiBold"
|
||||
Text="Support on Ko-fi"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<!-- Button Panel -->
|
||||
<Border Grid.Row="2"
|
||||
Background="{DynamicResource BgColor}"
|
||||
BorderBrush="{DynamicResource BorderColor}"
|
||||
BorderThickness="0,1,0,0"
|
||||
Padding="16,12"
|
||||
CornerRadius="0,0,8,8">
|
||||
<StackPanel x:Name="ButtonPanel"
|
||||
Orientation="Horizontal"
|
||||
HorizontalAlignment="Right">
|
||||
<Button x:Name="CloseButton"
|
||||
Content="Close"
|
||||
Style="{StaticResource MessageBoxButton}"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Window>
|
||||
@@ -205,7 +205,15 @@
|
||||
<Border BorderBrush="{DynamicResource BorderColor}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="8"
|
||||
Background="{DynamicResource BgColor}">
|
||||
Background="{DynamicResource BgColor}"
|
||||
Margin="25">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Color="Black"
|
||||
Opacity="0.15"
|
||||
BlurRadius="20"
|
||||
ShadowDepth="0"
|
||||
Direction="0"/>
|
||||
</Border.Effect>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="32"/>
|
||||
@@ -273,6 +281,16 @@
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<!-- Modal Overlay for MessageBoxes -->
|
||||
<Rectangle x:Name="ModalOverlay"
|
||||
Grid.RowSpan="2"
|
||||
Fill="#80000000"
|
||||
Visibility="Collapsed"
|
||||
Panel.ZIndex="1000"
|
||||
RadiusX="8"
|
||||
RadiusY="8"
|
||||
Margin="-1"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Window>
|
||||
|
||||
@@ -414,7 +414,7 @@
|
||||
</Style>
|
||||
|
||||
<!-- Button Style -->
|
||||
<Style x:Key="Win11Button" TargetType="Button">
|
||||
<Style x:Key="PrimaryButtonStyle" TargetType="Button">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonBg}"/>
|
||||
<Setter Property="Foreground" Value="white"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBg}"/>
|
||||
@@ -453,7 +453,7 @@
|
||||
</Style>
|
||||
|
||||
<!-- Secondary Button Style -->
|
||||
<Style x:Key="Win11ButtonSecondary" TargetType="Button">
|
||||
<Style x:Key="SecondaryButtonStyle" TargetType="Button">
|
||||
<Setter Property="Background" Value="{DynamicResource SecondaryButtonBg}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource FgColor}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderColor}"/>
|
||||
@@ -517,22 +517,22 @@
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style x:Key="HelpButton" TargetType="Button" BasedOn="{StaticResource TitleBarButton}">
|
||||
<Style x:Key="TitlebarButton" TargetType="Button" BasedOn="{StaticResource TitleBarButton}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border Background="{TemplateBinding Background}" BorderThickness="0" CornerRadius="0">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,3"/>
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonBg}"/>
|
||||
<Setter Property="Background" Value="{DynamicResource SecondaryButtonHover}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonHover}"/>
|
||||
<Setter Property="Background" Value="{DynamicResource SecondaryButtonPressed}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
@@ -551,12 +551,81 @@
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!-- ContextMenu Style -->
|
||||
<Style TargetType="ContextMenu">
|
||||
<Setter Property="Background" Value="{DynamicResource CardBgColor}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderColor}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Padding" Value="4"/>
|
||||
<Setter Property="HasDropShadow" Value="True"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ContextMenu">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="4"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<StackPanel IsItemsHost="True"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- MenuItem Style -->
|
||||
<Style TargetType="MenuItem">
|
||||
<Setter Property="Foreground" Value="{DynamicResource FgColor}"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Padding" Value="8,6"/>
|
||||
<Setter Property="Height" Value="32"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="MenuItem">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
BorderThickness="0"
|
||||
CornerRadius="4"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="24"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ContentPresenter Grid.Column="0" ContentSource="Icon"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"/>
|
||||
<ContentPresenter Grid.Column="1" ContentSource="Header"
|
||||
VerticalAlignment="Center"
|
||||
Margin="8,0,0,1"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsHighlighted" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource ComboItemHoverColor}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource ComboItemSelectedColor}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
|
||||
<Border BorderBrush="{DynamicResource BorderColor}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="8"
|
||||
Background="{DynamicResource BgColor}">
|
||||
Background="{DynamicResource BgColor}"
|
||||
Margin="25">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Color="Black"
|
||||
Opacity="0.15"
|
||||
BlurRadius="20"
|
||||
ShadowDepth="0"
|
||||
Direction="0"/>
|
||||
</Border.Effect>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="32"/>
|
||||
@@ -589,7 +658,33 @@
|
||||
Margin="12,0,0,0"
|
||||
FontSize="12"/>
|
||||
<StackPanel Grid.Column="1" Orientation="Horizontal">
|
||||
<Button x:Name="HelpBtn" Content="?" FontFamily="Segoe UI" FontSize="15" Style="{StaticResource HelpButton}" ToolTip="Open Wiki" AutomationProperties.Name="Open Wiki"/>
|
||||
<Button x:Name="KofiBtn" Content="" FontFamily="Segoe Fluent Icons" FontSize="15" Style="{StaticResource TitlebarButton}" ToolTip="Support the creator" AutomationProperties.Name="Support the creator"/>
|
||||
<Button x:Name="MenuBtn" Content="" FontFamily="Segoe Fluent Icons" FontSize="15" Style="{StaticResource TitlebarButton}" ToolTip="Options" AutomationProperties.Name="Options">
|
||||
<Button.ContextMenu>
|
||||
<ContextMenu x:Name="MainMenu">
|
||||
<MenuItem x:Name="MenuDocumentation" Header="Documentation" AutomationProperties.Name="Documentation">
|
||||
<MenuItem.Icon>
|
||||
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="16" Foreground="{DynamicResource FgColor}"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem x:Name="MenuReportBug" Header="Report a bug" AutomationProperties.Name="Report a bug">
|
||||
<MenuItem.Icon>
|
||||
<TextBlock Text="" FontFamily="Segoe Fluent Icons" FontSize="16" Foreground="{DynamicResource FgColor}"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem x:Name="MenuLogs" Header="Logs" AutomationProperties.Name="Logs">
|
||||
<MenuItem.Icon>
|
||||
<TextBlock Text="" FontFamily="Segoe Fluent Icons" FontSize="16" Foreground="{DynamicResource FgColor}"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem x:Name="MenuAbout" Header="About" AutomationProperties.Name="About">
|
||||
<MenuItem.Icon>
|
||||
<TextBlock Text="" FontFamily="Segoe Fluent Icons" FontSize="16" Foreground="{DynamicResource FgColor}"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</Button.ContextMenu>
|
||||
</Button>
|
||||
<Button x:Name="CloseBtn" Content="" Style="{StaticResource CloseButton}" ToolTip="Close" AutomationProperties.Name="Close"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
@@ -657,7 +752,7 @@
|
||||
</TextBlock>
|
||||
|
||||
<!-- Start Button -->
|
||||
<Button x:Name="HomeStartBtn" Width="125" Height="53" Style="{StaticResource Win11Button}" HorizontalAlignment="Center" Margin="0,20,0,0" AutomationProperties.Name="Start">
|
||||
<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>
|
||||
@@ -685,9 +780,9 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Grid.Column="0">
|
||||
<Button x:Name="DefaultAppsBtn" Content="Select Default Apps" ToolTip="Select the default selection of apps" Style="{StaticResource Win11ButtonSecondary}" Height="32" Padding="10,0" Margin="0,0,10,0" AutomationProperties.Name="Select Default Apps"/>
|
||||
<Button x:Name="LoadLastUsedAppsBtn" Content="Select Last Used Selection" ToolTip="Select the apps that were selected the last time Win11Debloat was run" Style="{StaticResource Win11ButtonSecondary}" Height="32" Padding="10,0" Margin="0,0,10,0" AutomationProperties.Name="Select Last Used Selection"/>
|
||||
<Button x:Name="ClearAppSelectionBtn" Content="Clear Selection" ToolTip="Clear all selected apps" Style="{StaticResource Win11ButtonSecondary}" Height="32" Padding="10,0" Margin="0,0,10,0" AutomationProperties.Name="Clear Selection"/>
|
||||
<Button x:Name="DefaultAppsBtn" Content="Select Default Apps" ToolTip="Select the default selection of apps" Style="{StaticResource SecondaryButtonStyle}" Height="32" Padding="10,0" Margin="0,0,10,0" AutomationProperties.Name="Select Default Apps"/>
|
||||
<Button x:Name="LoadLastUsedAppsBtn" Content="Select Last Used Selection" ToolTip="Select the apps that were selected the last time Win11Debloat was run" Style="{StaticResource SecondaryButtonStyle}" Height="32" Padding="10,0" Margin="0,0,10,0" AutomationProperties.Name="Select Last Used Selection"/>
|
||||
<Button x:Name="ClearAppSelectionBtn" Content="Clear Selection" ToolTip="Clear all selected apps" Style="{StaticResource SecondaryButtonStyle}" Height="32" Padding="10,0" Margin="0,0,10,0" AutomationProperties.Name="Clear Selection"/>
|
||||
</StackPanel>
|
||||
|
||||
<CheckBox x:Name="OnlyInstalledAppsBox" Grid.Column="2" Content="Only show installed apps" IsChecked="False" Foreground="{DynamicResource FgColor}" VerticalAlignment="Center" AutomationProperties.Name="Only show installed apps"/>
|
||||
@@ -758,9 +853,9 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal">
|
||||
<Button x:Name="LoadDefaultsBtn" Content="Select Default Settings" ToolTip="Select the settings that are recommended for most people" Style="{StaticResource Win11ButtonSecondary}" Padding="10,0" Height="32" Margin="0,0,10,0" AutomationProperties.Name="Select Default Settings"/>
|
||||
<Button x:Name="LoadLastUsedBtn" Content="Select Last Used Settings" ToolTip="Select the settings that were used the last time Win11Debloat was run" Style="{StaticResource Win11ButtonSecondary}" Padding="10,0" Height="32" Margin="0,0,10,0" AutomationProperties.Name="Select Last Used Settings"/>
|
||||
<Button x:Name="ClearAllTweaksBtn" Content="Clear Selection" ToolTip="Clear all selected tweaks" Style="{StaticResource Win11ButtonSecondary}" Padding="10,0" Height="32" Margin="0,0,10,0" AutomationProperties.Name="Clear Selection"/>
|
||||
<Button x:Name="LoadDefaultsBtn" Content="Select Default Settings" ToolTip="Select the settings that are recommended for most people" Style="{StaticResource SecondaryButtonStyle}" Padding="10,0" Height="32" Margin="0,0,10,0" AutomationProperties.Name="Select Default Settings"/>
|
||||
<Button x:Name="LoadLastUsedBtn" Content="Select Last Used Settings" ToolTip="Select the settings that were used the last time Win11Debloat was run" Style="{StaticResource SecondaryButtonStyle}" Padding="10,0" Height="32" Margin="0,0,10,0" AutomationProperties.Name="Select Last Used Settings"/>
|
||||
<Button x:Name="ClearAllTweaksBtn" Content="Clear Selection" ToolTip="Clear all selected tweaks" Style="{StaticResource SecondaryButtonStyle}" Padding="10,0" Height="32" Margin="0,0,10,0" AutomationProperties.Name="Clear Selection"/>
|
||||
</StackPanel>
|
||||
|
||||
<Border x:Name="TweakSearchBorder" Grid.Column="2">
|
||||
@@ -916,7 +1011,7 @@
|
||||
</Border>
|
||||
|
||||
<!-- Apply Changes Button -->
|
||||
<Button x:Name="OverviewApplyBtn" Style="{StaticResource Win11Button}" Width="190" Height="44" Margin="0,0,0,15" HorizontalAlignment="Center" AutomationProperties.Name="Apply Changes">
|
||||
<Button x:Name="OverviewApplyBtn" Style="{StaticResource PrimaryButtonStyle}" Width="190" Height="44" Margin="0,0,0,15" HorizontalAlignment="Center" AutomationProperties.Name="Apply Changes">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="20" FontWeight="SemiBold" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="Apply Changes" VerticalAlignment="Center" FontSize="18" FontWeight="SemiBold" Margin="8,0,0,4"/>
|
||||
@@ -981,7 +1076,7 @@
|
||||
|
||||
<!-- Status and Finish Button -->
|
||||
<StackPanel Grid.Row="1" HorizontalAlignment="Center">
|
||||
<Button x:Name="FinishBtn" Width="200" Height="48" Style="{StaticResource Win11Button}" Margin="0" IsEnabled="False" AutomationProperties.Name="Finish">
|
||||
<Button x:Name="FinishBtn" Width="200" Height="48" Style="{StaticResource PrimaryButtonStyle}" Margin="0" IsEnabled="False" AutomationProperties.Name="Finish">
|
||||
<TextBlock x:Name="FinishBtnText" Text="Applying changes..." VerticalAlignment="Center" FontSize="16" Margin="0,0,0,1"/>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
@@ -999,7 +1094,7 @@
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button x:Name="PreviousBtn" Grid.Column="0" Width="120" Height="36" Style="{StaticResource Win11ButtonSecondary}" Visibility="Collapsed" Margin="10,0,0,0" AutomationProperties.Name="Previous">
|
||||
<Button x:Name="PreviousBtn" Grid.Column="0" Width="120" Height="36" Style="{StaticResource SecondaryButtonStyle}" Visibility="Collapsed" Margin="10,0,0,0" AutomationProperties.Name="Previous">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="12" Margin="0,0,8,0" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="Previous" VerticalAlignment="Center" FontSize="14" Margin="0,0,0,1"/>
|
||||
@@ -1007,7 +1102,7 @@
|
||||
</Button>
|
||||
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button x:Name="NextBtn" Width="120" Height="36" Margin="0,0,10,0" Style="{StaticResource Win11Button}" AutomationProperties.Name="Next">
|
||||
<Button x:Name="NextBtn" Width="120" Height="36" Margin="0,0,10,0" Style="{StaticResource PrimaryButtonStyle}" AutomationProperties.Name="Next">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<TextBlock Text="Next" VerticalAlignment="Center" FontSize="14" Margin="0,0,0,1"/>
|
||||
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="12" Margin="8,0,0,0" VerticalAlignment="Center"/>
|
||||
@@ -1023,6 +1118,16 @@
|
||||
<Ellipse x:Name="ProgressIndicator3" Width="10" Height="10" Margin="4,0" Fill="#808080" ToolTip="Overview"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<!-- Modal Overlay for MessageBoxes -->
|
||||
<Rectangle x:Name="ModalOverlay"
|
||||
Grid.RowSpan="3"
|
||||
Fill="#80000000"
|
||||
Visibility="Collapsed"
|
||||
Panel.ZIndex="1000"
|
||||
RadiusX="8"
|
||||
RadiusY="8"
|
||||
Margin="-1"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Window>
|
||||
|
||||
168
Assets/Schemas/MessageBoxWindow.xaml
Normal file
168
Assets/Schemas/MessageBoxWindow.xaml
Normal file
@@ -0,0 +1,168 @@
|
||||
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="MessageBox"
|
||||
Width="440"
|
||||
SizeToContent="Height"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
WindowStyle="None"
|
||||
AllowsTransparency="True"
|
||||
Background="Transparent"
|
||||
Topmost="True"
|
||||
ShowInTaskbar="False">
|
||||
|
||||
<Window.Resources>
|
||||
<!-- Button Style -->
|
||||
<Style x:Key="MessageBoxButton" TargetType="Button">
|
||||
<Setter Property="Background" Value="{DynamicResource SecondaryButtonBg}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource FgColor}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderColor}"/>
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
<Setter Property="Height" Value="32"/>
|
||||
<Setter Property="MinWidth" Value="80"/>
|
||||
<Setter Property="Margin" Value="4,0"/>
|
||||
<Setter Property="FontWeight" Value="Normal"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border x:Name="Border"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="4"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Border" Property="Background" Value="{DynamicResource SecondaryButtonHover}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="Border" Property="Background" Value="{DynamicResource SecondaryButtonPressed}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- Primary Button Style -->
|
||||
<Style x:Key="PrimaryMessageBoxButton" TargetType="Button" BasedOn="{StaticResource MessageBoxButton}">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonBg}"/>
|
||||
<Setter Property="Foreground" Value="white"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBg}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="4"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,1"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonDisabled}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDisabled}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonTextDisabled}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonHover}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonHover}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonPressed}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonPressed}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
|
||||
<Border BorderBrush="{DynamicResource BorderColor}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="8"
|
||||
Background="{DynamicResource CardBgColor}"
|
||||
Margin="25">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Color="Black"
|
||||
Opacity="0.15"
|
||||
BlurRadius="20"
|
||||
ShadowDepth="0"
|
||||
Direction="0"/>
|
||||
</Border.Effect>
|
||||
|
||||
<Grid Margin="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Title Bar -->
|
||||
<Grid Grid.Row="0" x:Name="TitleBar" Height="40" Background="Transparent">
|
||||
<TextBlock x:Name="TitleText"
|
||||
Text="Message"
|
||||
Foreground="{DynamicResource FgColor}"
|
||||
FontSize="16"
|
||||
FontWeight="SemiBold"
|
||||
VerticalAlignment="Center"
|
||||
Margin="16,0,0,0"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Message Content -->
|
||||
<Grid Grid.Row="1" Margin="24,12,24,20">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Icon -->
|
||||
<TextBlock x:Name="IconText"
|
||||
Grid.Column="0"
|
||||
FontFamily="Segoe Fluent Icons"
|
||||
FontSize="24"
|
||||
Foreground="{DynamicResource FgColor}"
|
||||
VerticalAlignment="Center"
|
||||
Margin="0,2,14,0"
|
||||
Visibility="Collapsed"/>
|
||||
|
||||
<!-- Message Text -->
|
||||
<TextBlock x:Name="MessageText"
|
||||
Grid.Column="1"
|
||||
Text="Message content goes here"
|
||||
TextWrapping="Wrap"
|
||||
FontSize="14"
|
||||
LineHeight="20"
|
||||
Foreground="{DynamicResource FgColor}"
|
||||
VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Button Panel -->
|
||||
<Border Grid.Row="2"
|
||||
Background="{DynamicResource BgColor}"
|
||||
BorderBrush="{DynamicResource BorderColor}"
|
||||
BorderThickness="0,1,0,0"
|
||||
Padding="16,12"
|
||||
CornerRadius="0,0,8,8">
|
||||
<StackPanel x:Name="ButtonPanel"
|
||||
Orientation="Horizontal"
|
||||
HorizontalAlignment="Right">
|
||||
<Button x:Name="Button1"
|
||||
Content="OK"
|
||||
Style="{StaticResource PrimaryMessageBoxButton}"/>
|
||||
<Button x:Name="Button2"
|
||||
Content="Cancel"
|
||||
Style="{StaticResource MessageBoxButton}"
|
||||
Visibility="Collapsed"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Window>
|
||||
352
Win11Debloat.ps1
352
Win11Debloat.ps1
@@ -93,6 +93,7 @@ param (
|
||||
|
||||
|
||||
# Define script-level variables & paths
|
||||
$script:Version = "2026.02.12"
|
||||
$script:DefaultSettingsFilePath = "$PSScriptRoot/DefaultSettings.json"
|
||||
$script:AppsListFilePath = "$PSScriptRoot/Apps.json"
|
||||
$script:SavedSettingsFilePath = "$PSScriptRoot/LastUsedSettings.json"
|
||||
@@ -102,6 +103,8 @@ $script:RegfilesPath = "$PSScriptRoot/Regfiles"
|
||||
$script:AssetsPath = "$PSScriptRoot/Assets"
|
||||
$script:AppSelectionSchema = "$script:AssetsPath/Schemas/AppSelectionWindow.xaml"
|
||||
$script:MainWindowSchema = "$script:AssetsPath/Schemas/MainWindow.xaml"
|
||||
$script:MessageBoxSchema = "$script:AssetsPath/Schemas/MessageBoxWindow.xaml"
|
||||
$script:AboutWindowSchema = "$script:AssetsPath/Schemas/AboutWindow.xaml"
|
||||
$script:FeaturesFilePath = "$script:AssetsPath/Features.json"
|
||||
|
||||
$script:ControlParams = 'WhatIf', 'Confirm', 'Verbose', 'Debug', 'LogPath', 'Silent', 'Sysprep', 'User', 'NoRestartExplorer', 'RunDefaults', 'RunDefaultsLite', 'RunSavedSettings', 'RunAppsListGenerator', 'CLI', 'AppRemovalTarget'
|
||||
@@ -551,6 +554,10 @@ function SetWindowThemeResources {
|
||||
$window.Resources.Add("ButtonHover", [System.Windows.Media.SolidColorBrush]::new([System.Windows.Media.ColorConverter]::ConvertFromString("#1E88E5")))
|
||||
$window.Resources.Add("ButtonPressed", [System.Windows.Media.SolidColorBrush]::new([System.Windows.Media.ColorConverter]::ConvertFromString("#3284cc")))
|
||||
$window.Resources.Add("CloseHover", [System.Windows.Media.SolidColorBrush]::new([System.Windows.Media.ColorConverter]::ConvertFromString("#c42b1c")))
|
||||
$window.Resources.Add("InformationIconColor", [System.Windows.Media.SolidColorBrush]::new([System.Windows.Media.ColorConverter]::ConvertFromString("#0078D4")))
|
||||
$window.Resources.Add("WarningIconColor", [System.Windows.Media.SolidColorBrush]::new([System.Windows.Media.ColorConverter]::ConvertFromString("#FFB900")))
|
||||
$window.Resources.Add("ErrorIconColor", [System.Windows.Media.SolidColorBrush]::new([System.Windows.Media.ColorConverter]::ConvertFromString("#E81123")))
|
||||
$window.Resources.Add("QuestionIconColor", [System.Windows.Media.SolidColorBrush]::new([System.Windows.Media.ColorConverter]::ConvertFromString("#0078D4")))
|
||||
}
|
||||
|
||||
|
||||
@@ -565,6 +572,266 @@ function GetSystemUsesDarkMode {
|
||||
}
|
||||
|
||||
|
||||
# Shows a Windows 11 styled custom message box
|
||||
function Show-ModernMessageBox {
|
||||
param (
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$Message,
|
||||
|
||||
[Parameter(Mandatory=$false)]
|
||||
[string]$Title = "Win11Debloat",
|
||||
|
||||
[Parameter(Mandatory=$false)]
|
||||
[ValidateSet('OK', 'OKCancel', 'YesNo', 'YesNoCancel')]
|
||||
[string]$Button = 'OK',
|
||||
|
||||
[Parameter(Mandatory=$false)]
|
||||
[ValidateSet('None', 'Information', 'Warning', 'Error', 'Question')]
|
||||
[string]$Icon = 'None',
|
||||
|
||||
[Parameter(Mandatory=$false)]
|
||||
[System.Windows.Window]$Owner = $null
|
||||
)
|
||||
|
||||
Add-Type -AssemblyName PresentationFramework,PresentationCore,WindowsBase | Out-Null
|
||||
|
||||
$usesDarkMode = GetSystemUsesDarkMode
|
||||
|
||||
# Determine owner window - use provided Owner, or fall back to main GUI window
|
||||
$ownerWindow = if ($Owner) { $Owner } else { $script:GuiWindow }
|
||||
|
||||
# Show overlay if owner window exists
|
||||
$overlay = $null
|
||||
if ($ownerWindow) {
|
||||
try {
|
||||
$overlay = $ownerWindow.FindName('ModalOverlay')
|
||||
if ($overlay) {
|
||||
$ownerWindow.Dispatcher.Invoke([action]{ $overlay.Visibility = 'Visible' })
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
# Load XAML from file
|
||||
$xaml = Get-Content -Path $script:MessageBoxSchema -Raw
|
||||
$reader = [System.Xml.XmlReader]::Create([System.IO.StringReader]::new($xaml))
|
||||
try {
|
||||
$msgWindow = [System.Windows.Markup.XamlReader]::Load($reader)
|
||||
}
|
||||
finally {
|
||||
$reader.Close()
|
||||
}
|
||||
|
||||
# Set owner to owner window if it exists
|
||||
if ($ownerWindow) {
|
||||
try {
|
||||
$msgWindow.Owner = $ownerWindow
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
# Apply theme resources
|
||||
SetWindowThemeResources -window $msgWindow -usesDarkMode $usesDarkMode
|
||||
|
||||
# Get UI elements
|
||||
$titleText = $msgWindow.FindName('TitleText')
|
||||
$messageText = $msgWindow.FindName('MessageText')
|
||||
$iconText = $msgWindow.FindName('IconText')
|
||||
$button1 = $msgWindow.FindName('Button1')
|
||||
$button2 = $msgWindow.FindName('Button2')
|
||||
$titleBar = $msgWindow.FindName('TitleBar')
|
||||
|
||||
# Set title and message
|
||||
$titleText.Text = $Title
|
||||
$messageText.Text = $Message
|
||||
|
||||
# Configure icon
|
||||
switch ($Icon) {
|
||||
'Information' {
|
||||
$iconText.Text = [char]0xE946
|
||||
$iconText.Foreground = $msgWindow.FindResource('InformationIconColor')
|
||||
$iconText.Visibility = 'Visible'
|
||||
}
|
||||
'Warning' {
|
||||
$iconText.Text = [char]0xE7BA
|
||||
$iconText.Foreground = $msgWindow.FindResource('WarningIconColor')
|
||||
$iconText.Visibility = 'Visible'
|
||||
}
|
||||
'Error' {
|
||||
$iconText.Text = [char]0xEA39
|
||||
$iconText.Foreground = $msgWindow.FindResource('ErrorIconColor')
|
||||
$iconText.Visibility = 'Visible'
|
||||
}
|
||||
'Question' {
|
||||
$iconText.Text = [char]0xE897
|
||||
$iconText.Foreground = $msgWindow.FindResource('QuestionIconColor')
|
||||
$iconText.Visibility = 'Visible'
|
||||
}
|
||||
default {
|
||||
$iconText.Visibility = 'Collapsed'
|
||||
}
|
||||
}
|
||||
|
||||
# Configure buttons - store result in window's Tag property
|
||||
switch ($Button) {
|
||||
'OK' {
|
||||
$button1.Content = 'OK'
|
||||
$button1.Add_Click({ $msgWindow.Tag = 'OK'; $msgWindow.Close() })
|
||||
$button2.Visibility = 'Collapsed'
|
||||
}
|
||||
'OKCancel' {
|
||||
$button1.Content = 'OK'
|
||||
$button2.Content = 'Cancel'
|
||||
$button1.Add_Click({ $msgWindow.Tag = 'OK'; $msgWindow.Close() })
|
||||
$button2.Add_Click({ $msgWindow.Tag = 'Cancel'; $msgWindow.Close() })
|
||||
$button2.Visibility = 'Visible'
|
||||
}
|
||||
'YesNo' {
|
||||
$button1.Content = 'Yes'
|
||||
$button2.Content = 'No'
|
||||
$button1.Add_Click({ $msgWindow.Tag = 'Yes'; $msgWindow.Close() })
|
||||
$button2.Add_Click({ $msgWindow.Tag = 'No'; $msgWindow.Close() })
|
||||
$button2.Visibility = 'Visible'
|
||||
}
|
||||
'YesNoCancel' {
|
||||
$button1.Content = 'Yes'
|
||||
$button2.Content = 'No'
|
||||
$button1.Add_Click({ $msgWindow.Tag = 'Yes'; $msgWindow.Close() })
|
||||
$button2.Add_Click({ $msgWindow.Tag = 'No'; $msgWindow.Close() })
|
||||
$button2.Visibility = 'Visible'
|
||||
}
|
||||
}
|
||||
|
||||
# Title bar drag to move window
|
||||
$titleBar.Add_MouseLeftButtonDown({
|
||||
$msgWindow.DragMove()
|
||||
})
|
||||
|
||||
# Handle Escape key to close
|
||||
$msgWindow.Add_KeyDown({
|
||||
param($sender, $e)
|
||||
if ($e.Key -eq 'Escape') {
|
||||
if ($Button -eq 'OK') {
|
||||
$msgWindow.Tag = 'OK'
|
||||
} else {
|
||||
$msgWindow.Tag = 'Cancel'
|
||||
}
|
||||
$msgWindow.Close()
|
||||
}
|
||||
})
|
||||
|
||||
# Show dialog and return result from Tag
|
||||
$msgWindow.ShowDialog() | Out-Null
|
||||
|
||||
# Hide overlay after dialog closes
|
||||
if ($overlay) {
|
||||
try {
|
||||
$ownerWindow.Dispatcher.Invoke([action]{ $overlay.Visibility = 'Collapsed' })
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
return $msgWindow.Tag
|
||||
}
|
||||
|
||||
function Show-AboutDialog {
|
||||
param (
|
||||
[Parameter(Mandatory=$false)]
|
||||
[System.Windows.Window]$Owner = $null
|
||||
)
|
||||
|
||||
Add-Type -AssemblyName PresentationFramework,PresentationCore,WindowsBase | Out-Null
|
||||
|
||||
$usesDarkMode = GetSystemUsesDarkMode
|
||||
|
||||
# Determine owner window
|
||||
$ownerWindow = if ($Owner) { $Owner } else { $script:GuiWindow }
|
||||
|
||||
# Show overlay if owner window exists
|
||||
$overlay = $null
|
||||
if ($ownerWindow) {
|
||||
try {
|
||||
$overlay = $ownerWindow.FindName('ModalOverlay')
|
||||
if ($overlay) {
|
||||
$ownerWindow.Dispatcher.Invoke([action]{ $overlay.Visibility = 'Visible' })
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
# Load XAML from file
|
||||
$xaml = Get-Content -Path $script:AboutWindowSchema -Raw
|
||||
$reader = [System.Xml.XmlReader]::Create([System.IO.StringReader]::new($xaml))
|
||||
try {
|
||||
$aboutWindow = [System.Windows.Markup.XamlReader]::Load($reader)
|
||||
}
|
||||
finally {
|
||||
$reader.Close()
|
||||
}
|
||||
|
||||
# Set owner to owner window if it exists
|
||||
if ($ownerWindow) {
|
||||
try {
|
||||
$aboutWindow.Owner = $ownerWindow
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
# Apply theme resources
|
||||
SetWindowThemeResources -window $aboutWindow -usesDarkMode $usesDarkMode
|
||||
|
||||
# Get UI elements
|
||||
$titleBar = $aboutWindow.FindName('TitleBar')
|
||||
$versionText = $aboutWindow.FindName('VersionText')
|
||||
$projectLink = $aboutWindow.FindName('ProjectLink')
|
||||
$kofiLink = $aboutWindow.FindName('KofiLink')
|
||||
$closeButton = $aboutWindow.FindName('CloseButton')
|
||||
|
||||
# Set version
|
||||
$versionText.Text = $script:Version
|
||||
|
||||
# Title bar drag to move window
|
||||
$titleBar.Add_MouseLeftButtonDown({
|
||||
$aboutWindow.DragMove()
|
||||
})
|
||||
|
||||
# Project link click handler
|
||||
$projectLink.Add_MouseLeftButtonDown({
|
||||
Start-Process "https://github.com/Raphire/Win11Debloat"
|
||||
})
|
||||
|
||||
# Ko-fi link click handler
|
||||
$kofiLink.Add_MouseLeftButtonDown({
|
||||
Start-Process "https://ko-fi.com/raphire"
|
||||
})
|
||||
|
||||
# Close button handler
|
||||
$closeButton.Add_Click({
|
||||
$aboutWindow.Close()
|
||||
})
|
||||
|
||||
# Handle Escape key to close
|
||||
$aboutWindow.Add_KeyDown({
|
||||
param($sender, $e)
|
||||
if ($e.Key -eq 'Escape') {
|
||||
$aboutWindow.Close()
|
||||
}
|
||||
})
|
||||
|
||||
# Show dialog
|
||||
$aboutWindow.ShowDialog() | Out-Null
|
||||
|
||||
# Hide overlay after dialog closes
|
||||
if ($overlay) {
|
||||
try {
|
||||
$ownerWindow.Dispatcher.Invoke([action]{ $overlay.Visibility = 'Collapsed' })
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Initializes and opens the main GUI window
|
||||
function OpenGUI {
|
||||
Add-Type -AssemblyName PresentationFramework,PresentationCore,WindowsBase,System.Windows.Forms | Out-Null
|
||||
@@ -588,8 +855,13 @@ function OpenGUI {
|
||||
|
||||
# Get named elements
|
||||
$titleBar = $window.FindName('TitleBar')
|
||||
$helpBtn = $window.FindName('HelpBtn')
|
||||
$kofiBtn = $window.FindName('KofiBtn')
|
||||
$menuBtn = $window.FindName('MenuBtn')
|
||||
$closeBtn = $window.FindName('CloseBtn')
|
||||
$menuDocumentation = $window.FindName('MenuDocumentation')
|
||||
$menuReportBug = $window.FindName('MenuReportBug')
|
||||
$menuLogs = $window.FindName('MenuLogs')
|
||||
$menuAbout = $window.FindName('MenuAbout')
|
||||
|
||||
# Title bar event handlers
|
||||
$titleBar.Add_MouseLeftButtonDown({
|
||||
@@ -598,10 +870,38 @@ function OpenGUI {
|
||||
}
|
||||
})
|
||||
|
||||
$helpBtn.Add_Click({
|
||||
$kofiBtn.Add_Click({
|
||||
Start-Process "https://ko-fi.com/raphire"
|
||||
})
|
||||
|
||||
$menuBtn.Add_Click({
|
||||
$menuBtn.ContextMenu.PlacementTarget = $menuBtn
|
||||
$menuBtn.ContextMenu.Placement = [System.Windows.Controls.Primitives.PlacementMode]::Bottom
|
||||
$menuBtn.ContextMenu.IsOpen = $true
|
||||
})
|
||||
|
||||
$menuDocumentation.Add_Click({
|
||||
Start-Process "https://github.com/Raphire/Win11Debloat/wiki"
|
||||
})
|
||||
|
||||
$menuReportBug.Add_Click({
|
||||
Start-Process "https://github.com/Raphire/Win11Debloat/issues"
|
||||
})
|
||||
|
||||
$menuLogs.Add_Click({
|
||||
$logPath = Join-Path $PSScriptRoot "Win11Debloat.log"
|
||||
if (Test-Path $logPath) {
|
||||
Start-Process "notepad.exe" -ArgumentList $logPath
|
||||
}
|
||||
else {
|
||||
Show-ModernMessageBox -Message "No log file found at: $logPath" -Title "Logs" -Button 'OK' -Icon 'Information'
|
||||
}
|
||||
})
|
||||
|
||||
$menuAbout.Add_Click({
|
||||
Show-AboutDialog -Owner $window
|
||||
})
|
||||
|
||||
$closeBtn.Add_Click({
|
||||
$window.Close()
|
||||
})
|
||||
@@ -783,7 +1083,7 @@ function OpenGUI {
|
||||
$featuresJson = LoadJsonFile -filePath $script:FeaturesFilePath -expectedVersion "1.0"
|
||||
|
||||
if (-not $featuresJson) {
|
||||
[System.Windows.MessageBox]::Show("Unable to load Features.json file!","Error",[System.Windows.MessageBoxButton]::OK,[System.Windows.MessageBoxImage]::Error) | Out-Null
|
||||
Show-ModernMessageBox -Message "Unable to load Features.json file!" -Title "Error" -Button 'OK' -Icon 'Error' | Out-Null
|
||||
Exit
|
||||
}
|
||||
|
||||
@@ -1118,7 +1418,7 @@ function OpenGUI {
|
||||
$script:CurrentAppLoadJobStartTime = $null
|
||||
|
||||
# Show error that the script was unable to get list of apps from WinGet
|
||||
[System.Windows.MessageBox]::Show('Unable to load list of installed apps via WinGet.', 'Error', 'OK', 'Error') | Out-Null
|
||||
Show-ModernMessageBox -Message 'Unable to load list of installed apps via WinGet.' -Title 'Error' -Button 'OK' -Icon 'Error' | Out-Null
|
||||
$onlyInstalledAppsBox.IsChecked = $false
|
||||
|
||||
# Continue with loading all apps (unchecked now)
|
||||
@@ -1691,7 +1991,7 @@ function OpenGUI {
|
||||
$overviewApplyBtn = $window.FindName('OverviewApplyBtn')
|
||||
$overviewApplyBtn.Add_Click({
|
||||
if (-not (ValidateOtherUsername)) {
|
||||
[System.Windows.MessageBox]::Show("Please enter a valid username.", "Invalid Username", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning) | Out-Null
|
||||
Show-ModernMessageBox -Message "Please enter a valid username." -Title "Invalid Username" -Button 'OK' -Icon 'Warning' | Out-Null
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1706,14 +2006,9 @@ function OpenGUI {
|
||||
if ($selectedApps.Count -gt 0) {
|
||||
# Check if Microsoft Store is selected
|
||||
if ($selectedApps -contains "Microsoft.WindowsStore") {
|
||||
$result = [System.Windows.MessageBox]::Show(
|
||||
'Are you sure you wish to uninstall the Microsoft Store? This app cannot easily be reinstalled.',
|
||||
'Are you sure?',
|
||||
[System.Windows.MessageBoxButton]::YesNo,
|
||||
[System.Windows.MessageBoxImage]::Warning
|
||||
)
|
||||
$result = Show-ModernMessageBox -Message 'Are you sure you wish to uninstall the Microsoft Store? This app cannot easily be reinstalled.' -Title 'Are you sure?' -Button 'YesNo' -Icon 'Warning'
|
||||
|
||||
if ($result -eq [System.Windows.MessageBoxResult]::No) {
|
||||
if ($result -eq 'No') {
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -1789,12 +2084,7 @@ function OpenGUI {
|
||||
}
|
||||
|
||||
if ($totalChanges -eq 0) {
|
||||
[System.Windows.MessageBox]::Show(
|
||||
'No changes have been selected, please select at least one item to proceed.',
|
||||
'No Changes Selected',
|
||||
[System.Windows.MessageBoxButton]::OK,
|
||||
[System.Windows.MessageBoxImage]::Information
|
||||
)
|
||||
Show-ModernMessageBox -Message 'No changes have been selected, please select at least one option to proceed.' -Title 'No Changes Selected' -Button 'OK' -Icon 'Information'
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1906,7 +2196,7 @@ function OpenGUI {
|
||||
$defaultsJson = LoadJsonFile -filePath $script:DefaultSettingsFilePath -expectedVersion "1.0"
|
||||
|
||||
if (-not $defaultsJson) {
|
||||
[System.Windows.MessageBox]::Show("Failed to load default settings file", "Error", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Error)
|
||||
Show-ModernMessageBox -Message "Failed to load default settings file" -Title "Error" -Button 'OK' -Icon 'Error'
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1936,7 +2226,7 @@ function OpenGUI {
|
||||
ApplySettingsToUiControls -window $window -settingsJson $lastUsedSettingsJson -uiControlMappings $script:UiControlMappings
|
||||
}
|
||||
catch {
|
||||
[System.Windows.MessageBox]::Show("Failed to load last used settings: $_", "Error", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Error)
|
||||
Show-ModernMessageBox -Message "Failed to load last used settings: $_" -Title "Error" -Button 'OK' -Icon 'Error'
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -1960,7 +2250,7 @@ function OpenGUI {
|
||||
}
|
||||
}
|
||||
catch {
|
||||
[System.Windows.MessageBox]::Show("Failed to load last used app selection: $_", "Error", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Error)
|
||||
Show-ModernMessageBox -Message "Failed to load last used app selection: $_" -Title "Error" -Button 'OK' -Icon 'Error'
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -2043,7 +2333,7 @@ function OpenAppSelectionWindow {
|
||||
$listOfApps = GetInstalledAppsViaWinget -TimeOut 10
|
||||
if (-not $listOfApps) {
|
||||
# Show error that the script was unable to get list of apps from WinGet
|
||||
[System.Windows.MessageBox]::Show('Unable to load list of installed apps via WinGet.', 'Error', 'OK', 'Error') | Out-Null
|
||||
Show-ModernMessageBox -Message 'Unable to load list of installed apps via WinGet.' -Title 'Error' -Button 'OK' -Icon 'Error' -Owner $window | Out-Null
|
||||
$onlyInstalledBox.IsChecked = $false
|
||||
}
|
||||
}
|
||||
@@ -2112,14 +2402,9 @@ function OpenAppSelectionWindow {
|
||||
}
|
||||
|
||||
if ($selectedApps -contains "Microsoft.WindowsStore" -and -not $Silent) {
|
||||
$result = [System.Windows.MessageBox]::Show(
|
||||
'Are you sure you wish to uninstall the Microsoft Store? This app cannot easily be reinstalled.',
|
||||
'Are you sure?',
|
||||
[System.Windows.MessageBoxButton]::YesNo,
|
||||
[System.Windows.MessageBoxImage]::Warning
|
||||
)
|
||||
$result = Show-ModernMessageBox -Message 'Are you sure you wish to uninstall the Microsoft Store? This app cannot easily be reinstalled.' -Title 'Are you sure?' -Button 'YesNo' -Icon 'Warning' -Owner $window
|
||||
|
||||
if ($result -eq [System.Windows.MessageBoxResult]::No) {
|
||||
if ($result -eq 'No') {
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -2362,14 +2647,9 @@ function RemoveApps {
|
||||
Write-ToConsole "Unable to uninstall Microsoft Edge via WinGet" -ForegroundColor Red
|
||||
|
||||
if ($script:GuiConsoleOutput) {
|
||||
$result = [System.Windows.MessageBox]::Show(
|
||||
'Unable to uninstall Microsoft Edge via WinGet. Would you like to forcefully uninstall it? NOT RECOMMENDED!',
|
||||
'Force Uninstall Microsoft Edge?',
|
||||
[System.Windows.MessageBoxButton]::YesNo,
|
||||
[System.Windows.MessageBoxImage]::Warning
|
||||
)
|
||||
$result = Show-ModernMessageBox -Message 'Unable to uninstall Microsoft Edge via WinGet. Would you like to forcefully uninstall it? NOT RECOMMENDED!' -Title 'Force Uninstall Microsoft Edge?' -Button 'YesNo' -Icon 'Warning'
|
||||
|
||||
if ($result -eq [System.Windows.MessageBoxResult]::Yes) {
|
||||
if ($result -eq 'Yes') {
|
||||
Write-ToConsole ""
|
||||
ForceRemoveEdge
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user