From 462bb398c5a8b6c78873231a7b855d520101326d Mon Sep 17 00:00:00 2001 From: Daniel Chalmers Date: Tue, 16 Jul 2024 00:06:31 -0500 Subject: [PATCH] getting there --- DesktopClock/MainWindow.xaml.cs | 6 +-- DesktopClock/Properties/Settings.cs | 7 ++- DesktopClock/SettingsWindow.xaml | 67 ++++++++++++++++------------- DesktopClock/SettingsWindow.xaml.cs | 10 ++++- 4 files changed, 55 insertions(+), 35 deletions(-) diff --git a/DesktopClock/MainWindow.xaml.cs b/DesktopClock/MainWindow.xaml.cs index 0d9c070..f109f0f 100644 --- a/DesktopClock/MainWindow.xaml.cs +++ b/DesktopClock/MainWindow.xaml.cs @@ -187,7 +187,7 @@ public void CheckForUpdates() [RelayCommand] public void Exit() { - Close(); + Application.Current.Shutdown(); } private void ConfigureTrayIcon(bool showIcon, bool firstLaunch) @@ -268,13 +268,13 @@ private void SystemClockTimer_SecondChanged(object sender, EventArgs e) /// private void UpdateCountdownEnabled() { - if (Settings.Default.CountdownTo == null || Settings.Default.CountdownTo == default(DateTime)) + if (Settings.Default.CountdownTo == default) { CountdownTo = null; return; } - CountdownTo = Settings.Default.CountdownTo.Value.ToDateTimeOffset(_timeZone.BaseUtcOffset); + CountdownTo = Settings.Default.CountdownTo.ToDateTimeOffset(_timeZone.BaseUtcOffset); } /// diff --git a/DesktopClock/Properties/Settings.cs b/DesktopClock/Properties/Settings.cs index 96f7a79..b4ee5c4 100644 --- a/DesktopClock/Properties/Settings.cs +++ b/DesktopClock/Properties/Settings.cs @@ -91,7 +91,7 @@ private Settings() /// /// Date and time to countdown to. If left blank, countdown mode is not enabled. /// - public DateTime? CountdownTo { get; set; } = default(DateTime); + public DateTime CountdownTo { get; set; } = default; /// /// Time zone to be used. @@ -186,6 +186,11 @@ private Settings() /// public TimeSpan WavFileInterval { get; set; } + /// + /// The index of the selected tab in the settings window. + /// + public int SettingsTabIndex { get; set; } + /// /// Teaching tips that have already been shown to the user. /// diff --git a/DesktopClock/SettingsWindow.xaml b/DesktopClock/SettingsWindow.xaml index 986ec93..95c8c8a 100644 --- a/DesktopClock/SettingsWindow.xaml +++ b/DesktopClock/SettingsWindow.xaml @@ -12,49 +12,50 @@ ResizeMode="CanMinimize" SizeToContent="Height" WindowStartupLocation="CenterScreen"> - + - + - + - + - - + + - - + +