コード例 #1
0
 private void Start(TimerDuration timerDuration)
 {
     if (_dispatcherTimer == null)
     {
         // create new dispatcher and start it
         _dispatcherTimer          = new System.Windows.Threading.DispatcherTimer();
         _dispatcherTimer.Tick    += DispatcherTimer_Tick;
         _dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
         _dispatcherTimer.Start();
     }
 }
コード例 #2
0
        public TimerDuration Start(TimeSpan duration)
        {
            // set new duration
            _timerDuration = new TimerDuration {
                Duration = duration, Readonly = true
            };

            // start the timer
            Start(_timerDuration);

            // return the duration
            return(_timerDuration);
        }