private void OnTimerStarted(TimerStarted @event) { menu.Update(mutator => { mutator.UpdateRemainingTime(@event.RemainingTime.ToTimeString()); mutator.EnableStartPomodoroItem(@event.IntervalType != IntervalType.Pomodoro); mutator.EnableStartShortBreakItem(@event.IntervalType != IntervalType.ShortBreak); mutator.EnableStartLongBreakItem(@event.IntervalType != IntervalType.LongBreak); mutator.EnableStopTimerItem(true); }); }
public TrayMenuController(ITrayMenu menu, ApplicationContext app, IPomodoroEngine pomodoroEngine, IEventHub eventHub) { this.menu = menu; this.app = app; this.pomodoroEngine = pomodoroEngine; menu.OnStartPomodoroClick(OnStartPomodoroClick); menu.OnStartLongBreakClick(OnStartLongBreakClick); menu.OnStartShortBreakClick(OnStartShortBreakClick); menu.OnStopTimerClick(OnStopTimerClick); menu.OnResetPomodoroCountClick(OnResetPomodoroCountClick); menu.OnExitClick(OnExitClick); eventHub.Subscribe <TimerStarted>(OnTimerStarted); eventHub.Subscribe <TimerStopped>(OnTimerStopped); eventHub.Subscribe <TimeElapsed>(OnTimeElasped); eventHub.Subscribe <PomodoroCountChanged>(OnPomodoroCountChanged); menu.Update(mutator => { mutator.UpdateRemainingTime(Duration.Zero.ToTimeString()); mutator.UpdatePomodoroCount(0); mutator.EnableStopTimerItem(false); }); }