diff --git a/App.config b/App.config
index 3062bfd..8723ca1 100644
--- a/App.config
+++ b/App.config
@@ -19,6 +19,9 @@
+
+ True
+
\ No newline at end of file
diff --git a/App.xaml.cs b/App.xaml.cs
index e755a39..4768dab 100644
--- a/App.xaml.cs
+++ b/App.xaml.cs
@@ -1,4 +1,7 @@
-using System.Windows;
+using FloatingStatusWindowLibrary;
+using ProcessCpuUsageStatusWindow.Properties;
+using System.Diagnostics;
+using System.Windows;
namespace ProcessCpuUsageStatusWindow
{
@@ -10,6 +13,14 @@ namespace ProcessCpuUsageStatusWindow
{
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 6e0bde0..5f6f8ba 100644
--- a/Properties/Settings.Designer.cs
+++ b/Properties/Settings.Designer.cs
@@ -58,5 +58,17 @@ namespace ProcessCpuUsageStatusWindow.Properties {
this["WindowSettings"] = 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 af8bde6..6d8c7f4 100644
--- a/Properties/Settings.settings
+++ b/Properties/Settings.settings
@@ -11,5 +11,8 @@
+
+ True
+
\ No newline at end of file