Example #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;
        }
Example #2
0
        private async void SimpleButton5_Click(object sender, EventArgs e)
        {
            int[] selectedRows = GridView_Tasks.GetSelectedRows();
            foreach (int rowHandle in selectedRows)
            {
                if (rowHandle >= 0)
                {
                    String ID                     = GridView_Tasks.GetRowCellValue(rowHandle, "PID").ToString();
                    String status                 = GridView_Tasks.GetRowCellValue(rowHandle, "Task_Status").ToString();
                    String Scraping_Account       = GridView_Tasks.GetRowCellValue(rowHandle, "Scraping_Account").ToString();
                    String Scraped_Board          = GridView_Tasks.GetRowCellValue(rowHandle, "Scraped_Board").ToString();
                    String Posting_Board          = GridView_Tasks.GetRowCellValue(rowHandle, "Posting_Board").ToString();
                    String acctoken               = GridView_Tasks.GetRowCellValue(rowHandle, "acctoken").ToString();
                    String accPassword            = GridView_Tasks.GetRowCellValue(rowHandle, "accPassword").ToString();
                    String t1delay                = GridView_Tasks.GetRowCellValue(rowHandle, "t1delay").ToString();
                    String t2delay                = GridView_Tasks.GetRowCellValue(rowHandle, "t2delay").ToString();
                    String PostingaccountUsername = GridView_Tasks.GetRowCellValue(rowHandle, "PostingAccountUsername").ToString();



                    if (status.Contains(TaskManger.TaskManagerStatus.Paused) || status.Contains(TaskManger.TaskManagerStatus.Failed))
                    {
                        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,
                                                                Scraping_Account,
                                                                accPassword,
                                                                acctoken,
                                                                Posting_Board,
                                                                int.Parse(t1delay),
                                                                int.Parse(t2delay),
                                                                PostingaccountUsername

                                                                );



                            pinObject.Resume();
                        });

                        DataRow dxr = DT_TaskManger.Select("PID='" + ID + "'").FirstOrDefault();
                        dxr["PID"] = pid;
                        GridView_Tasks.SetRowCellValue(rowHandle, "PID", pid);
                        ID = pid;



                        appHelper.SetTaskMangerDataTable_Control = DT_TaskManger;
                        GridControl_Tasks.Focus();
                        GridControl_Tasks.Refresh();


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

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



                        foreach (BackgroundWorker ts in TaskList)
                        {
                            if (ts.GetHashCode().ToString() == ID)
                            {
                                TaskManger.Running_Process += ts.GetHashCode().ToString() + " ";
                                ts.RunWorkerAsync();


                                GridView_Tasks.SetRowCellValue(rowHandle, "Task_Status", TaskManagerStatus.Running);
                            }
                        }


                        return;
                    }


                    foreach (BackgroundWorker t in TaskList)
                    {
                        if (t.GetHashCode().ToString() == ID)
                        {
                            TaskManger.Running_Process = TaskManger.Running_Process.Replace(t.GetHashCode().ToString(), "");
                            simpleButton5.Enabled      = false;
                        }
                    }
                }
            }

            appHelper.SetTaskMangerDataTable_Control = DT_TaskManger;
        }
Example #3
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;
        }