コード例 #1
0
        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);
                }
            }
        }
コード例 #2
0
            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);
            }
コード例 #3
0
            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);
            }
コード例 #4
0
            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);
            }
コード例 #5
0
        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);
        }