diff --git a/Hourglass.Bundle/Bundle.wxs b/Hourglass.Bundle/Bundle.wxs index 70b58cd..b756212 100644 --- a/Hourglass.Bundle/Bundle.wxs +++ b/Hourglass.Bundle/Bundle.wxs @@ -1,7 +1,7 @@ - + diff --git a/Hourglass.Setup/Product.wxs b/Hourglass.Setup/Product.wxs index 46b8ea1..a001c8d 100644 --- a/Hourglass.Setup/Product.wxs +++ b/Hourglass.Setup/Product.wxs @@ -1,7 +1,7 @@ - + diff --git a/Hourglass.Test/Properties/AssemblyInfo.cs b/Hourglass.Test/Properties/AssemblyInfo.cs index 82ef206..c09a636 100644 --- a/Hourglass.Test/Properties/AssemblyInfo.cs +++ b/Hourglass.Test/Properties/AssemblyInfo.cs @@ -17,5 +17,5 @@ [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("002a4be7-7323-4bf9-ab08-5fc8978d9eb0")] -[assembly: AssemblyVersion("1.7.0.0")] -[assembly: AssemblyFileVersion("1.7.0.0")] +[assembly: AssemblyVersion("1.8.0.0")] +[assembly: AssemblyFileVersion("1.8.0.0")] diff --git a/Hourglass/App.config b/Hourglass/App.config index dc39f46..2068366 100644 --- a/Hourglass/App.config +++ b/Hourglass/App.config @@ -19,6 +19,9 @@ 00000000-0000-0000-0000-000000000000 + + True + diff --git a/Hourglass/Managers/AppManager.cs b/Hourglass/Managers/AppManager.cs index d18326b..2f29090 100644 --- a/Hourglass/Managers/AppManager.cs +++ b/Hourglass/Managers/AppManager.cs @@ -6,6 +6,8 @@ namespace Hourglass.Managers { + using System.Linq; + /// /// Manages the app. /// @@ -22,6 +24,7 @@ public class AppManager : Manager private static readonly Manager[] Managers = { ErrorManager.Instance, + SettingsManager.Instance, UpdateManager.Instance, KeepAwakeManager.Instance, WakeUpManager.Instance, @@ -30,8 +33,7 @@ public class AppManager : Manager SoundManager.Instance, TimerStartManager.Instance, TimerOptionsManager.Instance, - TimerManager.Instance, - SettingsManager.Instance + TimerManager.Instance }; /// @@ -57,7 +59,7 @@ public override void Initialize() /// public override void Persist() { - foreach (Manager manager in Managers) + foreach (Manager manager in Managers.Reverse()) { manager.Persist(); } @@ -77,7 +79,7 @@ protected override void Dispose(bool disposing) if (disposing) { - foreach (Manager manager in Managers) + foreach (Manager manager in Managers.Reverse()) { manager.Dispose(); } diff --git a/Hourglass/Managers/ErrorManager.cs b/Hourglass/Managers/ErrorManager.cs index 4219216..29d9621 100644 --- a/Hourglass/Managers/ErrorManager.cs +++ b/Hourglass/Managers/ErrorManager.cs @@ -82,7 +82,7 @@ private static void AppDomainUnhandledException(object sender, UnhandledExceptio // Show an error dialog ErrorDialog errorDialog = new ErrorDialog(); - errorDialog.ShowDialog(Resources.ErrorManagerUnexpectedError, errorMessage); + errorDialog.ShowDialog(Resources.ErrorManagerUnexpectedError, details: errorMessage); } finally { diff --git a/Hourglass/Managers/KeepAwakeManager.cs b/Hourglass/Managers/KeepAwakeManager.cs index 0397e82..7fb801f 100644 --- a/Hourglass/Managers/KeepAwakeManager.cs +++ b/Hourglass/Managers/KeepAwakeManager.cs @@ -41,13 +41,6 @@ private KeepAwakeManager() /// public bool IsKeepingSystemAwake { get; private set; } - /// - /// Initializes the class. - /// - public override void Initialize() - { - } - /// /// Adds the specified object to the set of objects that require that the system be kept awake and starts /// keeping the system awake if it was not already being kept awake. diff --git a/Hourglass/Managers/SettingsManager.cs b/Hourglass/Managers/SettingsManager.cs index 3f58df7..980f383 100644 --- a/Hourglass/Managers/SettingsManager.cs +++ b/Hourglass/Managers/SettingsManager.cs @@ -25,6 +25,19 @@ private SettingsManager() { } + /// + /// Initializes the class. + /// + public override void Initialize() + { + if (Settings.Default.UpgradeRequired) + { + Settings.Default.Upgrade(); + Settings.Default.UpgradeRequired = false; + Settings.Default.Save(); + } + } + /// /// Persists the state of the class. /// diff --git a/Hourglass/Properties/App.manifest b/Hourglass/Properties/App.manifest index 202497f..ff5d57c 100644 --- a/Hourglass/Properties/App.manifest +++ b/Hourglass/Properties/App.manifest @@ -1,6 +1,6 @@  - + diff --git a/Hourglass/Properties/AssemblyInfo.cs b/Hourglass/Properties/AssemblyInfo.cs index 32f111a..1d4ef9d 100644 --- a/Hourglass/Properties/AssemblyInfo.cs +++ b/Hourglass/Properties/AssemblyInfo.cs @@ -17,8 +17,8 @@ [assembly: AssemblyCopyright("Copyright © 2016 Chris Dziemborowicz")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("1.7.0.0")] -[assembly: AssemblyFileVersion("1.7.0.0")] +[assembly: AssemblyVersion("1.8.0.0")] +[assembly: AssemblyFileVersion("1.8.0.0")] [assembly: NeutralResourcesLanguageAttribute("en-US")] [assembly: Guid("83DBAA61-6193-4288-BBB7-BEAEC33FE321")] [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] diff --git a/Hourglass/Properties/Resources.Designer.cs b/Hourglass/Properties/Resources.Designer.cs index 8ebf02e..5bc5c34 100644 --- a/Hourglass/Properties/Resources.Designer.cs +++ b/Hourglass/Properties/Resources.Designer.cs @@ -1789,6 +1789,24 @@ internal static string TimerWindowCloseMessageBoxText { } } + /// + /// Looks up a localized string similar to To update Hourglass, visit {0} in your web browser.. + /// + internal static string TimerWindowCouldNotLaunchWebBrowserErrorMessage { + get { + return ResourceManager.GetString("TimerWindowCouldNotLaunchWebBrowserErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not launch web browser. + /// + internal static string TimerWindowCouldNotLaunchWebBrowserErrorTitle { + get { + return ResourceManager.GetString("TimerWindowCouldNotLaunchWebBrowserErrorTitle", resourceCulture); + } + } + /// /// Looks up a localized string similar to New timer: {0} "{1}". /// diff --git a/Hourglass/Properties/Resources.resx b/Hourglass/Properties/Resources.resx index 45c1b99..d2d4f05 100644 --- a/Hourglass/Properties/Resources.resx +++ b/Hourglass/Properties/Resources.resx @@ -1201,4 +1201,12 @@ $ _Window title The text for the window title menu item, where the character following the optional underscore (_) is the access key + + To update Hourglass, visit {0} in your web browser. + The message in the error dialog shown when the web browser could not be launched to open the download page for the latest version of the app + + + Could not launch web browser + The title of the error dialog shown when the web browser could not be launched to open the download page for the latest version of the app + \ No newline at end of file diff --git a/Hourglass/Properties/Settings.Designer.cs b/Hourglass/Properties/Settings.Designer.cs index 120736b..7607ef7 100644 --- a/Hourglass/Properties/Settings.Designer.cs +++ b/Hourglass/Properties/Settings.Designer.cs @@ -113,5 +113,17 @@ public bool ShowInNotificationArea { this["WindowSizeInfo"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool UpgradeRequired { + get { + return ((bool)(this["UpgradeRequired"])); + } + set { + this["UpgradeRequired"] = value; + } + } } } diff --git a/Hourglass/Properties/Settings.settings b/Hourglass/Properties/Settings.settings index d914c10..483f9fd 100644 --- a/Hourglass/Properties/Settings.settings +++ b/Hourglass/Properties/Settings.settings @@ -26,5 +26,8 @@ + + True + \ No newline at end of file diff --git a/Hourglass/Windows/ErrorDialog.xaml b/Hourglass/Windows/ErrorDialog.xaml index 6309874..1ae441d 100644 --- a/Hourglass/Windows/ErrorDialog.xaml +++ b/Hourglass/Windows/ErrorDialog.xaml @@ -32,12 +32,21 @@ - + + + + + /// Opens the window and returns only when the window is closed. /// - /// An error message. - /// Details of the error. (Optional.) - public void ShowDialog(string message, string details = null) + /// The title for the error dialog.. + /// The error message to show. (Optional.) + /// Details of the error, such as a call stack. (Optional.) + public void ShowDialog(string title, string message = null, string details = null) { - this.MessageTextBlock.Text = message; + this.TitleTextBlock.Text = title; + + this.MessageTextBox.Text = message ?? string.Empty; + this.MessageBorder.Visibility = string.IsNullOrEmpty(message) ? Visibility.Collapsed : Visibility.Visible; + this.DetailsTextBox.Text = details ?? string.Empty; this.ShowDetailsButton.IsEnabled = !string.IsNullOrEmpty(details); @@ -43,7 +48,7 @@ public void ShowDialog(string message, string details = null) private void InitializeResources() { this.Title = Properties.Resources.ErrorDialogTitle; - this.MessageTextBlock.Text = Properties.Resources.ErrorDialogDefaultMessageText; + this.TitleTextBlock.Text = Properties.Resources.ErrorDialogDefaultMessageText; this.ShowDetailsButton.Content = Properties.Resources.ErrorDialogShowDetailsButtonContent; this.CloseButton.Content = Properties.Resources.ErrorDialogCloseButtonContent; } diff --git a/Hourglass/Windows/TimerWindow.xaml.cs b/Hourglass/Windows/TimerWindow.xaml.cs index 875c76a..f6f3551 100644 --- a/Hourglass/Windows/TimerWindow.xaml.cs +++ b/Hourglass/Windows/TimerWindow.xaml.cs @@ -1413,7 +1413,22 @@ private void UpdateCommandExecuted(object sender, ExecutedRoutedEventArgs e) Uri updateUri = UpdateManager.Instance.UpdateUri; if (updateUri != null && (updateUri.Scheme == Uri.UriSchemeHttp || updateUri.Scheme == Uri.UriSchemeHttps)) { - Process.Start(updateUri.ToString()); + try + { + Process.Start(updateUri.ToString()); + } + catch (Exception ex) + { + string message = string.Format( + Properties.Resources.TimerWindowCouldNotLaunchWebBrowserErrorMessage, + updateUri); + + ErrorDialog dialog = new ErrorDialog(); + dialog.ShowDialog( + title: Properties.Resources.TimerWindowCouldNotLaunchWebBrowserErrorTitle, + message: message, + details: ex.ToString()); + } } }