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">
|
<setting name="WindowSettings" serializeAs="String">
|
||||||
<value />
|
<value />
|
||||||
</setting>
|
</setting>
|
||||||
|
<setting name="AutoStart" serializeAs="String">
|
||||||
|
<value>True</value>
|
||||||
|
</setting>
|
||||||
</ProcessCpuUsageStatusWindow.Properties.Settings>
|
</ProcessCpuUsageStatusWindow.Properties.Settings>
|
||||||
</userSettings>
|
</userSettings>
|
||||||
</configuration>
|
</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
|
namespace ProcessCpuUsageStatusWindow
|
||||||
{
|
{
|
||||||
@@ -10,6 +13,14 @@ namespace ProcessCpuUsageStatusWindow
|
|||||||
{
|
{
|
||||||
base.OnStartup(e);
|
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();
|
_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;
|
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">
|
<Setting Name="WindowSettings" Type="System.String" Scope="User">
|
||||||
<Value Profile="(Default)" />
|
<Value Profile="(Default)" />
|
||||||
</Setting>
|
</Setting>
|
||||||
|
<Setting Name="AutoStart" Type="System.Boolean" Scope="User">
|
||||||
|
<Value Profile="(Default)">True</Value>
|
||||||
|
</Setting>
|
||||||
</Settings>
|
</Settings>
|
||||||
</SettingsFile>
|
</SettingsFile>
|
||||||
Reference in New Issue
Block a user