74922890c8
Replace Window with Wpf.Ui FluentWindow and integrate Wpf.Ui theme dictionaries and controls; migrate main navigation from TabControl to NavigationView with TitleBar, navigation items and view visibility management, improved startup overlay with blur/fade animations, and updated status bar. Converters now resolve brushes from application resources for theming. CpuTopologyService: add Windows API (GetLogicalProcessorInformationEx) detection, richer structures, improved HT/core type heuristics, labeling and affinity presets; fallbacks and WMI usage preserved. System tray: add ApplyTheme method, custom menu font handling and related calls. NotificationService: standardize display duration via a constant. Misc: XAML/resource adjustments, minor view/viewmodel wiring, and .gitignore updated to include implementation_plan.md.
191 lines
12 KiB
XML
191 lines
12 KiB
XML
<UserControl x:Class="ThreadPilot.Views.MasksView"
|
||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||
mc:Ignorable="d"
|
||
d:DesignHeight="600" d:DesignWidth="900">
|
||
|
||
<Grid Margin="12">
|
||
<Grid.RowDefinitions>
|
||
<RowDefinition Height="*"/>
|
||
<RowDefinition Height="Auto"/>
|
||
</Grid.RowDefinitions>
|
||
|
||
<Grid Grid.Row="0">
|
||
<Grid.ColumnDefinitions>
|
||
<ColumnDefinition Width="2*" MinWidth="200"/>
|
||
<ColumnDefinition Width="Auto"/>
|
||
<ColumnDefinition Width="3*" MinWidth="300"/>
|
||
</Grid.ColumnDefinitions>
|
||
|
||
<!-- LISTA MASCHERE SINISTRA -->
|
||
<DockPanel Grid.Column="0">
|
||
<!-- Header con bottoni -->
|
||
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="0,0,0,10">
|
||
<Button Content="➕ New" Command="{Binding CreateMaskCommand}"
|
||
Padding="10,5" FontSize="13" Margin="0,0,5,0"
|
||
ToolTip="Create a new CPU mask"/>
|
||
<Button Content="🗑️ Delete" Command="{Binding DeleteMaskCommand}"
|
||
Padding="10,5" FontSize="13"
|
||
ToolTip="Delete selected mask"/>
|
||
</StackPanel>
|
||
|
||
<!-- ListBox delle maschere -->
|
||
<Border BorderBrush="{DynamicResource ControlStrokeColorDefaultBrush}" BorderThickness="1" CornerRadius="8">
|
||
<ListBox ItemsSource="{Binding CoreMasks}"
|
||
SelectedItem="{Binding SelectedCoreMask, Mode=TwoWay}"
|
||
Background="{DynamicResource ControlFillColorDefaultBrush}"
|
||
BorderThickness="0">
|
||
<ListBox.ItemTemplate>
|
||
<DataTemplate>
|
||
<Grid Margin="5">
|
||
<Grid.ColumnDefinitions>
|
||
<ColumnDefinition Width="*"/>
|
||
<ColumnDefinition Width="Auto"/>
|
||
</Grid.ColumnDefinitions>
|
||
|
||
<StackPanel Grid.Column="0">
|
||
<TextBlock Text="{Binding Name}" FontWeight="SemiBold" FontSize="13"/>
|
||
<TextBlock Text="{Binding Description}"
|
||
FontSize="11" Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||
TextTrimming="CharacterEllipsis"
|
||
Margin="0,2,0,0"/>
|
||
<TextBlock FontSize="10" Foreground="{DynamicResource TextFillColorSecondaryBrush}" Margin="0,2,0,0">
|
||
<Run Text="{Binding SelectedCoreCount, Mode=OneWay}"/>
|
||
<Run Text="/"/>
|
||
<Run Text="{Binding BoolMask.Count, Mode=OneWay}"/>
|
||
<Run Text="CPUs"/>
|
||
</TextBlock>
|
||
</StackPanel>
|
||
|
||
<TextBlock Grid.Column="1"
|
||
Text="⭐" FontSize="14"
|
||
VerticalAlignment="Center"
|
||
Margin="5,0,0,0">
|
||
<TextBlock.Style>
|
||
<Style TargetType="TextBlock">
|
||
<Setter Property="Visibility" Value="Collapsed"/>
|
||
<Style.Triggers>
|
||
<DataTrigger Binding="{Binding IsDefault}" Value="True">
|
||
<Setter Property="Visibility" Value="Visible"/>
|
||
</DataTrigger>
|
||
</Style.Triggers>
|
||
</Style>
|
||
</TextBlock.Style>
|
||
</TextBlock>
|
||
</Grid>
|
||
</DataTemplate>
|
||
</ListBox.ItemTemplate>
|
||
</ListBox>
|
||
</Border>
|
||
</DockPanel>
|
||
|
||
<!-- DIVIDER -->
|
||
<GridSplitter Grid.Column="1" Width="8" HorizontalAlignment="Stretch" Background="Transparent"/>
|
||
|
||
<!-- EDITOR MASK DESTRA -->
|
||
<ScrollViewer Grid.Column="2" VerticalScrollBarVisibility="Auto">
|
||
<StackPanel Margin="10,0,0,0">
|
||
<StackPanel.Style>
|
||
<Style TargetType="StackPanel">
|
||
<Setter Property="IsEnabled" Value="True"/>
|
||
<Style.Triggers>
|
||
<DataTrigger Binding="{Binding SelectedCoreMask}" Value="{x:Null}">
|
||
<Setter Property="IsEnabled" Value="False"/>
|
||
</DataTrigger>
|
||
</Style.Triggers>
|
||
</Style>
|
||
</StackPanel.Style>
|
||
|
||
<!-- Nome e Descrizione -->
|
||
<GroupBox Header="Mask Information" Padding="10" Margin="0,10,0,10">
|
||
<StackPanel>
|
||
<TextBlock Text="Name:" FontWeight="SemiBold" Margin="0,0,0,5"/>
|
||
<TextBox Text="{Binding SelectedCoreMask.Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||
Padding="8,6" FontSize="13" Margin="0,0,0,10"/>
|
||
|
||
<TextBlock Text="Description:" FontWeight="SemiBold" Margin="0,0,0,5"/>
|
||
<TextBox Text="{Binding SelectedCoreMask.Description, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||
Padding="8,6" MinHeight="72" TextWrapping="Wrap" AcceptsReturn="True"
|
||
VerticalScrollBarVisibility="Auto"/>
|
||
</StackPanel>
|
||
</GroupBox>
|
||
|
||
<!-- CPU Selection Grid -->
|
||
<GroupBox Header="Select CPUs" Padding="10" Margin="0,10,0,10">
|
||
<StackPanel>
|
||
<!-- CPU checkboxes - direct binding to BoolMask like CPUSetSetter -->
|
||
<TextBlock Text="Click checkboxes to toggle CPUs. Changes are saved automatically."
|
||
FontSize="11" Foreground="{DynamicResource TextFillColorSecondaryBrush}" Margin="0,0,0,10"/>
|
||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||
<ItemsControl x:Name="CoreItemsControl" ItemsSource="{Binding CoreBits}">
|
||
<ItemsControl.ItemsPanel>
|
||
<ItemsPanelTemplate>
|
||
<WrapPanel Orientation="Horizontal"/>
|
||
</ItemsPanelTemplate>
|
||
</ItemsControl.ItemsPanel>
|
||
<ItemsControl.ItemTemplate>
|
||
<DataTemplate>
|
||
<Border BorderBrush="{DynamicResource ControlStrokeColorDefaultBrush}" BorderThickness="1"
|
||
Margin="2" Padding="4" CornerRadius="3">
|
||
<Border.Style>
|
||
<Style TargetType="Border">
|
||
<Setter Property="Background" Value="{DynamicResource ControlFillColorSecondaryBrush}"/>
|
||
<Setter Property="BorderBrush" Value="{DynamicResource ControlStrokeColorDefaultBrush}"/>
|
||
<Style.Triggers>
|
||
<DataTrigger Binding="{Binding IsSelected}" Value="True">
|
||
<Setter Property="Background" Value="{DynamicResource SoftSelectionBackgroundBrush}"/>
|
||
<Setter Property="BorderBrush" Value="{DynamicResource SoftSelectionBorderBrush}"/>
|
||
</DataTrigger>
|
||
</Style.Triggers>
|
||
</Style>
|
||
</Border.Style>
|
||
<CheckBox IsChecked="{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||
FontSize="10" MinWidth="60">
|
||
<CheckBox.Content>
|
||
<TextBlock>
|
||
<Run Text="CPU "/>
|
||
<Run Text="{Binding Index, Mode=OneWay}"/>
|
||
</TextBlock>
|
||
</CheckBox.Content>
|
||
</CheckBox>
|
||
</Border>
|
||
</DataTemplate>
|
||
</ItemsControl.ItemTemplate>
|
||
</ItemsControl>
|
||
</ScrollViewer>
|
||
</StackPanel>
|
||
</GroupBox>
|
||
|
||
<!-- Actions -->
|
||
<GroupBox Header="Actions" Padding="10">
|
||
<StackPanel>
|
||
<Button Content="📋 Duplicate Mask" Command="{Binding DuplicateMaskCommand}"
|
||
HorizontalAlignment="Left" Padding="10,6" Margin="0,0,0,5"/>
|
||
|
||
<CheckBox Content="Set as Default Mask"
|
||
IsChecked="{Binding SelectedCoreMask.IsDefault, Mode=TwoWay}"
|
||
Margin="0,10,0,5"
|
||
ToolTip="The default mask is applied to new processes"/>
|
||
|
||
<CheckBox Content="Enabled"
|
||
IsChecked="{Binding SelectedCoreMask.IsEnabled, Mode=TwoWay}"
|
||
Margin="0,5"
|
||
ToolTip="Disable to temporarily hide this mask"/>
|
||
</StackPanel>
|
||
</GroupBox>
|
||
</StackPanel>
|
||
</ScrollViewer>
|
||
</Grid>
|
||
|
||
<!-- Status Bar -->
|
||
<Border Grid.Row="1" Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}" Padding="10,5" Margin="0,10,0,0" CornerRadius="6">
|
||
<TextBlock Text="{Binding StatusMessage}"
|
||
FontSize="12" Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||
Opacity="{Binding StatusOpacity}"
|
||
TextTrimming="CharacterEllipsis"/>
|
||
</Border>
|
||
</Grid>
|
||
</UserControl>
|