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);
            });
        }
Exemple #2
0
 public void SetUp()
 {
     userPreferences = Substitute.For <IUserPreferences>();
     timer           = Substitute.For <ITimer>();
     eventHub        = new FakeEventHub();
     engine          = new PomodoroEngine(timer, userPreferences, eventHub);
 }
Exemple #3
0
        public YapaTheme(IMainViewModel viewModel, YapaThemeSettings settings, IPomodoroEngine engine, ISettings globalSettings, IPomodoroRepository pomodoroRepository, PomodoroEngineSettings engineSettings) : base(viewModel)
        {
            ViewModel           = viewModel;
            Settings            = settings;
            _pomodoroRepository = pomodoroRepository;
            _engineSettings     = engineSettings;

            InitializeComponent();

            TimerFlush           = (Storyboard)TryFindResource("FlashTimer");
            AfterBreakTimerFlush = (Storyboard)TryFindResource("AfterBreakFlashTimer");

            PomodorosCompleted = 0;

            ViewModel.Engine.PropertyChanged     += Engine_PropertyChanged;
            ViewModel.Engine.OnPomodoroCompleted += Engine_OnPomodoroCompleted;
            ViewModel.Engine.OnStarted           += StopAnimation;
            ViewModel.Engine.OnStopped           += StopAnimation;
            globalSettings.PropertyChanged       += _globalSettings_PropertyChanged;

            DataContext = this;

            UpdateAppSize();
            PhaseChanged();
            UpdateStatusText();

            UpdateCompletedPomodoroCount();

            PropertyChanged += YapaTheme_PropertyChanged;
            UpdateDisplayedTime();
            UpdateSecondVisibility();
        }
        public PomodoroEngineSettingWindow(PomodoroEngineSettings settings, IPomodoroEngine engine, PomodoroProfileSettings profileSettings)
        {
            settings.DeferChanges();
            InitializeComponent();

            var counterValues = new List <CounterListItem>
            {
                new CounterListItem {
                    Item = CounterEnum.CompletedThisSession, Title = "Completed this session"
                },
                new CounterListItem {
                    Item = CounterEnum.CompletedToday, Title = "Competed today"
                },
                new CounterListItem {
                    Item = CounterEnum.PomodoroIndex, Title = "Pomodoro index"
                },
            };

            CounterList.ItemsSource = counterValues;

            Settings    = settings;
            Engine      = engine;
            DataContext = this;

            ProfileSetting.Children.Clear();
            ProfileSetting.Children.Add(profileSettings);
        }
 public NotificationsPresenter(IPomodoroEngine pomodoroEngine, IUserPreferences userPreferences, IEventHub eventHub)
 {
     this.pomodoroEngine  = pomodoroEngine;
     this.userPreferences = userPreferences;
     eventHub.Subscribe <TimerStopped>(OnTimerStopped);
     eventHub.Subscribe <AppUpdated>(OnAppUpdated);
     eventHub.Subscribe <FirstRun>(OnFirstRun);
 }
Exemple #6
0
        public Dashboard(IPomodoroEngine engine, IPomodoroRepository itemRepository, PomodoroEngineSettings engineSettings)
        {
            _itemRepository = itemRepository;
            _engineSettings = engineSettings;
            _engine         = engine;

            _engine.OnPomodoroCompleted += _engine_OnPomodoroCompleted;
        }
Exemple #7
0
        public MusicPlayer(IPomodoroEngine engine, MusicPlayerPluginSettings settings, IMusicPlayer musicPlayer, PomodoroEngineSettings engineSettings)
        {
            _engine         = engine;
            _settings       = settings;
            _musicPlayer    = musicPlayer;
            _engineSettings = engineSettings;

            _engine.PropertyChanged += _engine_PropertyChanged;
        }
        public SoundNotifications(IPomodoroEngine engine, SoundNotificationsSettings settings, IMusicPlayer musicPlayer, PomodoroEngineSettings engineSettings)
        {
            _engine         = engine;
            _settings       = settings;
            _musicPlayer    = musicPlayer;
            _engineSettings = engineSettings;

            _engine.PropertyChanged += _engine_PropertyChanged;
        }
