Files
ThreadPilot/Views/SystemTweaksView.xaml
T
Prime Build 2665d2be9f feat: release experimental Game Boost preview 1.7.8-beta.1
Restore the complete local Game Boost/runtime topology work from 6c36ea6, including Activity diagnostics, while preserving the stable 1.7.7 release and channel guards. Preview notes document pending dual-CCD Ryzen/X3D, Intel hybrid, benchmarks and anti-cheat validation, with tester instructions.
2026-10-16 12:09:56 +02:00

329 lines
22 KiB
XML

<UserControl x:Class="ThreadPilot.Views.SystemTweaksView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="800">
<UserControl.Resources>
<!-- Windows 11 toggle switch: 40x20 track, a thumb that slides and grows on hover, accent when on,
and the state written beside it ("On"/"Off") as in Windows Settings. The label sits outside
the track, so a long translation widens the control instead of colliding with the thumb. -->
<Style x:Key="Win11ToggleSwitchStyle" TargetType="ToggleButton">
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="Focusable" Value="True"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<DockPanel Background="Transparent">
<TextBlock x:Name="StateLabel"
DockPanel.Dock="Left"
Text="{DynamicResource SystemTweaks_ToggleOff}"
VerticalAlignment="Center"
Margin="0,0,12,0"
Foreground="{DynamicResource TextPrimaryBrush}"/>
<Border x:Name="Track"
Width="40"
Height="20"
CornerRadius="10"
BorderThickness="1"
Background="Transparent"
BorderBrush="{DynamicResource TextSecondaryBrush}"
SnapsToDevicePixels="True">
<Ellipse x:Name="Thumb"
Width="12"
Height="12"
Margin="3,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Fill="{DynamicResource TextSecondaryBrush}">
<Ellipse.RenderTransform>
<TranslateTransform x:Name="ThumbOffset" X="0"/>
</Ellipse.RenderTransform>
</Ellipse>
</Border>
</DockPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="Track" Property="Background" Value="{DynamicResource AccentFillColorDefaultBrush}"/>
<Setter TargetName="Track" Property="BorderBrush" Value="{DynamicResource AccentFillColorDefaultBrush}"/>
<Setter TargetName="Thumb" Property="Fill" Value="{DynamicResource TextOnAccentFillColorPrimaryBrush}"/>
<Setter TargetName="StateLabel" Property="Text" Value="{DynamicResource SystemTweaks_ToggleOn}"/>
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="ThumbOffset" Storyboard.TargetProperty="X" To="20" Duration="0:0:0.15">
<DoubleAnimation.EasingFunction>
<CubicEase EasingMode="EaseOut"/>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="ThumbOffset" Storyboard.TargetProperty="X" To="0" Duration="0:0:0.15">
<DoubleAnimation.EasingFunction>
<CubicEase EasingMode="EaseOut"/>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Thumb" Property="Width" Value="14"/>
<Setter TargetName="Thumb" Property="Height" Value="14"/>
<Setter TargetName="Thumb" Property="Margin" Value="2,0,0,0"/>
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="True">
<Setter TargetName="Track" Property="BorderThickness" Value="2"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Track" Property="Opacity" Value="0.4"/>
<Setter TargetName="StateLabel" Property="Foreground" Value="{DynamicResource TextSecondaryBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid Margin="12">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Margin="0,0,0,12">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel>
<TextBlock Text="{DynamicResource SystemTweaksView_Title}"
Style="{StaticResource PageTitleTextStyle}"
Margin="0,0,0,4"/>
<TextBlock Text="{DynamicResource SystemTweaksView_Subtitle}"
Style="{StaticResource PageSubtitleTextStyle}"/>
<StackPanel Orientation="Horizontal" Margin="0,6,0,0">
<TextBlock Text="{DynamicResource SystemTweaksView_Status}" FontSize="12" Foreground="{DynamicResource TextSecondaryBrush}"/>
<TextBlock Text="{Binding RefreshStatusText}" FontSize="12" Foreground="{DynamicResource TextSecondaryBrush}" Margin="6,0,10,0"/>
<ProgressBar Width="100" Height="4" VerticalAlignment="Center"
IsIndeterminate="{Binding IsRefreshing}"
Visibility="{Binding IsRefreshing, Converter={StaticResource BooleanToVisibilityConverter}}"/>
</StackPanel>
</StackPanel>
<ui:Button Grid.Column="1"
VerticalAlignment="Top"
Icon="{ui:SymbolIcon ArrowClockwise24}"
Content="{DynamicResource SystemTweaksView_RefreshAll}"
Command="{Binding RefreshAllTweaksCommand}"
ToolTip="{DynamicResource SystemTweaksView_RefreshAllTooltip}"
IsEnabled="{Binding IsRefreshing, Converter={StaticResource InverseBooleanConverter}}"/>
</Grid>
<!-- One tweak per row, Windows 11 Settings style: what it does on the left, its switch on the right. -->
<ScrollViewer Grid.Row="1"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled">
<StackPanel MaxWidth="980" HorizontalAlignment="Stretch" Margin="0,0,12,12">
<!-- Game Boost: CPU Sets for the game and selected background apps while a game runs; off restores at once. -->
<Border Background="{DynamicResource CardSurfaceBrush}"
BorderBrush="{DynamicResource BorderSubtleBrush}"
BorderThickness="1"
CornerRadius="6"
Padding="16,12"
Margin="0,0,0,12"
Visibility="{Binding IsGameBoostAvailable, Converter={StaticResource BooleanToVisibilityConverter}}">
<StackPanel>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel VerticalAlignment="Center">
<TextBlock Text="{DynamicResource GameBoost_Title}" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimaryBrush}"/>
<TextBlock Text="{DynamicResource GameBoost_Description}"
FontSize="12"
Foreground="{DynamicResource TextSecondaryBrush}"
TextWrapping="Wrap"
Margin="0,2,0,0"/>
<TextBlock Text="{Binding GameBoostDecisionText}"
FontSize="12"
Foreground="{DynamicResource TextPrimaryBrush}"
TextWrapping="Wrap"
Margin="0,6,0,0"/>
</StackPanel>
<ToggleButton Grid.Column="1"
Style="{StaticResource Win11ToggleSwitchStyle}"
IsChecked="{Binding GameBoostEnabled, Mode=TwoWay}"
VerticalAlignment="Center"
Margin="10,0,0,0"
AutomationProperties.Name="{DynamicResource GameBoost_Title}"/>
</Grid>
<StackPanel Margin="0,12,0,0" IsEnabled="{Binding GameBoostEnabled}">
<TextBlock Text="{DynamicResource GameBoost_Mode}" Foreground="{DynamicResource TextPrimaryBrush}"/>
<StackPanel Orientation="Horizontal" Margin="0,4,0,0">
<RadioButton GroupName="GameBoostMode"
Content="{DynamicResource GameBoost_Mode_Automatic}"
IsChecked="{Binding GameBoostAutomatic, Mode=TwoWay}"
Margin="0,0,16,0"/>
<RadioButton GroupName="GameBoostMode"
Content="{DynamicResource GameBoost_Mode_Isolation}"
IsChecked="{Binding GameBoostIsolation, Mode=TwoWay}"/>
</StackPanel>
<TextBlock Text="{DynamicResource GameBoost_Mode_Description}"
FontSize="12"
Foreground="{DynamicResource TextSecondaryBrush}"
TextWrapping="Wrap"
Margin="0,2,0,0"/>
<Grid Margin="0,12,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel VerticalAlignment="Center">
<TextBlock Text="{DynamicResource GameBoost_AboveNormal_Name}" Foreground="{DynamicResource TextPrimaryBrush}" TextWrapping="Wrap"/>
<TextBlock Text="{DynamicResource GameBoost_AboveNormal_Description}"
FontSize="12"
Foreground="{DynamicResource TextSecondaryBrush}"
TextWrapping="Wrap"
Margin="0,2,0,0"/>
</StackPanel>
<ToggleButton Grid.Column="1"
Style="{StaticResource Win11ToggleSwitchStyle}"
IsChecked="{Binding GameBoostAboveNormal, Mode=TwoWay}"
VerticalAlignment="Center"
Margin="10,0,0,0"
AutomationProperties.Name="{DynamicResource GameBoost_AboveNormal_Name}"/>
</Grid>
<Expander Header="{DynamicResource GameBoost_Lists}" Margin="0,12,0,0">
<StackPanel Margin="0,8,0,0">
<TextBlock Text="{DynamicResource GameBoost_ManualGames}" FontSize="12" Foreground="{DynamicResource TextSecondaryBrush}" TextWrapping="Wrap"/>
<TextBox Text="{Binding GameBoostManualGamesText, UpdateSourceTrigger=PropertyChanged}"
AcceptsReturn="True" TextWrapping="NoWrap" Height="72" VerticalScrollBarVisibility="Auto" Margin="0,4,0,8"
AutomationProperties.Name="{DynamicResource GameBoost_ManualGames}"/>
<TextBlock Text="{DynamicResource GameBoost_ExcludedGames}" FontSize="12" Foreground="{DynamicResource TextSecondaryBrush}" TextWrapping="Wrap"/>
<TextBox Text="{Binding GameBoostExcludedGamesText, UpdateSourceTrigger=PropertyChanged}"
AcceptsReturn="True" TextWrapping="NoWrap" Height="72" VerticalScrollBarVisibility="Auto" Margin="0,4,0,8"
AutomationProperties.Name="{DynamicResource GameBoost_ExcludedGames}"/>
<TextBlock Text="{DynamicResource GameBoost_Background}" FontSize="12" Foreground="{DynamicResource TextSecondaryBrush}" TextWrapping="Wrap"/>
<TextBox Text="{Binding GameBoostBackgroundText, UpdateSourceTrigger=PropertyChanged}"
AcceptsReturn="True" TextWrapping="NoWrap" Height="96" VerticalScrollBarVisibility="Auto" Margin="0,4,0,8"
AutomationProperties.Name="{DynamicResource GameBoost_Background}"/>
<Button Content="{DynamicResource GameBoost_SaveLists}"
Command="{Binding SaveGameBoostListsCommand}"
HorizontalAlignment="Left"
Padding="10,4"/>
</StackPanel>
</Expander>
</StackPanel>
</StackPanel>
</Border>
<ItemsControl ItemsSource="{Binding TweakItems}" HorizontalAlignment="Stretch">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Background="{DynamicResource CardSurfaceBrush}"
BorderBrush="{DynamicResource BorderSubtleBrush}"
BorderThickness="1"
CornerRadius="6"
Padding="16,12"
Margin="0,0,0,4">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Ellipse Grid.Column="0" Width="8" Height="8" VerticalAlignment="Center" Margin="0,0,14,0"
ToolTip="{Binding StatusText}">
<Ellipse.Style>
<Style TargetType="Ellipse">
<Setter Property="Fill" Value="{DynamicResource SuccessTextBrush}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsAvailable}" Value="False">
<Setter Property="Fill" Value="{DynamicResource ErrorTextBrush}"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsEnabled}" Value="False">
<Setter Property="Fill" Value="{DynamicResource TextSecondaryBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Ellipse.Style>
</Ellipse>
<StackPanel Grid.Column="1" VerticalAlignment="Center">
<TextBlock Text="{Binding Name}" TextWrapping="Wrap" Foreground="{DynamicResource TextPrimaryBrush}"/>
<TextBlock Text="{Binding Description}"
FontSize="12"
Foreground="{DynamicResource TextSecondaryBrush}"
TextWrapping="Wrap"
Margin="0,2,0,0"/>
<TextBlock Text="{Binding ErrorMessage}"
FontSize="12"
Foreground="{DynamicResource ErrorTextBrush}"
TextWrapping="Wrap"
Visibility="{Binding ErrorMessage, Converter={StaticResource StringToVisibilityConverter}}"/>
</StackPanel>
<ToggleButton Grid.Column="2"
IsChecked="{Binding IsEnabled, Mode=OneWay}"
IsEnabled="{Binding IsAvailable}"
Command="{Binding ToggleCommand}"
CommandParameter="{Binding}"
VerticalAlignment="Center"
HorizontalAlignment="Right"
Margin="10,0,0,0"
AutomationProperties.Name="{Binding Name}"
ToolTip="{DynamicResource SystemTweaksView_TweakTooltip}">
<ToggleButton.Style>
<Style TargetType="ToggleButton" BasedOn="{StaticResource Win11ToggleSwitchStyle}">
<Setter Property="Visibility" Value="Visible"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsGuidedAction}" Value="True">
<Setter Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</Style.Triggers>
</Style>
</ToggleButton.Style>
</ToggleButton>
<Button Grid.Column="2"
Content="{DynamicResource SystemTweaks_OpenSettings}"
Command="{Binding ActionCommand}"
CommandParameter="{Binding}"
IsEnabled="{Binding IsAvailable}"
Padding="10,4"
AutomationProperties.Name="{Binding Name}">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsGuidedAction}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
</Grid>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</ScrollViewer>
</Grid>
</UserControl>