Пример #1
0
        private void frameLoadDelegate_DidStartProvisionalLoadForFrame(WebView WebView, IWebFrame frame)
        { 
            if (frame == webView.mainFrame())
            {
                string url = frame.provisionalDataSource().request().url();
                if (!string.IsNullOrEmpty(url))
                {
                    BackgroundWorker bw = new BackgroundWorker();
                    bw.RunWorkerCompleted += delegate (object s, RunWorkerCompletedEventArgs e) { if (e.Result != null && e.Result.GetType().Equals(typeof(WebException)))
                    {
                        HTTPErrorOccured(this, new HTTPErrorEventArgs() { WebException = (WebException)e.Result });
                    }};

                    bw.DoWork += new DoWorkEventHandler(bw_DoWork);
                    
                    HeadersAvailableEventArgs h = new HeadersAvailableEventArgs(new Uri(frame.provisionalDataSource().request().url()), frame.provisionalDataSource().request());
                    bw.RunWorkerAsync(h);
                    string Url = h.Url.ToString();
                    

                    if (resourceIntercepter != null)
                        resourceIntercepter.Resources.Clear();
                    WebKitBrowserNavigatingEventArgs args = new WebKitBrowserNavigatingEventArgs(new Uri(url), frame.name(), tempmimetype);
                    Navigating(this, args);
                    if (args.Cancel == true)
                    {
                        frame.stopLoading();
                    }
                    else
                    {
                        try
                        {
                            StatusTextChanged(this, new WebKitBrowserStatusChangedEventArgs(string.Format(LanguageLoader.ConnectingWith, new Uri(frame.provisionalDataSource().request().url()).Host))); 
                            _status = string.Format(LanguageLoader.ConnectingWith, new Uri(frame.provisionalDataSource().request().url()).Host);
                        }
                        catch { }
                    }
                }
            } 
         
        }
Пример #2
0
        void browser_HeadersAvailable(object sender, HeadersAvailableEventArgs e)
        {
            // here you can interfere with headers

            // uncomment the following to see how a message box will show
            // all headers with their fields and values

            //string tomes = "";
            //foreach (Header h in e.Headers)
            //{
            //    tomes = tomes + h.Field + ":" + h.Value + "\r\n";
            //}
            //MessageBox.Show(tomes);
        }