mirror of
https://github.com/ckaczor/ProcessCpuUsageStatusWindow.git
synced 2026-01-14 01:25:41 -05:00
Auto start support
This commit is contained in:
@@ -19,6 +19,9 @@
|
||||
<setting name="WindowSettings" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="AutoStart" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
</ProcessCpuUsageStatusWindow.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
13
App.xaml.cs
13
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();
|
||||
}
|
||||
|
||||
|
||||
12
Properties/Settings.Designer.cs
generated
12
Properties/Settings.Designer.cs
generated
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,5 +11,8 @@
|
||||
<Setting Name="WindowSettings" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="AutoStart" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
Reference in New Issue
Block a user