dueTime Type: System..::.TimeSpan A TimeSpan representing the amount of time to delay before invoking the callback method specified when the Timer was constructed. Specify negative one (-1) milliseconds to prevent the timer from restarting. Specify zero (0) to restart the timer immediately. period Type: System..::.TimeSpan The time interval between invocations of the callback method specified when the Timer was constructed. Specify negative one (-1) milliseconds to disable periodic signaling.>Hi All,
>// Call the set timer to stop it. the TimeSpan seems to get created OK, but the timer.Change() fails because of the infinite value. >this.SetTimer(tmrValidator, Timeout.Infinite, 60, null); > >private void SetTimer(System.Threading.Timer timer, int delaySeconds, int intervalSeconds, TimerCallback callback) >{ > TimeSpan delayTime = new TimeSpan(0, 0, delaySeconds); > TimeSpan intervalTime = new TimeSpan(0, 0, intervalSeconds); > > if (timer == null) > { > using (AutoResetEvent autoEvent = new AutoResetEvent(true)) > { > > if (callback == null) > callback = new TimerCallback(this.OnBlankTimerEvent); > > timer = new System.Threading.Timer(callback, autoEvent, > delayTime, intervalTime); > } > } > else // Reset Timer > { > timer.Change(delayTime, intervalTime); > } >} >