/// <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 (!doneSignaled) { timer.Stop(); SilentWebUIDoneEventArgs args = new SilentWebUIDoneEventArgs(exception); Done?.Invoke(this, args); doneSignaled = true; } }
private void UIDoneHandler(object sender, SilentWebUIDoneEventArgs e) { if (uiException == null) { 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(); }