Esempio n. 1
0
        private void LoadVenderList(WebBrowserEx browser)
        {
            string             html = manager.DocumentHtml();
            List <VenderModel> tmp  = FenXiaoManager.GetVender(html);

            if (tmp != null && tmp.Count > 0)
            {
                this.list.AddRange(tmp);
            }

            // 分页处理
            if (html.IndexOf("class=\"page-next\"") != -1)
            {
                var htmlElement = manager.FindID("dpl:pagination");
                if (htmlElement != null)
                {
                    htmlElement = manager.FindClassName("page-next");
                    if (htmlElement != null)
                    {
                        manager.ClickHelemnt(htmlElement);

                        this.TabText = "发布分销商品(商家列表加载中...)";
                        return;
                    }
                }

                this.TabText = "发布分销商品(商家列表加载完成)";
                BindVenderList();
            }
            else
            {
                this.TabText = "发布分销商品(商家列表加载完成)";
                BindVenderList();
            }
        }
Esempio n. 2
0
        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));
                    }
                }
            }
        }