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(); } }
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); }