Close WPF dialog without user interaction
<p>I would like to show dialog during some IO operations and after it, close the dialog with code.
Something like:</p>

<pre><code>DialogWindow dialog = new DialogWindow();
dialog.ShowDialog();
.... do some file operation....
dialog.Close();
</code></pre>

<p>but dialog won't close. I have to close it by myself. Is here way how to close it with code? </p>