415 lines
24 KiB
XML
415 lines
24 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="{DynamicResource SectionTitleFontSize}"/>
|
|
<Setter Property="FontWeight" Value="SemiBold"/>
|
|
<Setter Property="Margin" Value="0,0,0,8"/>
|
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}"/>
|
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
|
</Style>
|
|
|
|
<Style x:Key="DescriptionStyle" TargetType="TextBlock">
|
|
<Setter Property="FontSize" Value="{DynamicResource CaptionFontSize}"/>
|
|
<Setter Property="Foreground" Value="{DynamicResource TextSecondaryBrush}"/>
|
|
<Setter Property="Margin" Value="0,2,0,0"/>
|
|
<Setter Property="TextWrapping" Value="Wrap"/>
|
|
</Style>
|
|
|
|
<Style x:Key="SettingsCardStyle" TargetType="Border" BasedOn="{StaticResource StandardCardStyle}">
|
|
<Setter Property="Background" Value="{DynamicResource CardSurfaceBrush}"/>
|
|
<Setter Property="BorderBrush" Value="{DynamicResource BorderSubtleBrush}"/>
|
|
<Setter Property="Padding" Value="{DynamicResource StandardCardPadding}"/>
|
|
</Style>
|
|
</UserControl.Resources>
|
|
|
|
<Grid Margin="12">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="*"/>
|
|
<RowDefinition Height="Auto"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<StackPanel Grid.Row="0" Margin="0,0,0,16">
|
|
<TextBlock Text="Application Settings" Style="{StaticResource PageTitleTextStyle}" Margin="0,0,0,4"/>
|
|
<TextBlock Text="Configure notifications, system tray, and application behavior"
|
|
Style="{StaticResource PageSubtitleTextStyle}"/>
|
|
</StackPanel>
|
|
|
|
<!-- Settings Content -->
|
|
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
|
|
<WrapPanel HorizontalAlignment="Left">
|
|
|
|
<!-- Notifications Section -->
|
|
<StackPanel Width="372" Margin="0,0,16,16">
|
|
<TextBlock Text="Notifications" Style="{StaticResource SectionHeaderStyle}" Margin="0,0,0,8"/>
|
|
<Border Style="{StaticResource SettingsCardStyle}">
|
|
<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">
|
|
<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="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="40"/>
|
|
</Grid>
|
|
|
|
<Button Content="Test Notification"
|
|
Command="{Binding TestNotificationCommand}"
|
|
HorizontalAlignment="Left"
|
|
Margin="0,10,0,0"
|
|
Padding="15,5"/>
|
|
</StackPanel>
|
|
</Border>
|
|
</StackPanel>
|
|
|
|
<!-- System Tray Section -->
|
|
<StackPanel Width="372" Margin="0,0,16,16">
|
|
<TextBlock Text="System Tray" Style="{StaticResource SectionHeaderStyle}" Margin="0,0,0,8"/>
|
|
<Border Style="{StaticResource SettingsCardStyle}">
|
|
<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 pending settings apply from tray"
|
|
IsChecked="{Binding Settings.EnableQuickApplyFromTray}"
|
|
IsEnabled="{Binding Settings.ShowTrayIcon}"
|
|
Margin="0,5"/>
|
|
|
|
<CheckBox Content="Enable automation 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>
|
|
</StackPanel>
|
|
|
|
<!-- Basic Preferences Section -->
|
|
<StackPanel Width="372" Margin="0,0,16,16">
|
|
<TextBlock Text="Basic Preferences" Style="{StaticResource SectionHeaderStyle}" Margin="0,0,0,8"/>
|
|
<Border Style="{StaticResource SettingsCardStyle}">
|
|
<StackPanel>
|
|
<TextBlock Text="Autostart" FontWeight="SemiBold" Margin="0,0,0,5"/>
|
|
<CheckBox Content="Start with Windows"
|
|
IsChecked="{Binding Settings.AutostartWithWindows}"
|
|
Margin="0,0,0,5"/>
|
|
<TextBlock Text="Automatically start ThreadPilot when Windows starts"
|
|
Style="{StaticResource DescriptionStyle}"
|
|
Margin="20,0,0,15"/>
|
|
|
|
<CheckBox Content="Low impact mode in background"
|
|
IsChecked="{Binding Settings.EnableSelfLowImpactMode}"
|
|
Margin="0,0,0,5"/>
|
|
<TextBlock Text="Lower ThreadPilot's process priority while minimized or hidden to tray."
|
|
Style="{StaticResource DescriptionStyle}"
|
|
Margin="20,0,0,15"/>
|
|
|
|
<Separator Margin="0,0,0,15"/>
|
|
|
|
<TextBlock Text="Appearance" FontWeight="SemiBold" Margin="0,0,0,5"/>
|
|
<CheckBox Content="Use dark theme"
|
|
IsChecked="{Binding Settings.UseDarkTheme}"
|
|
Margin="0,0,0,5"/>
|
|
<TextBlock Text="Applies a global Dark/Light theme across all tabs"
|
|
Style="{StaticResource DescriptionStyle}"
|
|
Margin="20,0,0,5"/>
|
|
</StackPanel>
|
|
</Border>
|
|
</StackPanel>
|
|
|
|
<!-- Process Event Settings Section -->
|
|
<StackPanel Width="372" Margin="0,0,16,16">
|
|
<TextBlock Text="Process Event Settings" Style="{StaticResource SectionHeaderStyle}" Margin="0,0,0,8"/>
|
|
<Border Style="{StaticResource SettingsCardStyle}">
|
|
<StackPanel>
|
|
<CheckBox Content="Enable WMI process events"
|
|
IsChecked="{Binding Settings.EnableWmiMonitoring}"
|
|
Margin="0,0,0,5"/>
|
|
<TextBlock Text="Use Windows Management Instrumentation for process start/stop events"
|
|
Style="{StaticResource DescriptionStyle}"
|
|
Margin="20,0,0,15"/>
|
|
|
|
<CheckBox Content="Enable fallback polling"
|
|
IsChecked="{Binding Settings.EnableFallbackPolling}"
|
|
Margin="0,0,0,5"/>
|
|
<TextBlock Text="Use polling as backup when WMI process events fail"
|
|
Style="{StaticResource DescriptionStyle}"
|
|
Margin="20,0,0,15"/>
|
|
|
|
<Separator Margin="0,0,0,15"/>
|
|
|
|
<Grid Margin="0,0,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="40"/>
|
|
</Grid>
|
|
|
|
<Grid Margin="0,5,0,0">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<TextBlock Text="Fallback polling (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="40"/>
|
|
</Grid>
|
|
</StackPanel>
|
|
</Border>
|
|
</StackPanel>
|
|
|
|
<!-- Advanced Section -->
|
|
<StackPanel Width="372" Margin="0,0,16,16">
|
|
<TextBlock Text="Advanced" Style="{StaticResource SectionHeaderStyle}" Margin="0,0,0,8"/>
|
|
<Border Style="{StaticResource SettingsCardStyle}">
|
|
<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="40"/>
|
|
</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>
|
|
</StackPanel>
|
|
|
|
<!-- About Section -->
|
|
<StackPanel Width="372" Margin="0,0,16,16">
|
|
<TextBlock Text="About" Style="{StaticResource SectionHeaderStyle}" Margin="0,0,0,8"/>
|
|
<Border Style="{StaticResource SettingsCardStyle}">
|
|
<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 © 2026 PrimeBuild" Margin="0,0,0,4"/>
|
|
<TextBlock Text="License: AGPLv3" 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>
|
|
|
|
</WrapPanel>
|
|
</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="{DynamicResource StandardCardCornerRadius}"
|
|
BorderThickness="1"
|
|
Opacity="{Binding StatusOpacity}"
|
|
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 Configuration"
|
|
Command="{Binding ExportSettingsCommand}"
|
|
Margin="0,0,10,0"
|
|
Padding="15,8"/>
|
|
|
|
<Button Content="Import Configuration"
|
|
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>
|