You cannot pause/resume WPF application; it simply makes no sense. You can pause/resume operation of some thread in a controlled manner. To do so, you can use the class
System.Threading.ManualResetEvent
:
http://msdn.microsoft.com/en-us/library/system.threading.manualresetevent.aspx[
^].
A thread in question should be put to a wait state at its call to the method
WaitOne
:
http://msdn.microsoft.com/en-us/library/58195swd.aspx[
^].
If the instance of the
ManualResetEvent
is non-signaled, the thread will be switched off and not scheduled back to execution until awaken, which can happen on different conditions (such as timeout or
Thread.Abort
), but, most essentially, it happens when the instance of the
ManualResetEvent
is made signaled by some other thread (typically, a UI thread). This way, you can throttle execution of some thread by other thread(s) by putting it to a wait state in certain points of code. Note that the thread in a wait state uses zero CPU time, so this is not a wasteful spin wait.
—SA