public void ThrowAsyncException(Exception e)
 {
     // check to see if we're on the UI thread
     if (!_control.InvokeRequired)
     {
         throw new Exception("Asynchronous loading failed", e);
     }
     // otherwise send async message from worker thread
     else
     {
         AsyncExceptionDelegate dlg = new AsyncExceptionDelegate(ThrowAsyncException);
         _control.BeginInvoke(dlg, new object[1] {
             e
         });
     }
 }
 /// <summary>
 /// The constructor that all classes creating an instance of this must use.  This class should
 /// only be used for handling asynchronous message calls.
 /// </summary>
 /// <param name="next">
 /// The next sink in the sink chain.
 /// </param>
 /// <param name="aed">
 /// The delegate that will be called when an async call returns.
 /// </param>
 public AsyncExceptionContextSink(IMessageSink next, AsyncExceptionDelegate aed)
 {
     _NextSink = next;
     _Delegate = aed;
 }