Пример #1
0
 static void pWb_DocumentComplete(object sender, DocumentCompleteEventArgs e)
 {
     if (e.url.ToLower() == "about:blank")
     {
         Debug.Print("DocumentComplete::about:blank = istoplevel===>" + e.istoplevel.ToString());
         return;
     }
     if (e.istoplevel)
     {
         done = true;
         Debug.Print("DocumentComplete::TopLevel is TRUE===>" + e.url);
     }
     else
     {
         Debug.Print("DocumentComplete::TopLevel is FALSE===>" + e.url);
     }
 }
 /*
 When e.isTopLevel parameter of DocumentComplete is true, it means that the main document has finished loading whether we have a frameset or not.
 In a frameset page, DocumentComplete is fired for every frame. In the case of a frame, e.isTopLevel is false, meanning that the document is still loading.
 When all frames have been loaded then the DocumentComplete is fired for the main document signaling that the document has finished loading which is recognized when isTopLevel is true. There is no need to use timers to find out when the page has fully loaded.
  */
 private void WebBrower_DocumentComplete(object sender, DocumentCompleteEventArgs e)
 {
     if (e.url.ToLower() == "about:blank")
     {
         return;
     }
     cEXWB pWB = sender as cEXWB;
     if (e.istoplevel)
     {
         IsDocumentFinish = true;
         //Logger.Log(LogLevel.Info, string.Format("DocumentComplete,Url:{0},时间:{1}", e.url,DateTime.Now));
     }
     else if (pWB != null && pWB.MainDocumentFullyLoaded) // a frame naviagtion within a frameset
     {
         IsDocumentFinish = true;
         //Logger.Log(LogLevel.Info, string.Format("MainDocumentFullyLoaded,Url:{0},时间:{1}", e.url, DateTime.Now));
     }
     else
     {
         //log.Debug("DocumentComplete::TopLevel is FALSE===>" + e.url);
     }
 }
Пример #3
0
        private void WebBrower_DocumentComplete(object sender, DocumentCompleteEventArgs e)
        {
            if (e.url.ToLower() == "about:blank")
            {
                return;
            }

            cEXWB pWB = sender as cEXWB;
            if (e.istoplevel)
            {
                IsDocumentFinish = true;
                Html = pWB.DocumentSource;
                htmlDocument = HtmlAgilityPackHelper.GetHtmlDocument(pWB.DocumentSource);
                //Stopwatch sw=new Stopwatch();
                //sw.Start();
                //LoadHtmlTree();
                //sw.Stop();
                Stopwatch sw1 = new Stopwatch();
                sw1.Start();
                BuildTree3();
                sw1.Stop();
                richTextBox.Text+= string.Format("DOM树构建时间{0}毫秒", sw1.ElapsedMilliseconds)+"\n";
                //MessageBox.Show(sw1.ElapsedMilliseconds.ToString());
                //Logger.Log(LogLevel.Info, string.Format("DocumentComplete,Url:{0},时间:{1}", e.url,DateTime.Now));
            }
            else if (pWB != null && pWB.MainDocumentFullyLoaded) // a frame naviagtion within a frameset
            {
                IsDocumentFinish = true;
                //Logger.Log(LogLevel.Info, string.Format("MainDocumentFullyLoaded,Url:{0},时间:{1}", e.url, DateTime.Now));
            }
            else
            {
                //log.Debug("DocumentComplete::TopLevel is FALSE===>" + e.url);
            }
        }
Пример #4
0
        private void VBACsEXWB_DocumentComplete(object sender, DocumentCompleteEventArgs e)
        {
            if (e.url.ToLower() == "about:blank")
            {
                m_IsNavigationCompleted = true;

                //发出提示
                lock (navigatelocker)
                {
                    Monitor.Pulse(navigatelocker);
                }
                return;
            }

            if (e.istoplevel)
            {
                log.Debug("DocumentComplete::TopLevel is TRUE===>" + e.url);
                m_IsNavigationCompleted = true;
                //发出提示
                lock (navigatelocker)
                {
                    Monitor.Pulse(navigatelocker);
                }
            }
            else
            {
                log.Debug("DocumentComplete::TopLevel is FALSE===>" + e.url);
            }
        }