public static void Start() { if (!CevioSubscriber.IsRunning) { CevioSubscriber.Run(); } if (!Config.IsHideCevioWindow) { return; } lock (Locker) { if (trayWindow == null) { trayWindow = new CevioTrayWindow(); trayWindow.Show(); WPFHelper.CurrentApp.Exit += (_, __) => { RestoreWindow(); End(); }; WPFHelper.CurrentApp.DispatcherUnhandledException += (_, __) => { RestoreWindow(); End(); }; } } }
public static void End() { lock (Locker) { if (trayWindow != null) { trayWindow.CevioIcon.Visibility = Visibility.Collapsed; trayWindow.Close(); trayWindow = null; } } }