Start working on settings UI

This commit is contained in:
2024-09-29 21:00:13 -04:00
parent 3a87285e58
commit 5631bc87be
9 changed files with 267 additions and 62 deletions

View File

@@ -0,0 +1,21 @@
<windows:CategoryPanelBase x:Class="WorldClockStatusWindow.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:WorldClockStatusWindow.Properties"
xmlns:worldClockStatusWindow="clr-namespace:WorldClockStatusWindow"
xmlns:windows="clr-namespace:ChrisKaczor.Wpf.Windows;assembly=ChrisKaczor.Wpf.Windows.CategoryWindow"
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 worldClockStatusWindow:Program.LocalVersion}, StringFormat={x:Static properties:Resources.Version}}"
Name="VersionLabel" />
<TextBlock Text="Chris Kaczor" />
</StackPanel>
</Grid>
</windows:CategoryPanelBase>

View File

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

View File

@@ -0,0 +1,16 @@
<windows:CategoryPanelBase x:Class="WorldClockStatusWindow.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:WorldClockStatusWindow.Properties"
xmlns:windows="clr-namespace:ChrisKaczor.Wpf.Windows;assembly=ChrisKaczor.Wpf.Windows.CategoryWindow"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="300">
<StackPanel windows:Spacing.Vertical="10">
<CheckBox Content="{x:Static properties:Resources.startWithWindowsCheckBox}"
IsChecked="{Binding Source={x:Static properties:Settings.Default}, Path=AutoStart}"
Click="OnSaveSettings" />
</StackPanel>
</windows:CategoryPanelBase>

View File

@@ -0,0 +1,36 @@
using ChrisKaczor.Wpf.Application;
using System.Windows;
using WorldClockStatusWindow.Properties;
namespace WorldClockStatusWindow.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);
}
}