Esempio n. 1
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. 2
0
 public static TrayIcon Create(Status initialStatus)
 {
     TrayIconInstance = new TrayIcon(initialStatus);
       return TrayIconInstance;
 }
Esempio n. 3
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. 4
0
 public static TrayIcon Create(Status initialStatus)
 {
     TrayIconInstance = new TrayIcon(initialStatus);
     return(TrayIconInstance);
 }