Files
ThreadPilot/Views/ProcessPowerPlanAssociationView.xaml
T
PrimeBuild-pc 9875f7cc4f refactor: delete ReviewRequired, keep the check, point it at saved rules
ReviewRequired was not merely unread - it had the wrong shape. It is a bit
persisted at save time recording a judgement that can only be made at load
time, against whatever CPU is present then. Three writers, no readers: the
mask path, MigrateProcessProfile (whose Save/Load Profile commands are bound
in no XAML), and CpuPresetGenerator (registered in DI with no consumers).

The field goes. The question it was asking does not, so ShouldRequireReview
stays and finally gets a caller - saved rules, which nothing compared against
the running machine. A rule pinning cores that no longer exist did not
announce itself; it failed at apply time through a path that reports it as the
process having exited. The Saved process rules tab now names those rules, and
their cores can be set again from a mask without leaving the page.

ShouldRequireReview no longer compares topology signatures by record equality.
That included fields which can differ between two readings of the same
machine, and a warning that fires on everything teaches people to ignore it.
It now compares what actually changes the meaning of "core 9": the chip and
the shape of it.

Old files keep the serialized flag; it is ignored on read and dropped on the
next save.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-27 00:43:52 +02:00

552 lines
36 KiB
XML

<UserControl x:Class="ThreadPilot.Views.ProcessPowerPlanAssociationView"
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:converters="clr-namespace:ThreadPilot.Converters"
xmlns:local="clr-namespace:ThreadPilot.Views"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="1200">
<UserControl.Resources>
<converters:BoolToColorConverter x:Key="BoolToColorConverter"/>
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
<converters:InverseBooleanConverter x:Key="InverseBoolConverter"/>
</UserControl.Resources>
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Standardized Header -->
<StackPanel Grid.Row="0" Margin="0,0,0,16">
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_Title}" Style="{StaticResource PageTitleTextStyle}" Margin="0,0,0,4"/>
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_RulesDescription}"
Style="{StaticResource PageSubtitleTextStyle}"/>
</StackPanel>
<!-- Main Content -->
<TabControl Grid.Row="1" Background="{DynamicResource SurfaceBrush}" BorderThickness="0">
<TabControl.Resources>
<Style TargetType="TabItem">
<Setter Property="Padding" Value="14,7"/>
<Setter Property="Margin" Value="0,0,8,0"/>
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TabItem">
<Border x:Name="TabBorder"
Background="{DynamicResource ControlFillColorSecondaryBrush}"
BorderBrush="{DynamicResource ControlStrokeColorDefaultBrush}"
BorderThickness="1"
CornerRadius="8"
Padding="{TemplateBinding Padding}"
Margin="{TemplateBinding Margin}">
<ContentPresenter ContentSource="Header"
HorizontalAlignment="Center"
VerticalAlignment="Center"
TextElement.Foreground="{TemplateBinding Foreground}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="TabBorder" Property="Background" Value="{DynamicResource SoftSelectionBackgroundBrush}"/>
<Setter TargetName="TabBorder" Property="BorderBrush" Value="{DynamicResource SoftSelectionBorderBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</TabControl.Resources>
<!-- Rules Tab -->
<TabItem Header="{DynamicResource ProcessPowerPlanAssociationView_RulesHeader}">
<Grid Margin="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- Rules List -->
<GroupBox Grid.Column="0" Header="{DynamicResource ProcessPowerPlanAssociationView_CurrentRules}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<DataGrid Grid.Row="0"
ItemsSource="{Binding Associations}"
SelectedItem="{Binding SelectedAssociation}"
AutoGenerateColumns="False"
CanUserAddRows="False"
GridLinesVisibility="Horizontal"
HeadersVisibility="Column"
BorderThickness="1">
<DataGrid.Columns>
<DataGridCheckBoxColumn Header="{DynamicResource MasksView_Enabled}"
Binding="{Binding IsEnabled}"
Width="60"/>
<DataGridTextColumn Header="{DynamicResource ProcessPowerPlanAssociationView_Executable}"
Binding="{Binding ExecutableName}"
Width="150"/>
<DataGridTextColumn Header="{DynamicResource ProcessPowerPlanAssociationView_PowerPlan}"
Binding="{Binding PowerPlanName}"
Width="120"/>
<DataGridTextColumn Header="{DynamicResource ProcessPowerPlanAssociationView_CpuMask}"
Binding="{Binding CoreMaskName}"
Width="100"/>
<DataGridTextColumn Header="{DynamicResource ProcessPowerPlanAssociationView_Priority}"
Binding="{Binding ProcessPriority}"
Width="80"/>
<DataGridTextColumn Header="{DynamicResource ProcessPowerPlanAssociationView_RulePriority}"
Binding="{Binding Priority}"
Width="60"/>
<DataGridCheckBoxColumn Header="{DynamicResource ProcessPowerPlanAssociationView_MatchByPath}"
Binding="{Binding MatchByPath}"
Width="100"/>
<DataGridTextColumn Header="{DynamicResource ProcessPowerPlanAssociationView_Description}"
Binding="{Binding Description}"
Width="*"/>
</DataGrid.Columns>
</DataGrid>
<Border Grid.Row="0"
Padding="18"
IsHitTestVisible="False"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<Border.Style>
<Style TargetType="Border">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Associations.Count}" Value="0">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<StackPanel>
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_NoRules}"
FontWeight="SemiBold"
HorizontalAlignment="Center"
Margin="0,0,0,4"/>
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_EditorSubtitle}"
Foreground="{DynamicResource TextSecondaryBrush}"
TextWrapping="Wrap"
TextAlignment="Center"
MaxWidth="360"/>
</StackPanel>
</Border>
<StackPanel Grid.Row="1" Orientation="Horizontal"
HorizontalAlignment="Right" Margin="0,10,0,0">
<Button Content="{DynamicResource ProcessPowerPlanAssociationView_Update}"
Command="{Binding UpdateAssociationCommand}"
Margin="0,0,5,0" Padding="10,5"
ToolTip="{DynamicResource ProcessPowerPlanAssociationView_UpdateRuleTooltip}"/>
<Button Content="{DynamicResource ProcessPowerPlanAssociationView_Remove}"
Command="{Binding RemoveAssociationCommand}"
Padding="10,5"
ToolTip="{DynamicResource ProcessPowerPlanAssociationView_RemoveTooltip}"/>
</StackPanel>
</Grid>
</GroupBox>
<!-- Rule Editor -->
<GroupBox Grid.Column="2" Header="{DynamicResource ProcessPowerPlanAssociationView_RuleEditor}">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel>
<!-- Executable Selection Section -->
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_ExecutableMatch}" FontWeight="SemiBold" Margin="0,0,0,5"/>
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_ExecutableHelp}"
Foreground="{DynamicResource TextSecondaryBrush}"
FontSize="10"
TextWrapping="Wrap"
Margin="0,0,0,8"/>
<!-- Browse Button -->
<Button Content="{DynamicResource ProcessPowerPlanAssociationView_Browse}"
Command="{Binding BrowseExecutableCommand}"
Padding="10,8" Margin="0,0,0,10"
HorizontalAlignment="Left"
ToolTip="{DynamicResource ProcessPowerPlanAssociationView_BrowseTooltip}"/>
<!-- Selected Executable Display -->
<Border BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1"
Background="{DynamicResource SurfaceAltBrush}" Padding="8" Margin="0,0,0,10"
Visibility="{Binding HasSelectedExecutable, Converter={StaticResource BoolToVisibilityConverter}}">
<StackPanel>
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_SelectedExecutable}" FontSize="10" Foreground="{DynamicResource TextSecondaryBrush}" Margin="0,0,0,2"/>
<TextBlock Text="{Binding SelectedExecutableDisplayName}"
FontWeight="SemiBold" Margin="0,0,0,2"/>
<TextBlock Text="{Binding SelectedExecutableFullPath}"
FontSize="10" Foreground="{DynamicResource TextSecondaryBrush}" TextWrapping="Wrap"/>
</StackPanel>
</Border>
<!-- Clear Selection Button -->
<Button Content="{DynamicResource ProcessPowerPlanAssociationView_ClearSelection}"
Command="{Binding ClearSelectedExecutableCommand}"
Padding="5,3" Margin="0,0,0,15"
HorizontalAlignment="Left" FontSize="10"
Visibility="{Binding HasSelectedExecutable, Converter={StaticResource BoolToVisibilityConverter}}"
ToolTip="{DynamicResource ProcessPowerPlanAssociationView_ClearSelectionTooltip}"/>
<CheckBox Content="{DynamicResource ProcessPowerPlanAssociationView_MatchByPath}"
IsChecked="{Binding MatchByPath}"
Margin="0,0,0,10"
ToolTip="{DynamicResource ProcessPowerPlanAssociationView_MatchByPathTooltip}"/>
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_RulePowerPlan}" Margin="0,0,0,5" FontWeight="SemiBold"/>
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_RulePowerPlanHelp}"
Foreground="{DynamicResource TextSecondaryBrush}"
FontSize="10"
TextWrapping="Wrap"
Margin="0,0,0,5"/>
<ComboBox ItemsSource="{Binding AvailablePowerPlans}"
SelectedItem="{Binding SelectedPowerPlan}"
DisplayMemberPath="Name"
Padding="5" Margin="0,0,0,10"/>
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_RuleCpuMask}" Margin="0,0,0,5"/>
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_AppliedOnlyToMatching}"
Foreground="{DynamicResource TextSecondaryBrush}"
FontSize="10"
TextWrapping="Wrap"
Margin="0,0,0,5"/>
<ComboBox ItemsSource="{Binding AvailableCoreMasks}"
SelectedItem="{Binding SelectedCoreMask}"
DisplayMemberPath="Name"
Padding="5" Margin="0,0,0,10"
ToolTip="{DynamicResource ProcessPowerPlanAssociationView_RuleCpuMaskHelp}"/>
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_ProcessPriority}" Margin="0,0,0,5"/>
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_AppliedToMatching}"
Foreground="{DynamicResource TextSecondaryBrush}"
FontSize="10"
TextWrapping="Wrap"
Margin="0,0,0,5"/>
<ComboBox ItemsSource="{Binding AvailablePriorities}"
SelectedItem="{Binding SelectedProcessPriority}"
Padding="5" Margin="0,0,0,10"
ToolTip="{DynamicResource ProcessPowerPlanAssociationView_RulePriorityHelp}"/>
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_AssociationPriority}" Margin="0,0,0,5"/>
<TextBox Text="{Binding Priority}"
Padding="5" Margin="0,0,0,10"
ToolTip="{DynamicResource ProcessPowerPlanAssociationView_AssociationPriorityHelp}"/>
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_DescriptionLabel}" Margin="0,0,0,5"/>
<TextBox Text="{Binding Description}"
Padding="5" Margin="0,0,0,15"/>
<Button Content="{DynamicResource ProcessPowerPlanAssociationView_AddRule}"
Command="{Binding AddAssociationCommand}"
Padding="10,8"/>
<Button Content="{DynamicResource ProcessPowerPlanAssociationView_UpdateRule}"
Command="{Binding UpdateAssociationCommand}"
Padding="10,8"
Margin="0,8,0,0"/>
<Separator Margin="0,15,0,15"/>
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_UseRunningProcess}"
FontWeight="SemiBold" Margin="0,0,0,10"/>
<ComboBox ItemsSource="{Binding RunningProcesses}"
SelectedItem="{Binding SelectedProcess}"
DisplayMemberPath="Name"
Padding="5" Margin="0,0,0,10"
ToolTip="{DynamicResource ProcessPowerPlanAssociationView_UseRunningProcessTooltip}"/>
<Button Content="{DynamicResource ProcessPowerPlanAssociationView_UseSelectedProcess}"
Command="{Binding UseSelectedProcessForAssociationCommand}"
Padding="10,5"
ToolTip="{DynamicResource ProcessPowerPlanAssociationView_UseSelectedProcessTooltip}"/>
</StackPanel>
</ScrollViewer>
</GroupBox>
</Grid>
</TabItem>
<!-- Saved Process Rules Tab -->
<TabItem Header="{DynamicResource ProcessPowerPlanAssociationView_SavedRulesHeader}">
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0"
Text="{DynamicResource ProcessPowerPlanAssociationView_SavedRulesDescription}"
Foreground="{DynamicResource TextSecondaryBrush}"
TextWrapping="Wrap"
Margin="0,0,0,10"/>
<Border Grid.Row="1"
Background="{DynamicResource CardSurfaceBrush}"
BorderBrush="{DynamicResource BorderSubtleBrush}"
BorderThickness="1"
Padding="12,8"
Margin="0,0,0,10">
<Border.Style>
<Style TargetType="Border">
<Setter Property="Visibility" Value="Visible"/>
<Style.Triggers>
<DataTrigger Binding="{Binding SavedRulesReviewMessage}" Value="">
<Setter Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<TextBlock Text="{Binding SavedRulesReviewMessage}" TextWrapping="Wrap" FontSize="12"/>
</Border>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<DataGrid Grid.Column="0"
ItemsSource="{Binding SavedProcessRules}"
SelectedItem="{Binding SelectedSavedProcessRule, Mode=TwoWay}"
AutoGenerateColumns="False"
CanUserAddRows="False"
IsReadOnly="True"
GridLinesVisibility="Horizontal"
HeadersVisibility="Column"
BorderThickness="1">
<DataGrid.Columns>
<DataGridCheckBoxColumn Header="{DynamicResource MasksView_Enabled}"
Binding="{Binding IsEnabled}"
Width="60"/>
<DataGridTextColumn Header="{DynamicResource ProcessPowerPlanAssociationView_SavedRuleProcess}"
Binding="{Binding ProcessName}"
Width="150"/>
<DataGridTextColumn Header="{DynamicResource ProcessPowerPlanAssociationView_SavedRuleApplies}"
Binding="{Binding Applies}"
Width="*"/>
<DataGridTextColumn Header="{DynamicResource ProcessPowerPlanAssociationView_SavedRuleMode}"
Binding="{Binding Mode}"
Width="110"/>
<DataGridTextColumn Header="{DynamicResource ProcessPowerPlanAssociationView_SavedRuleUpdated}"
Binding="{Binding UpdatedAt}"
Width="140"/>
<DataGridTemplateColumn Width="90">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="{DynamicResource ProcessPowerPlanAssociationView_SavedRuleDelete}"
Padding="8,2"
Margin="2"
Command="{Binding DataContext.DeleteSavedProcessRuleCommand, RelativeSource={RelativeSource AncestorType=DataGrid}}"
CommandParameter="{Binding}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<GroupBox Grid.Column="2"
Width="330"
Header="{DynamicResource ProcessPowerPlanAssociationView_SavedRuleEditor}"
VerticalAlignment="Top">
<StackPanel IsEnabled="{Binding SelectedSavedProcessRule, Converter={StaticResource NullToBoolConverter}}">
<TextBlock Text="{Binding SelectedSavedProcessRule.ProcessName}"
FontWeight="SemiBold"
Margin="0,0,0,8"/>
<CheckBox Content="{DynamicResource MasksView_Enabled}"
IsChecked="{Binding SavedRuleIsEnabled, Mode=TwoWay}"
Margin="0,0,0,10"/>
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_SavedRuleCpuPriority}" Margin="0,0,0,3"/>
<ComboBox ItemsSource="{Binding SavedRulePriorityOptions}"
SelectedItem="{Binding SavedRulePriority, Mode=TwoWay}"
Margin="0,0,0,10"/>
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_SavedRuleMemoryPriority}" Margin="0,0,0,3"/>
<ComboBox ItemsSource="{Binding SavedRuleMemoryPriorityOptions}"
SelectedItem="{Binding SavedRuleMemoryPriority, Mode=TwoWay}"
Margin="0,0,0,10"/>
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_SavedRuleIoPriority}" Margin="0,0,0,3"/>
<ComboBox ItemsSource="{Binding SavedRuleIoPriorityOptions}"
SelectedItem="{Binding SavedRuleIoPriority, Mode=TwoWay}"
Margin="0,0,0,10"/>
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_SavedRuleModeLabel}" Margin="0,0,0,3"/>
<ComboBox ItemsSource="{Binding SavedRuleCpuAssignmentModeOptions}"
SelectedItem="{Binding SavedRuleCpuAssignmentMode, Mode=TwoWay}"
Margin="0,0,0,10"/>
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_SavedRuleCores}" Margin="0,0,0,3"/>
<TextBlock Text="{Binding SelectedSavedProcessRule.Cores}"
FontWeight="SemiBold"
TextWrapping="Wrap"
Margin="0,0,0,6"/>
<ComboBox ItemsSource="{Binding AvailableCoreMasks}"
SelectedItem="{Binding SavedRuleCoreMask, Mode=TwoWay}"
DisplayMemberPath="Name"
Margin="0,0,0,6"/>
<Button Content="{DynamicResource ProcessPowerPlanAssociationView_SavedRuleApplyMask}"
Command="{Binding ApplySavedRuleCoreMaskCommand}"
Padding="10,4"
HorizontalAlignment="Left"
Margin="0,0,0,12"/>
<CheckBox Content="{DynamicResource ProcessPowerPlanAssociationView_SavedRulePreventSleep}"
IsChecked="{Binding SavedRulePreventSleep, Mode=TwoWay}"
Margin="0,0,0,10"/>
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_SavedRuleEditorHint}"
Foreground="{DynamicResource TextSecondaryBrush}"
TextWrapping="Wrap"
Margin="0,0,0,10"/>
<Button Content="{DynamicResource ProcessPowerPlanAssociationView_SavedRuleSave}"
Command="{Binding SaveSavedProcessRuleCommand}"
Padding="10,4"
HorizontalAlignment="Left"/>
</StackPanel>
</GroupBox>
<Border Grid.Column="0"
Padding="18"
IsHitTestVisible="False"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<Border.Style>
<Style TargetType="Border">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding SavedProcessRules.Count}" Value="0">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_NoSavedRules}"
Foreground="{DynamicResource TextSecondaryBrush}"
TextWrapping="Wrap"
TextAlignment="Center"/>
</Border>
</Grid>
</Grid>
</TabItem>
<!-- Automation Monitoring Tab -->
<TabItem Header="{DynamicResource ProcessPowerPlanAssociationView_AutomationMonitoring}">
<ScrollViewer Margin="10">
<StackPanel>
<!-- Service Control -->
<GroupBox Header="{DynamicResource ProcessPowerPlanAssociationView_AutomationService}" Margin="0,0,0,15">
<StackPanel>
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_Subtitle}"
Foreground="{DynamicResource TextSecondaryBrush}"
TextWrapping="Wrap"
Margin="0,0,0,10"/>
<StackPanel Orientation="Horizontal" Margin="0,0,0,10">
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_Status}" VerticalAlignment="Center"/>
<TextBlock Text="{Binding ServiceStatus}"
Foreground="{Binding IsServiceRunning, Converter={StaticResource BoolToColorConverter}}"
FontWeight="SemiBold" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Button Content="{DynamicResource ProcessPowerPlanAssociationView_StartAutomation}"
Command="{Binding StartMonitoringCommand}"
IsEnabled="{Binding IsServiceRunning, Converter={StaticResource InverseBoolConverter}}"
Padding="15,8" Margin="0,0,10,0"/>
<Button Content="{DynamicResource ProcessPowerPlanAssociationView_StopAutomation}"
Command="{Binding StopMonitoringCommand}"
IsEnabled="{Binding IsServiceRunning}"
Padding="15,8"/>
</StackPanel>
</StackPanel>
</GroupBox>
<!-- Default Power Plan -->
<GroupBox Header="{DynamicResource ProcessPowerPlanAssociationView_DefaultPowerPlan}" Margin="0,0,0,15">
<StackPanel>
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_DefaultPowerPlanHelp}"
Foreground="{DynamicResource TextSecondaryBrush}" Margin="0,0,0,10"/>
<ComboBox ItemsSource="{Binding AvailablePowerPlans}"
SelectedItem="{Binding DefaultPowerPlan}"
DisplayMemberPath="Name"
Padding="5" Margin="0,0,0,10"/>
<Button Content="{DynamicResource ProcessPowerPlanAssociationView_SetDefault}"
Command="{Binding SetDefaultPowerPlanCommand}"
Padding="10,5" HorizontalAlignment="Left"/>
</StackPanel>
</GroupBox>
<!-- Automation Monitoring Settings -->
<GroupBox Header="{DynamicResource ProcessPowerPlanAssociationView_SettingsTitle}" Margin="0,0,0,15">
<StackPanel>
<CheckBox Content="{DynamicResource ProcessPowerPlanAssociationView_PreventDuplicates}"
IsChecked="{Binding PreventDuplicatePowerPlanChanges}"
Margin="0,0,0,10"/>
<StackPanel Orientation="Horizontal" Margin="0,0,0,15">
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_ChangeDelay}"
VerticalAlignment="Center" Margin="0,0,10,0"/>
<TextBox Text="{Binding PowerPlanChangeDelayMs}"
Width="80" Padding="5"/>
</StackPanel>
<Button Content="{DynamicResource ProcessPowerPlanAssociationView_SaveConfig}"
Command="{Binding SaveConfigurationCommand}"
Padding="15,8" HorizontalAlignment="Left"/>
</StackPanel>
</GroupBox>
</StackPanel>
</ScrollViewer>
</TabItem>
</TabControl>
<Border Grid.Row="1"
VerticalAlignment="Bottom"
Margin="10"
Padding="10,7"
CornerRadius="{StaticResource 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>
</Grid>
</UserControl>