title: C#: Showing a modal progress dialog during a long process
body: <p>My software requires to store the directory and registry structure for some particular locations. This usually takes a long time. Let's say I have a method called <code>SaveState()</code> which does that.</p>
  
  <p>I want to wrap this into another method, <code>SaveStateWithProgress()</code>, so that when I call it, a modal dialog appears, which shows a simple progress bar and has a button to cancel the operation. The way I see it I may need to use two threads, although in VB6 or Java I used to get by with the equivalent of <code>Thread.Yield()</code> command - not sure if it is the best practice, and even if there is something similar in C#. What is the best way to go about it?</p>