private void webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { WebBrowserEx webBrowser = sender as WebBrowserEx; if (webBrowser.ReadyState == WebBrowserReadyState.Complete) { if (e.Url.AbsolutePath != webBrowser.Url.AbsolutePath) { return; } if (webBrowser.Url.AbsolutePath.Contains("distributor")) { string html = Init(webBrowser); // next page if (html.IndexOf("class=\"page-next\"") != -1) { WebBrowserManager m = new WebBrowserManager(this.webBrowser); var pageContainer = m.FindID("dpl:pagination"); if (pageContainer != null) { pageContainer = m.FindClassName("page-next", pageContainer); } if (pageContainer != null) { m.ClickHelemnt(pageContainer); } this.TabText = "商品分销管理(加载中 ... ...)"; } else { webBrowser.DocumentCompleted -= webBrowser_DocumentCompleted; this.TabText = "商品分销管理(加载完成)"; ThreadRunner.Run(new Action(SearchNewTitle)); } } } }
private void BtnChangeTitleM2_Click(object sender, EventArgs e) { this.TabText = "开始执行方法2"; ThreadRunner.Run(new Action(SearchNewTitleM2)); }