Esempio n. 1
0
        private async void Btn_GetBoardsAfterScrap_Click(object sender, EventArgs e)
        {
            if (Lookup_PostingAccount.GetSelectedDataRow() == null)
            {
                MessageBox.Show("Please Select an account ! ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            dynamic x = Lookup_PostingAccount.GetSelectedDataRow();

            try
            {
                Lookup_ScrapingAccount.Enabled      = false;
                Lookup_PostingAccount.Enabled       = false;
                Combo_CurentBoard.Enabled           = false;
                General_GroupBoxScrapSearch.Enabled = false;
                General_GroupBoxScrapBoard.Enabled  = false;

                PinObject pinObject = new PinObject(x.Row.ItemArray[0].ToString());
                var       axx       = await pinObject.GetBoards();

                Combo_CurentBoard.Properties.Items.Clear();
                foreach (var bo in axx)
                {
                    string xa = bo.url.ToLower().Replace("https://www.pinterest.com/", "");
                    if (xa.EndsWith("/"))
                    {
                        xa = xa.TrimEnd(bo.url[bo.url.Length - 1]);
                    }
                    xa = xa.TrimStart(bo.url[bo.url.Length - 1]);
                    Combo_CurentBoard.Properties.Items.Add(xa + "[-]" + bo.id);
                }
            }
            catch (Exception ex)
            {
                LogReport(true, x.Row.ItemArray[0].ToString(), ex.Message);
                Lookup_ScrapingAccount.Enabled      = true;
                Combo_CurentBoard.Enabled           = true;
                Lookup_PostingAccount.Enabled       = true;
                General_GroupBoxScrapSearch.Enabled = true;
                General_GroupBoxScrapBoard.Enabled  = true;
            }
            Lookup_PostingAccount.Enabled       = true;
            Lookup_ScrapingAccount.Enabled      = true;
            Combo_CurentBoard.Enabled           = true;
            General_GroupBoxScrapSearch.Enabled = true;
            General_GroupBoxScrapBoard.Enabled  = true;
        }
Esempio n. 2
0
        private async void SimpleButton9_Click(object sender, EventArgs e)
        {
            txt_BoardURL.Text = txt_BoardURL.Text.ToLower().Replace("https://www.pinterest.com/", "").Replace("http://www.pinterest.com/", "").Replace("pinterest.com/", "");
            if (txt_BoardURL.Text.EndsWith("/"))
            {
                txt_BoardURL.Text = txt_BoardURL.Text.TrimEnd(txt_BoardURL.Text[txt_BoardURL.Text.Length - 1]);
            }

            if (Lookup_ScrapingAccount.GetSelectedDataRow() == null || Lookup_PostingAccount.GetSelectedDataRow() == null)
            {
                MessageBox.Show("Please Select The scraping Account And The Posting Accoint! ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (Combo_CurentBoard.SelectedItem == null)
            {
                MessageBox.Show("Please Select an Board ! ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }



            dynamic ScrapingAccount = Lookup_ScrapingAccount.GetSelectedDataRow();
            dynamic PostingAccount  = Lookup_PostingAccount.GetSelectedDataRow();

            if (ScrapingAccount.Row.ItemArray[1].ToString() == "")
            {
                MessageBox.Show("You Must Enter The Password of Scraping Account", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            BackgroundWorker t = new BackgroundWorker();

            t.WorkerSupportsCancellation = true;
            string pid = t.GetHashCode().ToString();

            t.DoWork += new DoWorkEventHandler(delegate(object o, DoWorkEventArgs a)
            {
                PinObject pinObject = new PinObject(pid, ScrapingAccount.Row.ItemArray[0].ToString(), ScrapingAccount.Row.ItemArray[1].ToString(), PostingAccount.Row.ItemArray[3].ToString(), Combo_CurentBoard.SelectedItem.ToString(), ((int)num1.Value), ((int)num2.Value), PostingAccount.Row.ItemArray[0].ToString());
                pinObject.ScrapBoard(txt_BoardURL.Text, ((int)ScrapBoardLimit.Value));
            });

            TaskList.Add(t);
            //t.RunWorkerAsync();

            TaskManger.Running_Process += t.GetHashCode().ToString();

            FILEWriter fILEWriter = new FILEWriter();

            setscad();

            DT_TaskManger.Rows.Add(
                ScrapingAccount.Row.ItemArray[0].ToString(),
                PostingAccount.Row.ItemArray[0].ToString(),
                TaskManger.TaskMangerProcess.ScrapBoard + "_" + txt_keyword.Text,
                txt_BoardURL.Text,
                Combo_CurentBoard.SelectedItem.ToString(),
                Scad,
                "0",
                "0",
                "0",
                TaskManger.TaskManagerStatus.Ready,
                DateTime.Now.ToString(),
                "",
                t.GetHashCode().ToString(),
                txt_forcechangeurl.Text,
                "",
                PostingAccount.Row.ItemArray[3].ToString(),
                ScrapingAccount.Row.ItemArray[1].ToString(),
                num1.Value,
                num2.Value,
                ScrapBoardLimit.Value,
                PostingAccount.Row.ItemArray[0].ToString());

            Lookup_ScrapingAccount.Enabled = true;
        }