Auto start support

This commit is contained in:
2014-05-03 09:50:56 -04:00
parent 967af2834b
commit 5159468d80
13 changed files with 102 additions and 8 deletions

View File

@@ -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>

View File

@@ -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)

View File

@@ -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;
}
}
}
}

View File

@@ -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>