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