Files
ThreadPilot/Views/SettingsView.xaml
T
PrimeBuild-pc 010dee679f Add docs, themes, services and UI updates
Large changeset adding documentation, themes, converters and wiring between UI and services. Key changes:

- Rewrote .gitignore to standardize build, IDE, OS and project-specific ignores.
- Added comprehensive documentation: ADVANCED_CPU_FEATURES.md, API_REFERENCE.md, ARCHITECTURE_GUIDE.md, DEVELOPER_GUIDE.md, GAME_BOOST_VALIDATION.md, CLAUDE.md, PROJECT_STRUCTURE.md, UI_STYLE_GUIDE.md, TRADEMARK.md.
- Added theme resources (Themes/FluentLight.xaml, Themes/FluentDark.xaml) and merged FluentLight into App.xaml resource dictionary.
- Added NullToBoolConverter and registered it in App.xaml.
- Enabled a DEBUG-only console test mode in App.xaml.cs (--test flag) and guarded AllocConsole with #if DEBUG.
- Added new service/support files (AtomicFileWriter, StoragePaths, ThemeService) and numerous updates across Services (CpuTopologyService, CoreMaskService, PowerPlanService, ProcessMonitorManagerService, ProcessService, NotificationService, SystemTrayService, SystemTweaksService, EnhancedLoggingService, etc.).
- Updated many ViewModels and Views to support new functionality (CPU topology, power plan and game-boost features) and tests (Tests/TestRunner.cs).
- Added build-release.ps1 and various project metadata updates.

Overall this commit introduces documentation, theming, new converters and test/debug support, plus extensive service and UI wiring for CPU topology, process monitoring, power plans and game boost features.
2026-04-10 03:58:51 +02:00

392 lines
21 KiB
XML

