title: Show progress only if a background operation is long
body: <p>I'm developing a C# operation and I would like to show a modal progress dialog, but only when an operation will be long (for example, more than 3 seconds). I execute my operations in a background thread.</p>
  
  <p>The problem is that I don't know in advance whether the operation will be long or short.</p>
  
  <p>Some software as <a href="http://www.jetbrains.com/idea/" rel="nofollow noreferrer">IntelliJ</a> has a timer aproach. If the operation takes more than x time, then show a dialog then.</p>
  
  <p>What do you think that is a good pattern to implement this?</p>
  
  <ul>
  <li>Wait the UI thread with a timer, and show dialog there?</li>
  <li>Must I <code>DoEvents()</code> when I show the dialog?</li>
  </ul>