Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi i am newbie of this .Net world so i am facing so many problem here is one of them,I want to resume my backgroundWorker after made it pause so how can i do it(In Windows Form) please help me.

Thanks in Advance..
Posted

Pause / Resume operations are realized with WaitHandles, e.g. the ManualResetEvent:

C#
ManualResetEvent continueEvent = new ManualResetEvent(true);

continueEvent.WaitOne(); //This should call the background thread every then and now

continueEvent.Reset(); //If this is called within an other thread, the thread will pause on continueEvent.WaitOne()

//until
continueEvent.Set() // is called


(Source[^], but please google yourself the next time)
 
Share this answer
 
If you need a working demo application you can find it here. The code can be downloaded from GitHub
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900