Esempio n. 1
0
        private void RedshiftInstance_OnRedshiftQuit(object sender, RedshiftQuitArgs e)
        {
            if(!e.ManualKill)
              {
            Application.Current.Dispatcher.Invoke(() =>
            {
              MessageBox.Show(string.Format("Redshift crashed with the following output:{0}{0}{1}", Environment.NewLine, e.ErrorOutput), "Redshift Tray", MessageBoxButton.OK, MessageBoxImage.Error);

              SettingsWindow settingsWindow;
              if(!Common.WindowExistsFocus(out settingsWindow))
              {
            settingsWindow = new SettingsWindow();
            if((bool)settingsWindow.ShowDialog())
            {
              LoadSettings();
              StartRedshiftAutomatic();
            }
            else
            {
              Application.Current.Shutdown(-1);
            }
              }
            });
              }
        }
Esempio n. 2
0
        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();
              }
            }
              }
            };
        }
Esempio n. 3
0
        private bool CheckSettings()
        {
            Redshift.ExecutableError exeError = Redshift.CheckExecutable(RedshiftPath);

              if(exeError != Redshift.ExecutableError.Ok)
              {
            SettingsWindow settingsWindow;
            if(!Common.WindowExistsFocus(out settingsWindow))
            {
              settingsWindow = new SettingsWindow();
              if((bool)settingsWindow.ShowDialog())
              {
            LoadSettings();
            return true;
              }
              return false;
            }
              }
              return true;
        }