This is some code I grabbed off of the Internet that I've modified a little thus far, but what I am having issues with is setting the statusIs to the TimerCallback. I don't know if thats because of my CheckStatus module or what. I haven't modified the CheckStatus module much from where it was, just the type returned and the return of course. Needless to say TimerCallback can not convert statusIs(AutoRestEvent type).
AutoResetEvent autoEvent = new AutoResetEvent(false);
var statusChecker = StatChecker(10);
var statusIs = CheckStatus(statusChecker);
TimerCallback tcb = Convert.ChangeType(statusIs, TimerCallback, GetFormat); // here is the issue or could be
Timer stateTimer = new Timer(tcb, autoEvent, 1000, 250);
autoEvent.WaitOne(5000,false);
stateTimer.Change(0, 500);
false);
public int StatChecker(int count)
{
invokeCount = 0;
maxCount = count;
}
Console.WriteLine("\n" + DateTime.Now.ToString("h:mm:ss.fff") + " - Checking status: " + (++invokeCount).ToString() + "/n");
if(invokeCount == maxCount)
// Reset the counter and signal Main.
autoEvent.Set();
return autoEvent;