public void Toggle(Point approximateLocation) { var shouldCreateWindow = window == null; if (shouldCreateWindow) { window = CreateTimerWindow(); } if (window.Visible) { if (!IsPinned) { window.Hide(); } } else { Point location = GetLocationNearTrayIcon(approximateLocation); window.Show(location); if (shouldCreateWindow) { currentState.Apply(window, countdownClock.RemainingTime); } } }
public void Apply(TimerWindow window, Duration remainingTime) { if (window == null) { return; } window.UpdateTitle("Pomodoro Completed"); window.UpdateColorScheme(TimerWindow.DarkGray); window.UpdateTimeDisplay(Duration.Zero.ToTimeString()); window.SetTimerAction($"Start {pomodoroEngine.SuggestedBreakType.GetName()}", StartTimer); }
public void Apply(TimerWindow window, Duration remainingTime) { if (window == null) { return; } window.UpdateTitle(title); window.UpdateColorScheme(TimerWindow.DarkGray); window.UpdateTimeDisplay(remainingTime.ToTimeString()); window.SetTimerAction("Start Pomodoro", StartTimer); }
public void Apply(TimerWindow window, Duration remainingTime) { if (window == null) { return; } window.UpdateTitle("Long Break"); window.UpdateColorScheme(TimerWindow.Blue); window.UpdateTimeDisplay(remainingTime.ToTimeString()); window.SetTimerAction("Interrupt", pomodoroEngine.StopTimer); }
private TimerWindow CreateTimerWindow() { var window = new TimerWindow(); foreach (var control in window.Controls) { ((Control)control).LostFocus += OnLostFocus; } window.LostFocus += OnLostFocus; window.VisibleChanged += OnWindowVisibleChanged; window.PinButton.Click += OnPinButtonClick; window.CloseButton.Click += OnCloseButtonClick; new DragAroundController(window, () => IsPinned); return(window); }