Files
ThreadPilot/Views/ProcessPowerPlanAssociationView.xaml
T
Prime Build 9a4baba19a feat: release 1.7.7 stable without experimental Game Boost
* feat: back up persistent rules and resolve rule precedence deterministically

- Configuration export now includes persistent process rules (schema 3.0),
  stays compatible with 2.0 bundles, validates before writing, previews
  what an import replaces and rolls back on failure.
- Matching rules apply broad-to-specific (name, wildcard path, exact path,
  then most recently edited), shared by the engine and the process summary,
  which now lists the apply order and flags conflicting values.
- Localized the new strings in all seven languages.

* feat: clearer process and rule editors

- Process details: CPU, memory and I/O priority pickers with an explicit
  Apply, undo of the last manual priority change (guarded against reused
  PIDs), adaptive side/bottom details panel.
- Manual process control stays available while automation is paused, with
  a persistent notice instead of an overlay.
- Saved-rule editor stages all edits (including the core mask) and saves
  them together, showing pending changes.
- Localized the new strings in all seven languages.

* fix: one save path for a saved rule's cores

The rules editor's core mask went through a new update path that reported
success without saving when no affinity payload was built, and kept a
legacy mask next to a CPU selection. Merge it with the old single-purpose
method (now unused), keep its checks, and localize the undo message.

* feat: per-process efficiency mode (EcoQoS) for live processes and rules

Closes #66.

- Native: SetProcessInformation/GetProcessInformation with
  ProcessPowerThrottling (EXECUTION_SPEED), three states: Windows decides,
  On (EcoQoS), Off (never throttle / HighQoS).
- Process tab: context menu entries, a picker with Apply in the details
  panel, current state in the summary, undo of the last change, included
  when saving current settings as a rule (only if explicitly set).
- Rules: EfficiencyMode + ApplyEfficiencyModeOnStart, applied by the rules
  engine, editable in the saved-rule editor, validated on import and part
  of conflict detection.
- The summary flags when the global Power Throttling tweak voids it. CPU
  priority is left alone, unlike Task Manager's efficiency mode.
- Localized in all seven languages.

* chore: keep CRLF line endings in SelectedProcessSummaryViewModel

* feat: clearer navigation, process page and rules editor

- Navigation pane open with short labels instead of seven bare icons.
- Processes: one toolbar row (search with placeholder, Filters and
  Columns menus, sort, refresh); details split into Process, Priority,
  CPU cores and Rule cards; pickers start from the process's current
  values and stay empty when a value cannot be read; help paragraphs
  moved into tooltips; core picker always visible.
- Rules: process rules first, clearer tab names, localized choices in the
  saved-rule editor instead of internal enum names.
- Shorter page titles and subtitles in all seven languages; removed the
  strings this made unused.

No data format changes.

* feat: settings and tweaks as Windows 11 rows, localized rule list

- Settings: one column of rows (what it is on the left, its switch on the
  right), most used sections first, Save as the primary action.
- Tweaks: one tweak per row with its status dot and switch.
- Rule list: 'Applies' and 'Mode' columns use the same localized labels as
  the editor and refresh on language change.
- Removed 76 strings no code referenced, from all seven languages.

* fix: issues found testing the beta in a clean Windows 11 VM

- Process counter could show more visible processes than the total
  ('157 / 151'): the batch total was a snapshot from the first load.
- Narrow windows (or 150% scaling): toolbar buttons move under the search
  box instead of squeezing it to a few letters.
- Rules list keeps the 'Applies' column readable when narrow.
- Settings status message gets its own line instead of being cut.

Tested in a Hyper-V Windows 11 VM: clean install, upgrade, uninstall,
light and dark theme, 100% and 150% scaling.

* feat: remember layout choices; Windows 11 toggles in Tweaks

- The navigation pane, window size/position/maximized state, and the
  process list filters, sort and columns now survive a restart. They live
  in ui-state.json, apart from settings.json, so they never mark the
  Settings page as unsaved or travel in exported configurations. A corrupt
  file falls back to defaults; tests write to a temp file.
- Fixes the pane re-opening on every start (it was hard-coded open).
- Tweaks use a native-looking Windows 11 switch (40x20 track, sliding
  thumb) with On/Off written beside it.
- New test: every on/off setting survives save and reload.

* docs: handoff for the 1.7.7 PR stack and beta test

* fix: P/E cores from the highest EfficiencyClass, AMD CCDs from real L3 groups

The legacy topology treated the lowest EfficiencyClass as the performance
core, swapping P- and E-cores on hybrid Intel CPUs. AMD CCDs were guessed
as 8 cores each, which split 6+6 parts (7900X3D, 9900X3D) into 8+4; they now
come from the L3 groups Windows reports, with the guess kept only as a
fallback. The topology snapshot also keeps each L3 group's size.

* feat: Game Boost, CPU Sets for the game and selected background apps

While a detected game runs, Game Boost sets process default CPU Sets from
the CPU topology: on AMD X3D with one larger L3 the game goes to the V-Cache
CCD, on Intel hybrid CPUs to the P-cores, and selected background apps
(browsers, sync clients, updaters, launchers) to the other cores. On dual-CCD
parts with equal L3 only the background moves, unless Isolation mode also
keeps the game on CCD0. Single-L3 and unreadable topologies are left to
Windows. Above Normal priority for the game is optional; never High.

