private void StartTrayIcon() { TrayIconInstance = TrayIcon.Create(ProgramStatus); TrayIconInstance.OnTrayIconLeftClick += (sender, e) => { switch (ProgramStatus) { case Status.Automatic: ProgramStatus = Status.Off; break; case Status.Off: ProgramStatus = Status.Automatic; break; } }; TrayIconInstance.OnMenuItemExitClicked += (sender, e) => { StopRedshift(); Application.Current.Shutdown(0); }; TrayIconInstance.OnMenuItemLogClicked += (sender, e) => { debugConsole.ShowOrUnhide(); }; TrayIconInstance.OnMenuItemSettingsClicked += (sender, e) => { SettingsWindow settingsWindow; if (!Common.WindowExistsFocus(out settingsWindow)) { settingsWindow = new SettingsWindow(); if ((bool)settingsWindow.ShowDialog()) { LoadSettings(); if (ProgramStatus == Status.Automatic) { StartRedshiftAutomatic(); } } } }; }
public static TrayIcon Create(Status initialStatus) { TrayIconInstance = new TrayIcon(initialStatus); return TrayIconInstance; }
private void StartTrayIcon() { TrayIconInstance = TrayIcon.Create(ProgramStatus); TrayIconInstance.OnTrayIconLeftClick += (sender, e) => { switch(ProgramStatus) { case Status.Automatic: ProgramStatus = Status.Off; break; case Status.Off: ProgramStatus = Status.Automatic; break; } }; TrayIconInstance.OnMenuItemExitClicked += (sender, e) => { StopRedshift(); Application.Current.Shutdown(0); }; TrayIconInstance.OnMenuItemLogClicked += (sender, e) => { debugConsole.ShowOrUnhide(); }; TrayIconInstance.OnMenuItemSettingsClicked += (sender, e) => { SettingsWindow settingsWindow; if(!Common.WindowExistsFocus(out settingsWindow)) { settingsWindow = new SettingsWindow(); if((bool)settingsWindow.ShowDialog()) { LoadSettings(); if(ProgramStatus == Status.Automatic) { StartRedshiftAutomatic(); } } } }; }
public static TrayIcon Create(Status initialStatus) { TrayIconInstance = new TrayIcon(initialStatus); return(TrayIconInstance); }