Files
ThreadPilot/Views/PowerPlanView.xaml
T
2026-05-17 01:25:09 +02:00

142 lines
7.4 KiB
XML

<UserControl x:Class="ThreadPilot.Views.PowerPlanView"
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:helpers="clr-namespace:ThreadPilot.Helpers"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
mc:Ignorable="d"
d:DesignHeight="650" d:DesignWidth="1200">
<Grid Margin="12">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Margin="0,0,0,16">
<TextBlock Text="Power Plans" Style="{StaticResource PageTitleTextStyle}" Margin="0,0,0,4"/>
<TextBlock Text="Manage the active Windows power plan and import custom .pow profiles" Style="{StaticResource PageSubtitleTextStyle}"/>
</StackPanel>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="16"/>
<ColumnDefinition Width="3*"/>
</Grid.ColumnDefinitions>
<!-- System Power Plans -->
<GroupBox Grid.Column="0"
Header="Windows Power Plans"
Margin="0">
<Grid Margin="8">
<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"/>
<ColumnDefinition Width="8"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
Text="Select the Windows plan to make active."
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
VerticalAlignment="Center"/>
<Button Grid.Column="1"
Command="{Binding SetActivePlanCommand}"
Content="Set as Active Windows Plan"
Padding="10,5"
ToolTip="Change the active Windows power plan to the selected plan"/>
<Button Grid.Column="3"
Command="{Binding LoadPowerPlansCommand}"
Content="Refresh Plans"
Padding="10,5"
ToolTip="Refresh the list of available power plans"/>
</Grid>
<ui:ListView Grid.Row="1"
ItemsSource="{Binding PowerPlans}"
SelectedItem="{Binding SelectedPowerPlan}"
Background="{DynamicResource QuietRowBackgroundBrush}"
BorderBrush="{DynamicResource BorderSubtleBrush}"
Foreground="{DynamicResource TextFillColorPrimaryBrush}">
<ui:ListView.ItemTemplate>
<DataTemplate>
<StackPanel Margin="5">
<TextBlock Text="{Binding Name}"
FontWeight="{Binding IsActive, Converter={StaticResource BoolToFontWeightConverter}}"/>
<TextBlock Text="{Binding Guid}"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
FontSize="11"/>
</StackPanel>
</DataTemplate>
</ui:ListView.ItemTemplate>
</ui:ListView>
</Grid>
</GroupBox>
<!-- Custom Power Plans -->
<GroupBox Grid.Column="2"
Header="Custom Power Plans"
Margin="0">
<Grid Margin="8">
<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"/>
<ColumnDefinition Width="8"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
Text="Local .pow files ready to import into Windows."
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
VerticalAlignment="Center"/>
<Button Grid.Column="1"
Command="{Binding ImportCustomPlanCommand}"
Content="Import Selected .pow"
Padding="10,5"
ToolTip="Import the selected custom .pow file into Windows"/>
<Button Grid.Column="3"
Command="{Binding AddCustomPlanFileCommand}"
Content="Add .pow File"
Padding="10,5"
ToolTip="Add a new custom power plan file to the custom library"/>
</Grid>
<ui:ListView Grid.Row="1"
ItemsSource="{Binding CustomPowerPlans}"
SelectedItem="{Binding SelectedCustomPlan}"
Background="{DynamicResource QuietRowBackgroundBrush}"
BorderBrush="{DynamicResource BorderSubtleBrush}"
Foreground="{DynamicResource TextFillColorPrimaryBrush}">
<ui:ListView.ItemTemplate>
<DataTemplate>
<StackPanel Margin="5" ToolTip="{Binding FilePath}">
<TextBlock Text="{Binding Name}"
FontWeight="SemiBold"
TextTrimming="CharacterEllipsis"/>
<TextBlock Text="{Binding FilePath}"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
FontSize="11"
TextTrimming="CharacterEllipsis"/>
</StackPanel>
</DataTemplate>
</ui:ListView.ItemTemplate>
</ui:ListView>
</Grid>
</GroupBox>
</Grid>
</Grid>
</UserControl>