C# Timers

  • Thread starter Thread starter matt chuningham via .NET 247
  • Start date Start date
M

matt chuningham via .NET 247

Hi there..I have a troublesome problem. I have a class, that isprocessing a specific task. At any specific moment a customevent is fired so that I could view the info generated in theinterface. Now, I need some sort of mechanism that would haltthe whole thing for 2 seconds and after resumes normally. Itried out Thread.Sleep(2000) but it failed, I used a timer withthe tick event but no halting took place! Can any body help outplease?
 
howdy,
guess ur talking about window forms timer!?
if so doing a sleep in the handler function will block ur gui,
so best option is to have second timer (resumetimer)

so do something like

maintimer_ontick(..)
{
... do stuff
maintimer.stop(); // or maintimer.eneabled = false;
resumetimer.start();
}


resumetimer_ontick(...)
{
maintimer.start();
resumetimer.stop();
}
 
Back
Top