Exemplo n.º 1
0
        protected override void TimerTick()
        {
            //Inside timer
            if (!base.IsRunning)
            {
                return;
            }

            //not exact but good enough for this app
            Left -= base.Interval;

            if (Left <= TimeSpan.Zero)
            {
                base.StopClock();
                Left = TimeSpan.Zero;

                _primaryBtnMode = PrimaryButtonMode.Stopped;
                OnFinished(new UiUpdatedEventArgs {
                    Time = Left, PrimaryBtn = _primaryBtnMode
                });
            }
            else
            {
                OnTickHappened(new UiUpdatedEventArgs()
                {
                    Time = Left
                });
            }
        }
Exemplo n.º 2
0
        public void Pause()
        {
            if (base.IsRunning)
            {
                base.StopClock();

                _primaryBtnMode = PrimaryButtonMode.Stopped;
                OnUiUpdated(new UiUpdatedEventArgs()
                {
                    PrimaryBtn = _primaryBtnMode
                });
            }
        }
Exemplo n.º 3
0
        public void NewStart(string textTime)
        {
            //this always forces a new start
            if (base.IsRunning)
            {
                base.StopClock();
            }
            Left          = textTime.GetTimeSpan(_config.TimeFormat, _config.TimeFormatNoSymbols, _config.DetectSymbolInFormat, _config.FillCharInTimeFormat);
            _originalLeft = Left;
            base.StartClock();

            _primaryBtnMode = PrimaryButtonMode.Running;
            OnUiUpdated(new UiUpdatedEventArgs()
            {
                PrimaryBtn = _primaryBtnMode, Time = Left
            });
        }
Exemplo n.º 4
0
 public TimerClock(IConfigurationValues config, ILogger logger, IDispatcherTimer timer) : base(logger, config, timer)
 {
     _config         = config;
     _primaryBtnMode = PrimaryButtonMode.Stopped;
 }