private bool CheckSettings() { Redshift.ExecutableError exeError = Redshift.CheckExecutable(RedshiftPath); if (exeError == Redshift.ExecutableError.Ok) { return(true); } SettingsWindow settingsWindow; if (Common.WindowExistsFocus(out settingsWindow)) { return(true); } settingsWindow = new SettingsWindow(); if (!(bool)settingsWindow.ShowDialog()) { return(false); } LoadSettings(); return(true); }
public SettingsWindow(Redshift.ExecutableError initialRedshiftErrorNote) { InitializeComponent(); LoadPosition(); LoadConfig(); ExecutableErrorState = initialRedshiftErrorNote; }
public SettingsWindow() { InitializeComponent(); LoadPosition(); LoadConfig(); ExecutableErrorState = Redshift.CheckExecutable(RedshiftPath.Text); SetOkButtonEnabled(); }
public static string StartAndWaitForOutput(string path, params string[] Args) { Redshift redshift = new Redshift(path, Args); redshift.Start(); redshift.RedshiftProcess.WaitForExit(); return(redshift.GetStandardOutput()); }
public bool Initialize() { LoadSettings(); if (!CheckSettings()) { return(false); } Redshift.KillAllRunningInstances(); ProgramStatus = Settings.RedshiftEnabledOnStart ? Status.Automatic : Status.Off; StartTrayIcon(); return(true); }
private static Redshift InitializeContinuousStart(string path, params string[] Args) { if (CheckExecutable(path) != ExecutableError.Ok) { throw new Exception("Invalid redshift start."); } if (Instance != null && !Instance.RedshiftProcess.HasExited) { Instance.RedshiftProcess.Exited -= Instance.RedshiftProcess_Crashed; Instance.RedshiftProcess.Kill(); Instance.RedshiftQuit(true); } Instance = new Redshift(path, Args); return(Instance); }
private void ButtonRedshift_Click(object sender, RoutedEventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog { Title = "Redshift path", Filter = "Redshift|redshift.exe|All executables|*.exe", CheckFileExists = true }; if (File.Exists(RedshiftPath.Text)) { openFileDialog.InitialDirectory = Path.GetDirectoryName(RedshiftPath.Text); } if ((bool)openFileDialog.ShowDialog()) { Settings.Default.RedshiftAppPath = openFileDialog.FileName; ExecutableErrorState = Redshift.CheckExecutable(RedshiftPath.Text); } }
private void redshiftPath_LostFocus(object sender, RoutedEventArgs e) { ExecutableErrorState = Redshift.CheckExecutable(RedshiftPath.Text); }
private void StartRedshiftAutomatic() { string[] args = Redshift.GetArgsBySettings(DummyMethod); RedshiftInstance = Redshift.StartContinuous(RedshiftPath, RedshiftInstance_OnRedshiftQuit, args); }
private static Redshift InitializeContinuousStart(string path, params string[] Args) { if(CheckExecutable(path) != ExecutableError.Ok) throw new Exception("Invalid redshift start."); if(Instance != null && !Instance.RedshiftProcess.HasExited) { Instance.RedshiftProcess.Exited -= Instance.RedshiftProcess_Crashed; Instance.RedshiftProcess.Kill(); Instance.RedshiftQuit(true); } Instance = new Redshift(path, Args); return Instance; }
public static string StartAndWaitForOutput(string path, params string[] Args) { Redshift redshift = new Redshift(path, Args); redshift.Start(); redshift.RedshiftProcess.WaitForExit(); return redshift.GetStandardOutput(); }
private void ResetScreen() { string[] args = { $"-m {(DummyMethod ? Redshift.METHOD_DUMMY : Redshift.METHOD_WINGDI)}", "-x" }; Redshift.StartAndWaitForOutput(RedshiftPath, args); }