Example #1
0
        /// <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;
            }

#pragma warning disable 618 // SilentWindowsFormsAuthenticationDialog is marked obsolete

            // 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();

#pragma warning restore 618
        }