/// <summary> /// Returns a new instance of the <see cref="TimerWindow"/> class for the parsed command-line arguments. /// </summary> /// <param name="arguments">Parsed command-line arguments.</param> /// <returns>A <see cref="TimerWindow"/>.</returns> private static TimerWindow GetTimerWindowFromArguments(CommandLineArguments arguments) { TimerWindow window = new TimerWindow(arguments.TimerStart); window.Options.Set(arguments.GetTimerOptions()); window.Restore(arguments.GetWindowSize(), RestoreOptions.AllowMinimized); return(window); }
/// <summary> /// Shows windows for all saved timers. /// </summary> /// <param name="arguments">Parsed command-line arguments.</param> private static void ShowSavedTimerWindows(CommandLineArguments arguments) { foreach (Timer savedTimer in TimerManager.Instance.ResumableTimers) { TimerWindow window = new TimerWindow(); if (savedTimer.Options.WindowSize != null) { window.Restore(savedTimer.Options.WindowSize, RestoreOptions.AllowMinimized); } else { window.Restore(arguments.GetWindowSize(), RestoreOptions.AllowMinimized); } window.Show(savedTimer); } }
/// <summary> /// Shows a new timer window. The window will run the <see cref="TimerStart"/> specified in the <see /// cref="CommandLineArguments"/>, or it will display in input mode if there is no <see cref="TimerStart"/>. /// </summary> /// <param name="arguments">Parsed command-line arguments.</param> private static void ShowNewTimerWindow(CommandLineArguments arguments) { TimerWindow window = new TimerWindow(arguments.TimerStart); window.Options.Set(arguments.GetTimerOptions()); window.Restore(arguments.GetWindowSize(), RestoreOptions.AllowMinimized); window.Show(); if (window.WindowState != WindowState.Minimized) { window.BringToFrontAndActivate(); } }
/// <summary> /// Shows an existing <see cref="Timer"/> in a new <see cref="TimerWindow"/>. /// </summary> /// <param name="savedTimer">An existing <see cref="Timer"/>.</param> private void ShowSavedTimerInNewWindow(Timer savedTimer) { TimerWindow newTimerWindow = new TimerWindow(); if (savedTimer.Options.WindowSize != null) { newTimerWindow.Restore(savedTimer.Options.WindowSize); } else { newTimerWindow.RestoreFromWindow(this.timerWindow); } newTimerWindow.Show(savedTimer); }