unison/App.xaml.cs

51 lines
1.4 KiB
C#

using System.Globalization;
using System.Windows;
using Hardcodet.Wpf.TaskbarNotification;
namespace unison
{
public partial class App : Application
{
private TaskbarIcon _systray;
private HotkeyHandler _hotkeys;
private SnapcastHandler _snapcast;
private ShuffleHandler _shuffle;
private MPDHandler _mpd;
protected override void OnStartup(StartupEventArgs e)
{
//debug language
//unison.Resources.Resources.Culture = CultureInfo.GetCultureInfo("fr-FR");
//unison.Resources.Resources.Culture = CultureInfo.GetCultureInfo("es-ES");
base.OnStartup(e);
_mpd = new MPDHandler();
Current.Properties["mpd"] = _mpd;
_hotkeys = new HotkeyHandler();
Current.Properties["hotkeys"] = _hotkeys;
_snapcast = new SnapcastHandler();
Current.Properties["snapcast"] = _snapcast;
_shuffle = new ShuffleHandler();
Current.Properties["shuffle"] = _shuffle;
Current.MainWindow = new MainWindow();
_systray = (TaskbarIcon)FindResource("SystrayTaskbar");
Current.Properties["systray"] = _systray;
}
protected override void OnExit(ExitEventArgs e)
{
_systray.Dispose();
_snapcast.LaunchOrExit(true);
_hotkeys.RemoveHotkeys();
base.OnExit(e);
}
}
}