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

@@ -0,0 +1,34 @@
using Common.Wpf.Extensions;
using System;
using System.Windows;
namespace FloatingStatusWindowLibrary
{
public static class StartManager
{
public delegate void AutoStartChangedEventHandler(bool autoStart);
public static event AutoStartChangedEventHandler AutoStartChanged = delegate { };
public static bool ManageAutoStart { get; set; }
private static bool _autoStartEnabled;
public static bool AutoStartEnabled
{
get
{
return ManageAutoStart && _autoStartEnabled;
}
set
{
if (!ManageAutoStart)
throw new InvalidOperationException("Cannot set AutoStartEnabled when ManageAutoStart is False");
_autoStartEnabled = value;
Application.Current.SetStartWithWindows(_autoStartEnabled);
AutoStartChanged(_autoStartEnabled);
}
}
}
}