Each change is written to a journal before it is made and undone when the
game exits, Game Boost is turned off or ThreadPilot closes, and on the next
start after a crash. Only values still exactly as Game Boost set them are
restored, never one a user rule or a manual change has taken over since.
Persistent rules and Game Boost share one apply gate, and a rule always
wins over Game Boost for the setting it covers.

The switch, mode and lists are on the Tweaks page, off by default, and take
effect without a restart.

* fix: Game Boost background entries with a full path never matched

The background list compared full-path entries against an empty path, so
only bare process names worked. Found by a new integration test that runs
the real services on two copies of PING.EXE: CPU Sets and priority are set
and read back through Windows, removed when Game Boost is turned off, and
undone from the journal after a simulated crash. The topology is simulated
from this machine's CPU Set IDs, so the test also runs on CPUs where Game
Boost would not act; it skips itself below 8 cores.

* feat: report Game Boost sessions and restore results in Activity

* test: diagnose EcoQoS read failures on Windows Server

* chore: prepare 1.7.7-beta.2 and keep prereleases out of stable channels

* test: use native full-query access mask in EcoQoS diagnostic

* docs: update beta handoff and prerelease publication policy

* ci: run native EcoQoS tests on a Windows 11-era kernel

Windows Server 2022 build 20348 rejects GetProcessInformation(ProcessPowerThrottling) with ERROR_INVALID_PARAMETER (87), with both limited and full query handles. Windows 11 local tests pass. Use Server 2025 for CI/release tests and smoke testing; keep the real round-trip assertions, remove temporary probes.

* test: lock beta publication and native runner contracts

* chore: separate stable 1.7.7 from experimental Game Boost

Stable retains the validated EcoQoS/rules/UI stack. Preserve the complete local Game Boost implementation at ef2ec24 for the separate 1.7.8-beta.1 prerelease; no experimental Game Boost/topology changes ship in stable. Keep channel-aware publication and Windows 11-era native CI tests.
2026-10-16 12:03:54 +02:00

565 lines
37 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>
<!-- 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="*"
MinWidth="160"/>
<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="{DynamicResource Rules_PendingChanges}" TextWrapping="Wrap" FontWeight="SemiBold" Margin="0,0,0,10"
Visibility="{Binding HasPendingRuleChanges, Converter={StaticResource BoolToVisibilityConverter}}"/>
<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}"
SelectedValuePath="Value"
DisplayMemberPath="Label"
SelectedValue="{Binding SavedRulePriority, Mode=TwoWay}"
Margin="0,0,0,10"/>
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_SavedRuleMemoryPriority}" Margin="0,0,0,3"/>
<ComboBox ItemsSource="{Binding SavedRuleMemoryPriorityOptions}"
SelectedValuePath="Value"
DisplayMemberPath="Label"
SelectedValue="{Binding SavedRuleMemoryPriority, Mode=TwoWay}"
Margin="0,0,0,10"/>
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_SavedRuleIoPriority}" Margin="0,0,0,3"/>
<ComboBox ItemsSource="{Binding SavedRuleIoPriorityOptions}"
SelectedValuePath="Value"
DisplayMemberPath="Label"
SelectedValue="{Binding SavedRuleIoPriority, Mode=TwoWay}"
Margin="0,0,0,10"/>
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_SavedRuleEfficiencyMode}" Margin="0,0,0,3"
ToolTip="{DynamicResource ProcessView_EfficiencyModeTooltip}"/>
<ComboBox ItemsSource="{Binding SavedRuleEfficiencyModeOptions}"
SelectedValuePath="Value"
DisplayMemberPath="Label"
SelectedValue="{Binding SavedRuleEfficiencyMode, Mode=TwoWay}"
ToolTip="{DynamicResource ProcessView_EfficiencyModeTooltip}"
Margin="0,0,0,10"/>
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_SavedRuleModeLabel}" Margin="0,0,0,3"/>
<ComboBox ItemsSource="{Binding SavedRuleCpuAssignmentModeOptions}"
SelectedValuePath="Value"
DisplayMemberPath="Label"
SelectedValue="{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}"
ToolTip="{DynamicResource ProcessPowerPlanAssociationView_SavedRuleEditorHint}"
SelectedItem="{Binding SavedRuleCoreMask, Mode=TwoWay}"
DisplayMemberPath="Name"
Margin="0,0,0,6"/>
<CheckBox IsChecked="{Binding SavedRulePreventSleep, Mode=TwoWay}"
Margin="0,0,0,10">
<TextBlock Text="{DynamicResource ProcessPowerPlanAssociationView_SavedRulePreventSleep}" TextWrapping="Wrap"/>
</CheckBox>
<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>
<!-- 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="13"
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="13" Foreground="{DynamicResource TextSecondaryBrush}" Margin="0,0,0,2"/>
<TextBlock Text="{Binding SelectedExecutableDisplayName}"
FontWeight="SemiBold" Margin="0,0,0,2"/>
<TextBlock Text="{Binding SelectedExecutableFullPath}"
FontSize="13" 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="13"
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="13"
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="13"
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="13"
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>
<!-- 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>