Пример #1
0
 /// <summary>
 /// Sets the state of the window.
 /// </summary>
 /// <param name="state">The state.</param>
 /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
 public virtual bool SetWindowState(IWindowState state)
 {
     lock (dbLock)
     {
         Database.WindowState = Mapper.Map <IWindowState>(state);
         return(true);
     }
 }
Пример #2
0
 private void EnterState(IWindowState newState, Duration remainingTime)
 {
     if (newState != currentState)
     {
         currentState = newState;
         currentState.Apply(window, remainingTime);
     }
 }
Пример #3
0
 /// <summary>
 /// Sets the state of the window.
 /// </summary>
 /// <param name="state">The state.</param>
 /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
 public virtual bool SetWindowState(IWindowState state)
 {
     lock (dbLock)
     {
         var data = Mapper.Map <IWindowState>(state);
         if (IsDifferent(data, Database.WindowState))
         {
             Database.WindowState = data;
         }
         return(true);
     }
 }
Пример #4
0
        public WindowStateManager(Form form, IWindowState windowStateStore)
        {
            if (form == null)
            {
                throw new ArgumentNullException(nameof(form));
            }
            this.form = form;

            if (windowStateStore == null)
            {
                throw new ArgumentNullException(nameof(windowStateStore));
            }
            this.windowStateStore = windowStateStore;

            AddEventHandlers();
        }
Пример #5
0
        public WindowStateManager(Form form, IWindowState windowStateStore)
        {
            if (form == null)
            {
                throw new ArgumentNullException(nameof(form));
            }
            this.form = form;

            if (windowStateStore == null)
            {
                throw new ArgumentNullException(nameof(windowStateStore));
            }
            this.windowStateStore = windowStateStore;

            AddEventHandlers();
        }
Пример #6
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 WindowContext(IWindowState windowState)
 {
     WindowState = windowState;
 }
Пример #8
0
 private void ActiveWindowState_WindowStateChanged(WindowStateChangedEventArgs args)
 {
     activeWindowState = args.NewWindowState;
     activeWindowState.Initialize();
     activeWindowState.WindowStateChanged += ActiveWindowState_WindowStateChanged;
 }
Пример #9
0
 public WindowManager(TextRenderer textRenderer)
 {
     activeWindowState = new EmulatorSelectionWindowState(textRenderer);
     activeWindowState.WindowStateChanged += ActiveWindowState_WindowStateChanged;
 }
Пример #10
0
 /// <summary>
 /// Saves the specified state.
 /// </summary>
 /// <param name="state">The state.</param>
 /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
 public virtual bool Save(IWindowState state)
 {
     return(StorageProvider.SetWindowState(state));
 }