Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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 12-Apr-12 1:01am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Pause / Resume operations are realized with WaitHandles, e.g. the ManualResetEvent:
 
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)
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

If you need a working demo application you can find it here. The code can be downloaded from GitHub
  Permalink  

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



Advertise | Privacy | Mobile
Web04 | 2.8.1411022.1 | Last Updated 20 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100