title: C# how to efficiently wait x seconds
body: <p>My algorithm automatically fills metadata in a specific website (using webBrowser). After fill metadata the algorithm press the button send (in website) and it must wait a few seconds for metadata to be analyzed before contiune (this is not part of algorithm, but webpage). The problem is that i have no way to know when metadata analsys finish. I try the next code, which is used to wait for fully loaded webpage before continuing with the processes:</p>
  
  <pre><code>webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser1_DocumentCompleted);
  </code></pre>
  
  <p>But it's useless becuse metadata analysis is not related to webpage loading.</p>
  
  <p>So, because metadata analysis takes about 20-40 seconds i think that wait about 60 seconds and continue is a good solution. I try:</p>
  
  <pre><code>System.Threading.Thread.Sleep(60000);
  </code></pre>
  
  <p>After programmatically press button "send", but for anyreason this wait for 60 seconds before button is pressed.</p>