From 043daea51e8b51b96bc5d235090d00bd098ddd3d Mon Sep 17 00:00:00 2001 From: Chris Kaczor Date: Sat, 3 May 2014 09:52:08 -0400 Subject: [PATCH] Auto start support --- App.config | 3 +++ App.xaml.cs | 13 ++++++++++++- Properties/Settings.Designer.cs | 12 ++++++++++++ Properties/Settings.settings | 3 +++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/App.config b/App.config index fa7cfbf..6ad5b04 100644 --- a/App.config +++ b/App.config @@ -25,6 +25,9 @@ 80 + + True + \ No newline at end of file diff --git a/App.xaml.cs b/App.xaml.cs index 1186400..8f4c505 100644 --- a/App.xaml.cs +++ b/App.xaml.cs @@ -1,4 +1,7 @@ -using System.Windows; +using FloatingStatusWindowLibrary; +using System.Diagnostics; +using System.Windows; +using SystemTemperatureStatusWindow.Properties; namespace SystemTemperatureStatusWindow { @@ -10,6 +13,14 @@ namespace SystemTemperatureStatusWindow { base.OnStartup(e); + StartManager.ManageAutoStart = true; + StartManager.AutoStartEnabled = !Debugger.IsAttached && Settings.Default.AutoStart; + StartManager.AutoStartChanged += (value => + { + Settings.Default.AutoStart = value; + Settings.Default.Save(); + }); + _windowSource = new WindowSource(); } diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs index c9d4cbe..c51852d 100644 --- a/Properties/Settings.Designer.cs +++ b/Properties/Settings.Designer.cs @@ -82,5 +82,17 @@ namespace SystemTemperatureStatusWindow.Properties { this["AlertLevel"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool AutoStart { + get { + return ((bool)(this["AutoStart"])); + } + set { + this["AutoStart"] = value; + } + } } } diff --git a/Properties/Settings.settings b/Properties/Settings.settings index 58ac33a..61013a6 100644 --- a/Properties/Settings.settings +++ b/Properties/Settings.settings @@ -17,5 +17,8 @@ 80 + + True + \ No newline at end of file