unison/App.xaml.cs

56 lines
1.7 KiB
C#
Raw Permalink Normal View History

2022-11-06 14:44:53 +00:00
using System.Windows;
using Hardcodet.Wpf.TaskbarNotification;
2022-11-06 14:44:53 +00:00
using unison.Handlers;
namespace unison
{
public partial class App : Application
{
2021-09-01 00:35:37 +00:00
private TaskbarIcon _systray;
private HotkeyHandler _hotkeys;
private SnapcastHandler _snapcast;
2022-11-13 14:58:30 +00:00
private ShuffleHandler _shuffle;
2021-09-01 00:35:37 +00:00
private MPDHandler _mpd;
2022-11-06 14:44:53 +00:00
private UpdateHandler _updater;
protected override void OnStartup(StartupEventArgs e)
{
2022-11-14 22:53:36 +00:00
unison.Resources.Resources.Culture = System.Globalization.CultureInfo.CurrentCulture;
//debug language
2022-11-06 14:44:53 +00:00
//unison.Resources.Resources.Culture = System.Globalization.CultureInfo.GetCultureInfo("fr-FR");
//unison.Resources.Resources.Culture = System.Globalization.CultureInfo.GetCultureInfo("es-ES");
2022-04-13 12:07:09 +00:00
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;
2022-11-13 14:58:30 +00:00
_shuffle = new ShuffleHandler();
Current.Properties["shuffle"] = _shuffle;
2022-11-06 14:44:53 +00:00
_updater = new UpdateHandler();
Current.Properties["updater"] = _updater;
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);
}
}
}