unison/App.xaml.cs

41 lines
1.1 KiB
C#
Raw Normal View History

2021-08-19 21:03:50 +00:00
using System.Windows;
using Hardcodet.Wpf.TaskbarNotification;
namespace unison
{
public partial class App : Application
{
2021-09-01 00:35:37 +00:00
private TaskbarIcon _systray;
private HotkeyHandler _hotkeys;
private SnapcastHandler _snapcast;
private MPDHandler _mpd;
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
2021-09-01 00:35:37 +00:00
_mpd = new MPDHandler();
Current.Properties["mpd"] = _mpd;
2021-08-16 00:13:47 +00:00
2021-09-01 00:35:37 +00:00
_hotkeys = new HotkeyHandler();
Current.Properties["hotkeys"] = _hotkeys;
2021-09-01 00:35:37 +00:00
_snapcast = new SnapcastHandler();
Current.Properties["snapcast"] = _snapcast;
Current.MainWindow = new MainWindow();
2021-09-01 00:35:37 +00:00
_systray = (TaskbarIcon)FindResource("SystrayTaskbar");
Current.Properties["systray"] = _systray;
}
protected override void OnExit(ExitEventArgs e)
{
2021-09-01 00:35:37 +00:00
_systray.Dispose();
_snapcast.LaunchOrExit(true);
_hotkeys.RemoveHotKeys();
base.OnExit(e);
}
}
}