title: Waiting for system to delete file
body: <p>I had a problem with refreshing file list after deleting a file. When I gave command to delete file, the exception was thrown because the refresh method tried to access a file that was supposed to be deleted.</p>
  
  <p>After some thought and debuging I came to conclusion that problem was in a fact that system needs some time to delete a file. And I solve it like this:</p>
  
  <pre><code>//Deleting file
  System.Threading.Thread.Sleep(2000);
  //Refreshing list
  </code></pre>
  
  <p>and it worked fine.</p>
  
  <p><strong>My question is</strong></p>
  
  <p>Is there a more elegant way to wait for system do delete file and then continue with code...?</p>