Files
FloatingStatusWindow/Library/StartManager.cs
Chris Kaczor e2236ddc16 Improvements
- Update to .NET 10
- Set actual window title to window name
- Add new way to identify other windows
2026-02-24 17:11:21 -05:00

30 lines
865 B
C#

using ChrisKaczor.Wpf.Application;
using System;
namespace ChrisKaczor.Wpf.Windows.FloatingStatusWindow;
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 => ManageAutoStart && _autoStartEnabled;
set
{
if (!ManageAutoStart)
throw new InvalidOperationException("Cannot set AutoStartEnabled when ManageAutoStart is False");
_autoStartEnabled = value;
System.Windows.Application.Current.SetStartWithWindows(_autoStartEnabled);
AutoStartChanged(_autoStartEnabled);
}
}
}