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