Exemplo n.º 1
0
        private void TimerElapsed()
        {
            FormattedTime = timerUtil.GetFormattedLocationTime(DateTime.UtcNow);

            intervalTimer.Interval = timerUtil.GetMinuteUpdateInterval(DateTime.Now);
            intervalTimer.Start();
        }
        private void GetFormattedLocationTime_TestHelper(
            int offset,
            string formattedInputTime,
            string expectedFormattedResult)
        {
            ITimerUtility timerInTest = GetInitializedTimer(offset);

            var inputDateTime = DateTime.Parse(formattedInputTime);
            var formattedTime = timerInTest.GetFormattedLocationTime(inputDateTime);

            Assert.AreEqual(expectedFormattedResult, formattedTime);
        }
Exemplo n.º 3
0
        public Timer(ITimerUtility timerUtil)
        {
            this.timerUtil = timerUtil;

            FormattedTime = timerUtil.GetFormattedLocationTime(DateTime.UtcNow);

            intervalTimer = new DispatcherTimer(
                timerUtil.GetMinuteUpdateInterval(DateTime.Now),
                DispatcherPriority.Normal,
                delegate { TimerElapsed(); },
                Dispatcher.CurrentDispatcher);
        }