Modernize project

This commit is contained in:
2026-02-27 12:18:46 -05:00
parent eebd23f702
commit 6001954705
36 changed files with 1338 additions and 1239 deletions

View File

@@ -0,0 +1,21 @@
<windows:CategoryPanelBase x:Class="ProcessCpuUsageStatusWindow.SettingsWindow.AboutSettingsPanel"
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:properties="clr-namespace:ProcessCpuUsageStatusWindow.Properties"
xmlns:windows="clr-namespace:ChrisKaczor.Wpf.Windows;assembly=ChrisKaczor.Wpf.Windows.CategoryWindow"
xmlns:processcpuusagestatuswindow="clr-namespace:ProcessCpuUsageStatusWindow"
mc:Ignorable="d"
d:DesignHeight="150"
d:DesignWidth="300">
<Grid>
<StackPanel windows:Spacing.Vertical="10">
<TextBlock Text="{x:Static properties:Resources.ApplicationName}"
FontWeight="Bold" />
<TextBlock Text="{Binding Source={x:Static processcpuusagestatuswindow:UpdateCheck.LocalVersion}, StringFormat={x:Static properties:Resources.Version}}"
Name="VersionLabel" />
<TextBlock Text="Chris Kaczor" />
</StackPanel>
</Grid>
</windows:CategoryPanelBase>

View File

@@ -0,0 +1,12 @@
namespace ProcessCpuUsageStatusWindow.SettingsWindow
{
public partial class AboutSettingsPanel
{
public AboutSettingsPanel()
{
InitializeComponent();
}
public override string CategoryName => Properties.Resources.optionCategoryAbout;
}
}

View File

@@ -0,0 +1,50 @@
<windows:CategoryPanelBase x:Class="ProcessCpuUsageStatusWindow.SettingsWindow.GeneralSettingsPanel"
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:properties="clr-namespace:ProcessCpuUsageStatusWindow.Properties"
xmlns:windows="clr-namespace:ChrisKaczor.Wpf.Windows;assembly=ChrisKaczor.Wpf.Windows.CategoryWindow"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="300">
<windows:CategoryPanelBase.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary
Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.FlatButton.xaml" />
<ResourceDictionary
Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/light.cobalt.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</windows:CategoryPanelBase.Resources>
<StackPanel>
<CheckBox
Content="{x:Static properties:Resources.startWithWindowsCheckBox}"
IsChecked="{Binding Source={x:Static properties:Settings.Default}, Path=AutoStart}"
Margin="0,0,0,16"
Click="OnSaveSettings" />
<StackPanel
Margin="0,0,0,10"
Orientation="Horizontal">
<Label Content="{x:Static properties:Resources.NumberOfProcesses}"
HorizontalAlignment="Left"
Margin="0,0,5,0"
VerticalAlignment="Center"
Padding="0" />
<mah:NumericUpDown Width="75"
Maximum="20"
Minimum="1"
Value="{Binding Source={x:Static properties:Settings.Default}, Path=ProcessCount}"
ValueChanged="OnSaveSettings" />
</StackPanel>
<CheckBox
Content="{x:Static properties:Resources.showProcessId}"
IsChecked="{Binding Source={x:Static properties:Settings.Default}, Path=ShowProcessId}"
Click="OnSaveSettings" />
</StackPanel>
</windows:CategoryPanelBase>

View File

@@ -0,0 +1,36 @@
using System.Windows;
using ChrisKaczor.Wpf.Application;
using ProcessCpuUsageStatusWindow.Properties;
namespace ProcessCpuUsageStatusWindow.SettingsWindow;
public partial class GeneralSettingsPanel
{
public GeneralSettingsPanel()
{
InitializeComponent();
}
public override string CategoryName => Properties.Resources.optionCategoryGeneral;
public override void LoadPanel(Window parentWindow)
{
base.LoadPanel(parentWindow);
MarkLoaded();
}
private void OnSaveSettings(object sender, RoutedEventArgs e)
{
SaveSettings();
}
private void SaveSettings()
{
if (!HasLoaded) return;
Settings.Default.Save();
Application.Current.SetStartWithWindows(Settings.Default.AutoStart);
}
}

View File

@@ -0,0 +1,21 @@
<windows:CategoryPanelBase x:Class="ProcessCpuUsageStatusWindow.SettingsWindow.UpdateSettingsPanel"
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:properties="clr-namespace:ProcessCpuUsageStatusWindow.Properties"
xmlns:windows="clr-namespace:ChrisKaczor.Wpf.Windows;assembly=ChrisKaczor.Wpf.Windows.CategoryWindow"
xmlns:processcpuusagestatuswindow="clr-namespace:ProcessCpuUsageStatusWindow"
mc:Ignorable="d"
d:DesignHeight="150"
d:DesignWidth="250">
<StackPanel windows:Spacing.Vertical="10">
<CheckBox Content="{x:Static properties:Resources.checkVersionOnStartupCheckBox}"
IsChecked="{Binding Source={x:Static properties:Settings.Default}, Path=CheckVersionAtStartup}"
Click="OnSaveSettings" />
<Button Content="{x:Static properties:Resources.checkVersionNowButton}"
IsEnabled="{Binding Source={x:Static processcpuusagestatuswindow:UpdateCheck.IsInstalled}}"
HorizontalAlignment="Left"
Click="HandleCheckVersionNowButtonClick" />
</StackPanel>
</windows:CategoryPanelBase>

View File

@@ -0,0 +1,38 @@
using System.Windows;
using System.Windows.Input;
using ProcessCpuUsageStatusWindow.Properties;
namespace ProcessCpuUsageStatusWindow.SettingsWindow;
public partial class UpdateSettingsPanel
{
public UpdateSettingsPanel()
{
InitializeComponent();
}
public override string CategoryName => Properties.Resources.optionCategoryUpdate;
private async void HandleCheckVersionNowButtonClick(object sender, RoutedEventArgs e)
{
var cursor = Cursor;
Cursor = Cursors.Wait;
await UpdateCheck.DisplayUpdateInformation(true);
Cursor = cursor;
}
private void OnSaveSettings(object sender, RoutedEventArgs e)
{
SaveSettings();
}
private void SaveSettings()
{
if (!HasLoaded) return;
Settings.Default.Save();
}
}