Add update settings panel

This commit is contained in:
2024-09-30 17:41:54 -04:00
parent 5631bc87be
commit 733a3de573
12 changed files with 224 additions and 15 deletions

View File

@@ -13,7 +13,7 @@
<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}}"
<TextBlock Text="{Binding Source={x:Static worldClockStatusWindow:UpdateCheck.LocalVersion}, StringFormat={x:Static properties:Resources.Version}}"
Name="VersionLabel" />
<TextBlock Text="Chris Kaczor" />
</StackPanel>

View File

@@ -0,0 +1,22 @@
<windows:CategoryPanelBase x:Class="WorldClockStatusWindow.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:WorldClockStatusWindow.Properties"
xmlns:windows="clr-namespace:ChrisKaczor.Wpf.Windows;assembly=ChrisKaczor.Wpf.Windows.CategoryWindow"
xmlns:worldClockStatusWindow="clr-namespace:WorldClockStatusWindow"
mc:Ignorable="d"
d:DesignHeight="150"
d:DesignWidth="250">
<StackPanel windows:Spacing.Vertical="10">
<CheckBox Content="{x:Static properties:Resources.checkVersionOnStartupCheckBox}"
Name="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 worldClockStatusWindow:UpdateCheck.IsInstalled}}"
HorizontalAlignment="Left"
Click="HandleCheckVersionNowButtonClick" />
</StackPanel>
</windows:CategoryPanelBase>

View File

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