Console Application.DoEvents() SOLVED!! example

yes i also got crazy about how to impersonate the glorious WinForms Application.DoEvents(), since if u do Thread.Sleep() the whole app stops!
it then came to mind its so simple:
//the condition is the events that u want to see done, u must oversee them, check
while (!AllThreadsFinished)
     //here is where DoEvents+Sleep u usualy go
     Thread waitThread = new Thread(() => WaitThread(100));
OH! extremely recommended to declare waitThread before the while and null it after else thing might get slow...
void WaitThread(int mls)

P.S. - if u use classes with forms for some stuff like browser navigation u dont have a choise but using the winforms ref and use the DoEvents().


Popular posts from this blog

c# Service Play Sound with NAudio example by Moshe

SOLVED The item could not be indexed successfully because the item failed in the indexing subsystem

JS/JQ simulate Enter event