Exemple #9
0
        public MainViewModel(IPomodoroEngine engine, IShowSettingsCommand showSettings)
        {
            Engine       = engine;
            StopCommand  = new StopCommand(Engine);
            StartCommand = new StartCommand(Engine);
            ResetCommand = new ResetCommand(Engine);
            PauseCommand = new PauseCommand(Engine);
            SkipCommand  = new SkipCommand(Engine);

            ShowSettingsCommand = showSettings;
        }
Exemple #10
0
        public UnclickablePlugin(IApplication app, IPomodoroEngine engine, UnclickableSettings settings, ISettings globalSettings)
        {
            _engine         = engine;
            _settings       = settings;
            _globalSettings = globalSettings;
            _window         = (Window)app;
            _app            = app;

            _engine.PropertyChanged += _engine_PropertyChanged;

            _window.Loaded += (sender, args) => SaveInitialStyle();

            _window.MouseEnter += _window_MouseEnter;
            _globalSettings.PropertyChanged += _globalSettings_PropertyChanged;;
        }
Exemple #11
0
        public TimerWindowPresenter(IPomodoroEngine pomodoroEngine, ICountdownClock countdownClock, IEventHub eventHub)
        {
            this.countdownClock = countdownClock;

            idleState                = new IdleState(pomodoroEngine);
            pomodoroState            = new PomodoroState(pomodoroEngine);
            shortBreakState          = new ShortBreakState(pomodoroEngine);
            longBreakState           = new LongBreakState(pomodoroEngine);
            pomodoroCompletedState   = new PomodoroCompletedState(pomodoroEngine);
            breakFinishedState       = new BreakFinishedState(pomodoroEngine);
            pomodoroInterruptedState = new TimerInterruptedState("Pomodoro Interrupted", pomodoroEngine);
            breakInterruptedState    = new TimerInterruptedState("Break Interrupted", pomodoroEngine);

            currentState = idleState;

            eventHub.Subscribe <TimerStarted>(OnTimerStarted);
            eventHub.Subscribe <TimeElapsed>(OnTimeElapsed);
            eventHub.Subscribe <TimerStopped>(OnTimerStopped);
        }
        public PomodoroProfileSettings(PomodoroEngineSettings settings, IPomodoroEngine engine)
        {
            settings.DeferChanges();

            InitializeComponent();

            var oneHour = Enumerable.Range(1, 60).Reverse().ToList();

            WorkTimeSelect.ItemsSource      = oneHour;
            BreakTimeSelect.ItemsSource     = oneHour;
            LongBreakTimeSelect.ItemsSource = oneHour;
            Settings = settings;
            Engine   = engine;

            Engine.PropertyChanged += Engine_PropertyChanged;

            Unloaded   += PomodoroProfileSettings_Unloaded;
            DataContext = this;
            ActiveProfileSelect.ItemsSource       = Profiles;
            ActiveProfileSelect.SelectionChanged += ActiveProfile_SelectectionChanged;
            RefreshProfilesList();
        }
Exemple #13
0
 public SkipCommand(IPomodoroEngine engine)
 {
     _engine = engine;
     _engine.PropertyChanged += _engine_PropertyChanged;
 }
Exemple #14
0
 public BreakFinishedState(IPomodoroEngine pomodoroEngine)
 {
     this.pomodoroEngine = pomodoroEngine;
 }
Exemple #15
0
 public TimerInterruptedState(string title, IPomodoroEngine pomodoroEngine)
 {
     this.title          = title;
     this.pomodoroEngine = pomodoroEngine;
 }
Exemple #16
0
 public PomodoroCompletedState(IPomodoroEngine pomodoroEngine)
 {
     this.pomodoroEngine = pomodoroEngine;
 }
Exemple #17
0
 public LongBreakState(IPomodoroEngine pomodoroEngine)
 {
     this.pomodoroEngine = pomodoroEngine;
 }
 public NotificationsPresenter(IPomodoroEngine pomodoroEngine, IEventHub eventHub)
 {
     this.pomodoroEngine = pomodoroEngine;
     eventHub.Subscribe <TimerStopped>(OnTimerStopped);
 }
Exemple #19
0
 public ShortBreakState(IPomodoroEngine pomodoroEngine)
 {
     this.pomodoroEngine = pomodoroEngine;
 }
Exemple #20
0
 public PomodoroState(IPomodoroEngine pomodoroEngine)
 {
     this.pomodoroEngine = pomodoroEngine;
 }