mirror of
https://github.com/ckaczor/FloatingStatusWindow.git
synced 2026-01-13 17:22:47 -05:00
Auto start support
This commit is contained in:
@@ -13,6 +13,9 @@
|
||||
<setting name="WindowSettings" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="AutoStart" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
</TestWindow.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
@@ -1,5 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using FloatingStatusWindowLibrary;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using Settings = TestWindow.Properties.Settings;
|
||||
|
||||
namespace TestWindow
|
||||
{
|
||||
@@ -11,7 +13,20 @@ namespace TestWindow
|
||||
{
|
||||
base.OnStartup(e);
|
||||
|
||||
_windowSourceList = new List<WindowSource> { new WindowSource(), new WindowSource(), new WindowSource() };
|
||||
StartManager.ManageAutoStart = true;
|
||||
StartManager.AutoStartEnabled = Settings.Default.AutoStart;
|
||||
StartManager.AutoStartChanged += (value =>
|
||||
{
|
||||
Settings.Default.AutoStart = value;
|
||||
Settings.Default.Save();
|
||||
});
|
||||
|
||||
_windowSourceList = new List<WindowSource>
|
||||
{
|
||||
//new WindowSource(),
|
||||
//new WindowSource(),
|
||||
new WindowSource()
|
||||
};
|
||||
}
|
||||
|
||||
protected override void OnExit(ExitEventArgs e)
|
||||
|
||||
12
TestWindow/Properties/Settings.Designer.cs
generated
12
TestWindow/Properties/Settings.Designer.cs
generated
@@ -34,5 +34,17 @@ namespace TestWindow.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,5 +5,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