Esempio n. 1
0
        private async void B_ApplyComment_Click(object sender, EventArgs e)
        {
            if (textBoxFileNameComment.Text.Length > 5)
            {
                SettingTaskComment setting = new SettingTaskComment();

                setting.FileNameBaseId = textBoxFileNameComment.Text;

                setting.DelayMin = Convert.ToInt32(tBox_DelayMin_Comment.Text);
                setting.DelayMax = Convert.ToInt32(tBox_DelayMax_Comment.Text);

                setting.DelayOneUserMin = Convert.ToInt32(metroTextBoxDelayUserMin.Text);
                setting.DelayOneUserMax = Convert.ToInt32(metroTextBoxDelayUserMax.Text);

                setting.CheckedPause = metroTogglePauseComment.Checked;

                if (tBox_PauseCount_Comment.Text.Length != 0)
                {
                    setting.PauseLimit = Convert.ToInt32(tBox_PauseCount_Comment.Text);
                }
                else
                {
                    setting.PauseLimit = 100;
                }
                if (tBox_PauseTime_Comment.Text.Length != 0)
                {
                    setting.PauseTime = Convert.ToInt32(tBox_PauseTime_Comment);
                }
                else
                {
                    setting.PauseTime = 30;
                }

                setting.ChekedDeleteBase = checkBox_DeleteInBase_Comment.Checked;

                setting.CommentCountMax          = Convert.ToInt32(tBox_MaxComment_Comment.Text);
                setting.CountPublishComment      = Convert.ToInt32(metroTextBoxCountPublish.Text);
                setting.CountCommnetUnderPublish = Convert.ToInt32(metroTextBoxCountCommentUnderPublish.Text);

                var x = metroTextBoxeComments.Text.Split('\n');
                setting.Message = x;

                if (infoDefenderTask == null)
                {
                    string username = (await api.GetCurrentUserAsync()).Value.UserName;
                    dictionaryTask[username] = new TaskMassComment(api, setting);
                    dictionaryTask[username].Start();
                }
                else
                {
                    if (infoDefenderTask.OneTask == null)
                    {
                        infoDefenderTask.OneTask = new TaskMassComment(infoDefenderTask.Api, setting);
                    }
                }

                Close();
            }
            else
            {
                MessageBox.Show("Укажите путь до базы");
            }
        }
Esempio n. 2
0
 public TaskMassComment(IInstaApi api, SettingTaskComment setting)
 {
     this.api     = api;
     this.setting = setting;
     ew           = new ManualResetEvent(true);
 }