Example #1
0
        public AppController(Pomodo7oWindow window, IEnumerable <IPomodoroPublisher> publishers)
        {
            _window             = window;
            _window.Play       += Start;
            _window.Reset      += Reset;
            _window.Pause      += Pause;
            _window.GoToWork   += GoToWork;
            _window.TakeABreak += TakeABreak;
            _window.Loaded     += (s, e) => GoToWork();

            _publishers = publishers;

            _workTimer = new TomatoTimer(25.Minutes());
            _restTimer = new TomatoTimer(5.Minutes());

            _workTimer.TickPct       += pct => Notify(x => x.WorkPercent(pct));
            _workTimer.TickRemaining += rmn => Notify(x => x.WorkTimeLeft(rmn));
            _workTimer.Complete      += () =>
            {
                Notify(x => x.WorkComplete());
                TakeABreak();
            };

            _restTimer.TickPct       += pct => Notify(x => x.RestPercent(pct));
            _restTimer.TickRemaining += rmn => Notify(x => x.RestTimeLeft(rmn));
            _restTimer.Complete      += () =>
            {
                Notify(x => x.RestComplete());
                GoToWork();
            };
        }
Example #2
0
        public AppController(Pomodo7oWindow window, IEnumerable<IPomodoroPublisher> publishers)
        {
            _window = window;
            _window.Play += Start;
            _window.Reset += Reset;
            _window.Pause += Pause;
            _window.GoToWork += GoToWork;
            _window.TakeABreak += TakeABreak;
            _window.Loaded += (s, e) => GoToWork();

            _publishers = publishers;

            _workTimer = new TomatoTimer(25.Minutes());
            _restTimer = new TomatoTimer(5.Minutes());

            _workTimer.TickPct += pct => Notify(x => x.WorkPercent(pct));
            _workTimer.TickRemaining += rmn => Notify(x => x.WorkTimeLeft(rmn));
            _workTimer.Complete += () =>
                                      {
                                          Notify(x => x.WorkComplete());
                                          TakeABreak();
                                      };

            _restTimer.TickPct += pct => Notify(x => x.RestPercent(pct));
            _restTimer.TickRemaining += rmn => Notify(x => x.RestTimeLeft(rmn));
            _restTimer.Complete += () =>
                                      {
                                          Notify(x => x.RestComplete());
                                          GoToWork();
                                      };
        }
Example #3
0
 private void StartAndNotify(TomatoTimer timerToStart, Action <IPomodoroPublisher> ofAction)
 {
     if (_currentTimer != null)
     {
         _currentTimer.Stop();
     }
     _currentTimer = timerToStart;
     Start();
     Notify(ofAction);
 }
Example #4
0
 private void StartAndNotify(TomatoTimer timerToStart, Action<IPomodoroPublisher> ofAction)
 {
     if(_currentTimer != null)
         _currentTimer.Stop();
     _currentTimer = timerToStart;
     Start();
     Notify(ofAction);
 }