<UserControl x:Class="ThreadPilot.Views.SettingsView"
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:local="clr-namespace:ThreadPilot.Views"
xmlns:models="clr-namespace:ThreadPilot.Models"
xmlns:converters="clr-namespace:ThreadPilot.Converters"
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="800">
<UserControl.Resources>
<Style x:Key="SectionHeaderStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="16"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Margin" Value="0,15,0,8"/>
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style x:Key="DescriptionStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="11"/>
<Setter Property="Foreground" Value="{DynamicResource TextSecondaryBrush}"/>
<Setter Property="Margin" Value="0,2,0,0"/>
<Setter Property="TextWrapping" Value="Wrap"/>
</Style>
</UserControl.Resources>
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Standardized Header -->
<GroupBox Grid.Row="0" Header="⚙️ Application Settings" Margin="0,0,0,10">
<Grid Margin="5">
<TextBlock Text="Configure notifications, system tray, and application behavior"
FontSize="12" Foreground="{DynamicResource TextSecondaryBrush}" VerticalAlignment="Center"/>
</Grid>
</GroupBox>
<!-- Settings Content -->
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
<StackPanel>
<!-- Notifications Section -->
<TextBlock Text="Notifications" Style="{StaticResource SectionHeaderStyle}"/>
<Border Background="{DynamicResource SurfaceAltBrush}" CornerRadius="5" Padding="15" Margin="0,5,0,15">
<StackPanel>
<CheckBox Content="Enable notifications"
IsChecked="{Binding Settings.EnableNotifications}"
Margin="0,0,0,10"/>
<StackPanel Margin="20,0,0,10"
IsEnabled="{Binding Settings.EnableNotifications}">
<TextBlock Text="Notification Level" FontWeight="SemiBold" Margin="0,0,0,4"/>
<ComboBox SelectedValue="{Binding Settings.NotificationLevel}"
SelectedValuePath="Tag"
Width="240">
<ComboBoxItem Content="All" Tag="{x:Static models:NotificationLevelProfile.All}"/>
<ComboBoxItem Content="Warnings/Errors only" Tag="{x:Static models:NotificationLevelProfile.WarningsAndErrorsOnly}"/>
<ComboBoxItem Content="Silent" Tag="{x:Static models:NotificationLevelProfile.Silent}"/>
</ComboBox>
</StackPanel>
<CheckBox Content="Enable balloon notifications (system tray)"
IsChecked="{Binding Settings.EnableBalloonNotifications}"
IsEnabled="{Binding Settings.EnableNotifications}"
Margin="20,0,0,5"/>
<CheckBox Content="Enable toast notifications (Windows 10+)"
IsChecked="{Binding Settings.EnableToastNotifications}"
IsEnabled="{Binding Settings.EnableNotifications}"
Margin="20,0,0,10"/>
<Separator Margin="0,10"/>
<TextBlock Text="Notification Types" FontWeight="SemiBold" Margin="0,5"/>
<CheckBox Content="Power plan changes"
IsChecked="{Binding Settings.EnablePowerPlanChangeNotifications}"
IsEnabled="{Binding Settings.EnableNotifications}"
Margin="20,5,0,5"/>
<CheckBox Content="Process monitoring events"
IsChecked="{Binding Settings.EnableProcessMonitoringNotifications}"
IsEnabled="{Binding Settings.EnableNotifications}"
Margin="20,0,0,5"/>
<CheckBox Content="Error notifications"
IsChecked="{Binding Settings.EnableErrorNotifications}"
IsEnabled="{Binding Settings.EnableNotifications}"
Margin="20,0,0,5"/>
<CheckBox Content="Success notifications"
IsChecked="{Binding Settings.EnableSuccessNotifications}"
IsEnabled="{Binding Settings.EnableNotifications}"
Margin="20,0,0,10"/>
<Separator Margin="0,10"/>
<Grid Margin="0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Notification duration (ms):" VerticalAlignment="Center"/>
<Slider Grid.Column="1"
Value="{Binding Settings.NotificationDisplayDurationMs}"
Minimum="1000" Maximum="30000"
TickFrequency="1000"
IsSnapToTickEnabled="True"
Margin="10,0"/>
<TextBlock Grid.Column="2"
Text="{Binding Settings.NotificationDisplayDurationMs}"
VerticalAlignment="Center" MinWidth="50"/>
</Grid>
<Button Content="Test Notification"
Command="{Binding TestNotificationCommand}"
HorizontalAlignment="Left"
Margin="0,10,0,0"
Padding="15,5"/>
</StackPanel>
</Border>
<!-- System Tray Section -->
<TextBlock Text="System Tray" Style="{StaticResource SectionHeaderStyle}"/>
<Border Background="{DynamicResource SurfaceAltBrush}" CornerRadius="5" Padding="15" Margin="0,5,0,15">
<StackPanel>
<CheckBox Content="Show tray icon"
IsChecked="{Binding Settings.ShowTrayIcon}"
Margin="0,0,0,10"/>
<CheckBox Content="Minimize to tray"
IsChecked="{Binding Settings.MinimizeToTray}"
IsEnabled="{Binding Settings.ShowTrayIcon}"
Margin="20,0,0,5"/>
<CheckBox Content="Close to tray (instead of exit)"
IsChecked="{Binding Settings.CloseToTray}"
IsEnabled="{Binding Settings.ShowTrayIcon}"
Margin="20,0,0,5"/>
<CheckBox Content="Start minimized"
IsChecked="{Binding Settings.StartMinimized}"
Margin="20,0,0,10"/>
<Separator Margin="0,10"/>
<CheckBox Content="Enable quick apply from tray"
IsChecked="{Binding Settings.EnableQuickApplyFromTray}"
IsEnabled="{Binding Settings.ShowTrayIcon}"
Margin="0,5"/>
<CheckBox Content="Enable monitoring controls from tray"
IsChecked="{Binding Settings.EnableMonitoringControlFromTray}"
IsEnabled="{Binding Settings.ShowTrayIcon}"
Margin="0,0,0,5"/>
<CheckBox Content="Show detailed tooltips"
IsChecked="{Binding Settings.ShowDetailedTooltips}"
IsEnabled="{Binding Settings.ShowTrayIcon}"
Margin="0,0,0,10"/>
</StackPanel>
</Border>
<!-- Autostart Section -->
<TextBlock Text="Autostart" Style="{StaticResource SectionHeaderStyle}"/>
<Border Background="{DynamicResource SurfaceAltBrush}" CornerRadius="5" Padding="15" Margin="0,5,0,15">
<StackPanel>
<CheckBox Content="Start with Windows"
IsChecked="{Binding Settings.AutostartWithWindows}"
Margin="0,0,0,10"/>
<TextBlock Text="Automatically start ThreadPilot when Windows starts"
Style="{StaticResource DescriptionStyle}"
Margin="20,0,0,10"/>
</StackPanel>
</Border>
<!-- Appearance Section -->
<TextBlock Text="Appearance" Style="{StaticResource SectionHeaderStyle}"/>
<Border Background="{DynamicResource SurfaceAltBrush}" CornerRadius="5" Padding="15" Margin="0,5,0,15">
<StackPanel>
<CheckBox Content="Use dark theme"
IsChecked="{Binding Settings.UseDarkTheme}"
Margin="0,0,0,10"/>
<TextBlock Text="Applies a global Dark/Light theme across all tabs"
Style="{StaticResource DescriptionStyle}"
Margin="20,0,0,10"/>
</StackPanel>
</Border>
<!-- Monitoring Settings Section -->
<TextBlock Text="Monitoring Settings" Style="{StaticResource SectionHeaderStyle}"/>
<Border Background="{DynamicResource SurfaceAltBrush}" CornerRadius="5" Padding="15" Margin="0,5,0,15">
<StackPanel>
<CheckBox Content="Enable WMI monitoring"
IsChecked="{Binding Settings.EnableWmiMonitoring}"
Margin="0,0,0,10"/>
<TextBlock Text="Use Windows Management Instrumentation for real-time process monitoring"
Style="{StaticResource DescriptionStyle}"
Margin="20,0,0,10"/>
<CheckBox Content="Enable fallback polling"
IsChecked="{Binding Settings.EnableFallbackPolling}"
Margin="0,0,0,10"/>
<TextBlock Text="Use polling as backup when WMI monitoring fails"
Style="{StaticResource DescriptionStyle}"
Margin="20,0,0,10"/>
<Grid Margin="0,5,0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Polling interval (ms):" VerticalAlignment="Center"/>
<Slider Grid.Column="1"
Value="{Binding Settings.PollingIntervalMs}"
Minimum="1000" Maximum="30000"
TickFrequency="1000"
IsSnapToTickEnabled="True"
Margin="10,0"/>
<TextBlock Grid.Column="2"
Text="{Binding Settings.PollingIntervalMs}"
VerticalAlignment="Center" MinWidth="50"/>
</Grid>
<Grid Margin="0,5,0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Fallback polling interval (ms):" VerticalAlignment="Center"/>
<Slider Grid.Column="1"
Value="{Binding Settings.FallbackPollingIntervalMs}"
Minimum="5000" Maximum="60000"
TickFrequency="5000"
IsSnapToTickEnabled="True"
Margin="10,0"/>
<TextBlock Grid.Column="2"
Text="{Binding Settings.FallbackPollingIntervalMs}"
VerticalAlignment="Center" MinWidth="50"/>
</Grid>
</StackPanel>
</Border>
<!-- Advanced Section -->
<TextBlock Text="Advanced" Style="{StaticResource SectionHeaderStyle}"/>
<Border Background="{DynamicResource SurfaceAltBrush}" CornerRadius="5" Padding="15" Margin="0,5,0,15">
<StackPanel>
<CheckBox Content="Enable notification history"
IsChecked="{Binding Settings.EnableNotificationHistory}"
Margin="0,0,0,10"/>
<Grid Margin="0,5" IsEnabled="{Binding Settings.EnableNotificationHistory}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Max history items:" VerticalAlignment="Center"/>
<Slider Grid.Column="1"
Value="{Binding Settings.MaxNotificationHistoryItems}"
Minimum="10" Maximum="1000"
TickFrequency="10"
IsSnapToTickEnabled="True"
Margin="10,0"/>
<TextBlock Grid.Column="2"
Text="{Binding Settings.MaxNotificationHistoryItems}"
VerticalAlignment="Center" MinWidth="50"/>
</Grid>
<CheckBox Content="Auto-hide notifications"
IsChecked="{Binding Settings.AutoHideNotifications}"
Margin="0,10,0,5"/>
<CheckBox Content="Enable notification sound"
IsChecked="{Binding Settings.EnableNotificationSound}"
Margin="0,0,0,5"/>
<CheckBox Content="Enable debug logging"
IsChecked="{Binding Settings.EnableDebugLogging}"
Margin="0,0,0,5"/>
<CheckBox Content="Enable performance counters"
IsChecked="{Binding Settings.EnablePerformanceCounters}"
Margin="0,0,0,10"/>
</StackPanel>
</Border>
<!-- About Section -->
<TextBlock Text="About" Style="{StaticResource SectionHeaderStyle}"/>
<Border Background="{DynamicResource SurfaceAltBrush}" CornerRadius="5" Padding="15" Margin="0,5,0,15">
<StackPanel>
<TextBlock Text="ThreadPilot" FontWeight="SemiBold" FontSize="14"/>
<TextBlock Text="Version:" FontWeight="SemiBold" Margin="0,8,0,0"/>
<TextBlock Text="{Binding ApplicationVersion}" Margin="0,0,0,10"/>
<TextBlock Text="Copyright © 2025 PrimeBuild" Margin="0,0,0,4"/>
<TextBlock Text="License: GPLv3" Style="{StaticResource DescriptionStyle}"/>
<Separator Margin="0,12,0,12"/>
<Button Content="Check for updates"
Command="{Binding CheckUpdatesCommand}"
Padding="15,6"
HorizontalAlignment="Left"/>
<TextBlock Text="Checks on demand using the official GitHub Releases."
Style="{StaticResource DescriptionStyle}"
Margin="0,6,0,0"/>
</StackPanel>
</Border>
</StackPanel>
</ScrollViewer>
<!-- Footer with buttons and status -->
<Grid Grid.Row="2" Margin="0,20,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Status -->
<Border Grid.Row="0"
Margin="0,0,0,10"
Padding="10,7"
CornerRadius="6"
BorderThickness="1"
Visibility="{Binding StatusMessage, Converter={x:Static converters:StringToVisibilityConverter.Instance}}">
<Border.Style>
<Style TargetType="Border">
<Setter Property="Background" Value="{DynamicResource SuccessBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource SuccessBorderBrush}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding HasError}" Value="True">
<Setter Property="Background" Value="{DynamicResource ErrorBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ErrorBorderBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<TextBlock Text="{Binding StatusMessage}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="{DynamicResource SuccessTextBrush}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding HasError}" Value="True">
<Setter Property="Foreground" Value="{DynamicResource ErrorTextBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Border>
<!-- Buttons -->
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Content="Reset to Defaults"
Command="{Binding ResetToDefaultsCommand}"
Margin="0,0,10,0"
Padding="15,8"/>
<Button Content="Export Settings"
Command="{Binding ExportSettingsCommand}"
Margin="0,0,10,0"
Padding="15,8"/>
<Button Content="Import Settings"
Command="{Binding ImportSettingsCommand}"
Margin="0,0,20,0"
Padding="15,8"/>
<Button Content="Save Settings"
Command="{Binding SaveSettingsCommand}"
IsEnabled="{Binding CanSaveSettings}"
Padding="20,8"/>
</StackPanel>
</Grid>
</Grid>
</UserControl>