Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The BackgroundWorker provides a convenient way to run background threads while allowing for progress to be reported easily using .NET events. You would hook up your ProgressBar UI update to the ProgressChanged event handler, and completion is reported back to you through RunWorkerCompleted. If you only have a single background thread, this is much simpler than rolling your own thread handling code. Here's the MSDN article:</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx</a></p> <p>If you're stuck with using regular threads, then I'd consider using Join to wait for the thread to complete. This keeps processing normal messages and saves you polling in a tight loop. There's more information here:</p> <p><a href="http://msdn.microsoft.com/en-us/library/95hbf2ta.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/95hbf2ta.aspx</a></p> <p>In addition, there are overloads that take a timeout parameter (either an Int32 for milliseconds or a TimeSpan object). If the thread has not completed after this time has elapsed, an exception is thrown. This helps catch threads which are stuck while you're trying to shutdown. More here:</p> <p><a href="http://msdn.microsoft.com/en-us/library/6b1kkss0.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/6b1kkss0.aspx</a></p> <p>I hope this helps.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload