예제 #1
0
        private void addFenXiaoProductTimer_Tick(object sender, EventArgs e)
        {
            addFenXiaoProductTimer.Enabled = false;

            if (!startPublishNewProduct)
            {
                return;
            }

            int maxFenXiaoCount = (int)numericPerPage.Value;

            if (maxFenXiaoCount > 0)
            {
                if (addProductCount >= maxFenXiaoCount)
                {
                    return;
                }
            }

            if (fenxiaoProductListIndex < fenxiaoProductList.Count)
            {
                int findProductIndex = fenxiaoProductListIndex;
                fenxiaoProductListIndex++;

                FenXiaoModel model = fenxiaoProductList[findProductIndex];

                if (Filter(model))
                {
                    return;
                }

                HtmlElement           table = manager.FindID("J_MyItemList");
                HtmlElementCollection trCol = table.GetElementsByTagName("tr");

                HtmlElement tr = trCol[findProductIndex];
                HtmlElement a  = manager.FindClassName("J_download", tr);

                if (a != null)
                {
                    addProductCount++;

                    int y = manager.GetYoffset(a);
                    manager.ToY(y - 100);

                    manager.Browser.Task = "PublishProduct";
                    manager.ClickHelemnt(a);

                    checkDownTimer.Start();
                }
            }
            else
            {
                // 仅当前页
                if (checkBoxCurrentOnly.Checked)
                {
                    return;
                }

                // next Page
                manager.Browser.Task = "Publish";

                HtmlElement next = manager.FindClassName("page-next");
                if (next != null)
                {
                    manager.ClickHelemnt(next);
                }
                else
                {
                    if (publishAllVender)
                    {
                        Vender();
                    }
                }
            }
        }