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(); }
protected override void OnExit(ExitEventArgs e) { InputSimulator.ReleaseAllKeys(); GlobalMouseHook.Dispose(); NotificationIcon.Dispose(); }
public void Disable() { MainPanel.Visibility = Visibility.Hidden; GlobalMouseHook.Disable(); }