WebBrowser多次请求页面

  private void AutoRefresh()
        {
            WebBrowser webBrowser = new WebBrowser();
            webBrowser.Navigated += new WebBrowserNavigatedEventHandler(webBrowser_DocumentCompleted);

            while (1 == 1)
            {
                if (HasRun)
                {
                    Loadflag = true;
                    Thread.Sleep(5000);

                    webBrowser.Navigate(Core.urlstr);

                    while (Loadflag)
                        Application.DoEvents();
                }
                else
                    break;
            }
            //thread.Abort();

        }
 private void webBrowser_DocumentCompleted(object sender, WebBrowserNavigatedEventArgs e)
        {
            //webBrowser1.Refresh();
            WebBrowser webtemp = (WebBrowser)sender;
            var txt = new StreamReader(webtemp.DocumentStream).ReadToEnd();
            LogicLog(txt);
            Loadflag = false;
        }

 

posted @ 2013-01-15 15:17  Shikyoh  阅读(388)  评论(0编辑  收藏  举报