title: Detect if control was disposed
body: <p>In my application I have a user control that do async operations using thread pool. 
  The thread pool method looks like: </p>
  
  <pre><code>private void AsyncFunction(object state)
      {
          ... do the calculation
          //refresh the grid data on the UI thread
          this.BeginInvoke(new MethodInvoker(() =&gt;
                                                 {
                            ... update the ui 
                                                 }));
      }
  </code></pre>
  
  <p>My problem is that if the user closes the dialog ... the user control gets disposed and I get the exception: </p>
  
  <p><strong>Invoke or BeginInvoke cannot be called on a control until the window handle has been created.</strong></p>
  
  <p>Do you know a way to detect if the dialog was disposed? I don't want to hae a property on control that the dialog set when closed.
  Is there another way of solving this?</p>
  
  <p>Thanks, </p>
  
  <p>Radu</p>