-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.xaml
69 lines (63 loc) · 8.8 KB
/
MainWindow.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<Window
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"
xmlns:local="clr-namespace:CoreRation"
xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
x:Class="CoreRation.MainWindow"
mc:Ignorable="d"
Title="CoreRation" Height="400" Width="800" MinHeight="345" Closing="Window_Closing" Closed="Window_Closed" Loaded="Window_Loaded" MinWidth="612">
<Window.Resources>
<CollectionViewSource x:Key="Profiles" Source="{Binding Profiles}">
<CollectionViewSource.SortDescriptions>
<scm:SortDescription PropertyName="Name" Direction="Ascending"/>
</CollectionViewSource.SortDescriptions>
</CollectionViewSource>
</Window.Resources>
<Grid x:Name="AppPanel" d:DataContext="{d:DesignInstance {x:Type local:AppConfig}}">
<Label x:Name="ProfileListLabel" Content="Profiles:" HorizontalAlignment="Left" Margin="10,8,0,0" VerticalAlignment="Top" Padding="0" VerticalContentAlignment="Center"/>
<ListBox x:Name="ProfileList" HorizontalAlignment="Left" Margin="10,31,0,35" Width="155" VerticalContentAlignment="Top" SelectionChanged="ProfileList_SelectionChanged" ItemsSource="{Binding Source={StaticResource Profiles}}" DisplayMemberPath="Name" IsTabStop="True" TabIndex="0"/>
<Button x:Name="AddProfileButton" Content="+" HorizontalAlignment="Left" Margin="145,6,0,0" VerticalAlignment="Top" Width="20" Click="AddProfileButton_Click" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" IsTabStop="False" ToolTip="Creates a new core profile."/>
<Button x:Name="DelProfileButton" Content="-" HorizontalAlignment="Left" Margin="120,6,0,0" VerticalAlignment="Top" Width="20" Click="DelProfileButton_Click" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" IsTabStop="False" ToolTip="Deletes the selected core profile."/>
<Button x:Name="LoadButton" Content="Load" HorizontalAlignment="Left" Margin="10,0,0,10" VerticalAlignment="Bottom" Width="75" Click="LoadButton_Click" VerticalContentAlignment="Center" IsTabStop="False" ToolTip="Loads a set of profiles from a file."/>
<Button x:Name="SaveButton" Content="Save" HorizontalAlignment="Left" Margin="90,0,0,10" VerticalAlignment="Bottom" Width="75" Click="SaveButton_Click" VerticalContentAlignment="Center" IsTabStop="False" AutomationProperties.IsColumnHeader="True" ToolTip="Saves the above profiles to a file."/>
<Grid x:Name="ProfilePanel" Margin="170,31,10,35" d:DataContext="{d:DesignInstance {x:Type local:ProfileConfig}}">
<Grid.Resources>
<CollectionViewSource x:Key="Processes" Source="{Binding Processes}">
<CollectionViewSource.SortDescriptions>
<scm:SortDescription PropertyName="Name" Direction="Ascending"/>
</CollectionViewSource.SortDescriptions>
</CollectionViewSource>
</Grid.Resources>
<ListBox x:Name="ProcessList" HorizontalAlignment="Left" Width="155" Margin="0,157,0,0" SelectionChanged="ProcessList_SelectionChanged" VerticalContentAlignment="Top" DisplayMemberPath="Name" ItemsSource="{Binding Source={StaticResource Processes}}" IsTabStop="True" TabIndex="4"/>
<Label x:Name="OtherCoresLabel" Content="Other Process Cores:" HorizontalAlignment="Left" Margin="0,44,0,0" VerticalAlignment="Top" Padding="0" VerticalContentAlignment="Center" Height="16" Width="109"/>
<TextBox x:Name="OtherCoresField" Height="23" Margin="0,60,0,0" TextWrapping="Wrap" VerticalAlignment="Top" VerticalContentAlignment="Center" Text="{Binding OtherCores, ValidatesOnExceptions=True}" Grid.ColumnSpan="2" TabIndex="2" ToolTip="A list of cores to assign to processes that aren't listed below. Leave blank to leave their affinities unchanged." TextChanged="Input_Changed"/>
<Label x:Name="ProcessListLabel" Content="Processes:" HorizontalAlignment="Left" Margin="0,134,0,0" VerticalAlignment="Top" Padding="0" VerticalContentAlignment="Center" Height="16" Width="54"/>
<Button x:Name="AddProcessButton" Content="+" HorizontalAlignment="Left" Margin="135,132,0,0" VerticalAlignment="Top" Width="20" Click="AddProcessButton_Click" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" IsTabStop="False" ToolTip="Adds a new process entry to the selected core profile." Height="20"/>
<Button x:Name="DelProcessButton" Content="-" HorizontalAlignment="Left" Margin="110,132,0,0" VerticalAlignment="Top" Width="20" Click="DelProcessButton_Click" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" IsTabStop="False" ToolTip="Removes the selected process entry from the selected core profile." Height="20"/>
<Label x:Name="ProfileNameLabel" Content="Profile Name:" HorizontalAlignment="Left" VerticalAlignment="Top" Padding="0" VerticalContentAlignment="Center" Height="16" Width="71"/>
<TextBox x:Name="ProfileNameField" Height="23" Margin="0,16,0,0" TextWrapping="Wrap" VerticalAlignment="Top" VerticalContentAlignment="Center" Text="{Binding Name}" Grid.ColumnSpan="2" TabIndex="1" ToolTip="The name of the selected core profile (for display purposes only)." TextChanged="Input_Changed"/>
<Grid x:Name="ProcessPanel" Margin="160,157,0,0" d:DataContext="{d:DesignInstance {x:Type local:ProcessConfig}}">
<Label x:Name="ProcessNameLabel" Content="Process Name:" HorizontalAlignment="Left" VerticalAlignment="Top" Padding="0"/>
<TextBox x:Name="ProcessNameField" Height="23" Margin="0,16,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Text="{Binding Name}" TabIndex="5" ToolTip="The name of the process to apply the settings to. This should be the executable name without the .exe extension (e.g. notepad)." TextChanged="Input_Changed"/>
<Grid Margin="0,44,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="10"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Label x:Name="ProcessPriorityLabel" Content="Process Priority:" HorizontalAlignment="Left" VerticalAlignment="Top" Padding="0"/>
<Label x:Name="ProcessCoresLabel" Content="Process Cores:" HorizontalAlignment="Left" VerticalAlignment="Top" Padding="0" Grid.Column="3"/>
<TextBox x:Name="ProcessCoresField" Height="23" Margin="0,16,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Grid.Column="3" Text="{Binding Cores, ValidatesOnExceptions=True}" TabIndex="7" ToolTip="A list of cores to assign to the specified process. Leave blank to leave its affinity unchanged." TextChanged="Input_Changed"/>
<ComboBox x:Name="ProcessPriorityField" Margin="0,16,0,0" VerticalAlignment="Top" IsTextSearchEnabled="False" IsReadOnly="True" SelectedItem="{Binding Priority}" TabIndex="6" ToolTip="The priority to apply to the process, if any." SelectionChanged="Input_Changed"/>
</Grid>
</Grid>
<Label x:Name="MonitorIntervalLabel" Content="Monitor Interval (milliseconds):" HorizontalAlignment="Left" Margin="0,88,0,0" VerticalAlignment="Top" Padding="0" Grid.ColumnSpan="2" Height="16" Width="163"/>
<TextBox x:Name="MonitorIntervalField" HorizontalAlignment="Left" Height="23" Margin="0,104,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="163" Grid.ColumnSpan="2" ToolTip="How frequently (in milliseconds) that CoreRation will check for new processes when monitoring." TabIndex="3" Text="{Binding MonitorInterval, ValidatesOnExceptions=True}" TextChanged="Input_Changed"/>
</Grid>
<Button x:Name="ResetButton" Content="Reset" HorizontalAlignment="Left" Margin="330,0,0,10" Width="75" Click="ResetButton_Click" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" TabIndex="10" ToolTip="Resets the core affinities of all processes." Height="20" VerticalAlignment="Bottom"/>
<Button x:Name="MonitorButton" Content="Start Monitoring" HorizontalAlignment="Right" Margin="0,0,10,10" VerticalAlignment="Bottom" Width="105" Click="MonitorButton_Click" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" TabIndex="9" ToolTip="Applies the settings configured in the selected core profile."/>
<Button x:Name="ApplyButton" Content="Apply" HorizontalAlignment="Right" Margin="0,0,120,10" VerticalAlignment="Bottom" Width="75" Click="ApplyButton_Click" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" TabIndex="8" ToolTip="Applies the settings configured in the selected core profile."/>
</Grid>
</Window>