I try to schedule a job to run every 30 mins, as follows:
---
System.Threading.AutoResetEvent autoEvent = new AutoResetEvent(false);
StatusChecker statusChecker = new StatusChecker();
System.Threading.TimerCallback timerDelegate = new TimerCallback(statusChecker.CheckStatus);
System.Threading.Timer stateTimer = new System.Threading.Timer(timerDelegate, autoEvent, TimeSpan.FromSeconds(1), TimeSpan.FromMinutes(1));
---
where CheckStatus is a public procedure in the StatusChecker class, declared as follows:
public class StatusChecker {
public StatusChecker() {...}
public void CheckStatus(object stateInfo) {...}
}
The timer runs only 1 time when the program is first executed, but not recurring every 30 mins after that. Does anybody know how to fix this?
Thanks.
---
System.Threading.AutoResetEvent autoEvent = new AutoResetEvent(false);
StatusChecker statusChecker = new StatusChecker();
System.Threading.TimerCallback timerDelegate = new TimerCallback(statusChecker.CheckStatus);
System.Threading.Timer stateTimer = new System.Threading.Timer(timerDelegate, autoEvent, TimeSpan.FromSeconds(1), TimeSpan.FromMinutes(1));
---
where CheckStatus is a public procedure in the StatusChecker class, declared as follows:
public class StatusChecker {
public StatusChecker() {...}
public void CheckStatus(object stateInfo) {...}
}
The timer runs only 1 time when the program is first executed, but not recurring every 30 mins after that. Does anybody know how to fix this?
Thanks.