private System.Windows.Forms.Keys HotkeyKey = System.Windows.Forms.Keys.K; //TODO: Config #endregion Fields & Properties internal SleeperContext() { Logger.LogInfo("App starting."); if (PcManager.IsAppAlreadyRunning()) { return; } PcManager.TryToInstallThisApp(); _sleepChecker = new SleepChecker(); _wakeUpChecker = new WakeUpChecker(DisplayNotification, ChangeTrayIcon); InitializeTrayIcon(); InitializeHotKeyHook(); }
public new void Dispose() { Logger.LogInfo("App closing."); _sleepChecker.DisposeOfSleepChecker(); _sleepChecker = null; _wakeUpChecker.DisposeOfWakeUpChecker(); _wakeUpChecker = null; HotKeyHook.KeyPressed -= new EventHandler <KeyPressedEventArgs>(Hook_KeyPressed); HotKeyHook.Dispose(); TrayIcon.BalloonTipClicked -= new EventHandler(WindowsNotificationClicked); TrayIcon.Visible = false; TrayIcon.Dispose(); base.Dispose(); }