private void UIDoneHandler(object sender, SilentWebUIDoneEventArgs e) { if (this.uiException == null) { this.uiException = e.TransferedException; } // We need call dispose, while message loop is running. // WM_QUIT message from ExitThread will delayed, if Dispose will create a set of new messages (we suspect that it happens). ((SilentWindowsFormsAuthenticationDialog)sender).Dispose(); Application.ExitThread(); }
/// <summary> /// This method must only be called from the UI thread. Since this is the /// callers opportunity to call dispose on this object. Calling /// Dispose must be done on the same thread on which this object /// was constructed. /// </summary> /// <param name="exception"></param> private void SignalDone(Exception exception = null) { if (!this.doneSignaled) { this.timer.Stop(); SilentWebUIDoneEventArgs args = new SilentWebUIDoneEventArgs(exception); if (null != this.Done) { this.Done(this, args); } this.doneSignaled = true; } }