protected override void OnStartup(StartupEventArgs ev) { base.OnStartup(ev); // Only exit application when on explicit endpoint Current.ShutdownMode = ShutdownMode.OnExplicitShutdown; // Ensure app data directory Directory.CreateDirectory(AppDataDir); Directory.CreateDirectory(FontDir); // Initialize basic stuff GlobalMouseHook = new GlobalMouseHook(); InputSimulator = new InputSimulatorHelper(); Config = new Config(); ErrorLogger = new ErrorLogger(ErrorFilePath, MaxErrorLogSize, ErrorLogTrimLineCount); UpdateChecker = new UpdateChecker(ReleaseApi); NotificationIcon = new NotificationIcon(); // Setup Updater UpdateChecker.OnUpdateAvailable += UpdateChecker_OnUpdateAvailable; Config.LoadState(); LoadSavedLayout(true); MainWindow = new MainPanel(); MainWindow.Show(); CheckForUpdates(); }
public void ShowToast(string body, string title, EventHandler clickHandler = null) { var toast = new NotificationToast { Title = title, Body = body, SecondaryCloseDelayTime = NotificationToastSecondaryCloseDelayTime }; if (clickHandler != null) { toast.Click += clickHandler; } NotificationIcon.ShowCustomBalloon(toast, PopupAnimation.Fade, NotificationToastCloseDelayTime); }
protected override void OnExit(ExitEventArgs e) { InputSimulator.ReleaseAllKeys(); GlobalMouseHook.Dispose(); NotificationIcon.Dispose(); }