Пример #1
0
        /// <summary>
        ///
        /// </summary>
        protected virtual void WebBrowserNavigateErrorHandler(object sender, WebBrowserNavigateErrorEventArgs e)
        {
            // e.StatusCode - Contains error code which we are able to translate this error to text
            // ADAL.Native contains a code for translation.

            if (this.webBrowser.IsDisposed)
            {
                // we cancel all flow in disposed object.
                e.Cancel = true;
                return;
            }

            if (this.webBrowser.ActiveXInstance != e.WebBrowserActiveXInstance)
            {
                // this event came from internal frame, ignore this.
                return;
            }

            if (e.StatusCode >= 300 && e.StatusCode < 400)
            {
                // we could get redirect flows here as well.
                return;
            }

            e.Cancel = true;
            this.StopWebBrowser();
            // in this handler object could be already disposed, so it should be the last method
            this.OnNavigationCanceled(e.StatusCode);
        }
 protected virtual void OnNavigateError(WebBrowserNavigateErrorEventArgs e)
 {
     if (NavigateError != null)
     {
         this.NavigateError(this, e);
     }
 }
            public void NavigateError(object pDisp, ref object url, ref object frame, ref object statusCode, ref bool cancel)
            {
                string uriString     = (url == null) ? "" : ((string)url);
                string frameString   = (frame == null) ? "" : ((string)frame);
                int    statusCodeInt = (statusCode == null)? 0 : ((int)statusCode);

                WebBrowserNavigateErrorEventArgs e = new WebBrowserNavigateErrorEventArgs(uriString, frameString, statusCodeInt, pDisp);

                this.parent.OnNavigateError(e);
                cancel = e.Cancel;
            }