public TaskClearBots(IInstaApi api, SettingTaskClearBots setting) { this.api = api; this.setting = setting; ew = new ManualResetEvent(true); count = 0; }
private async void MetroButton15_Click(object sender, EventArgs e) { SettingTaskClearBots setting = new SettingTaskClearBots(); setting.DelayMin = Convert.ToInt32(tBox_DelayMin_ClearBot.Text); setting.DelayMax = Convert.ToInt32(tBox_DelayMax_Direct.Text); setting.FileNameExceptionId = tBox_FileNameBase_ClearBot.Text; setting.ChekedPause = toggle_Pause_ClearBot.Checked; if (tBox_PauseCount_ClearBot.Text.Length != 0) { setting.PauseLimit = Convert.ToInt32(tBox_PauseCount_ClearBot.Text); } else { setting.PauseLimit = 100; } if (tBox_PauseTime_ClearBots.Text.Length != 0) { setting.PauseTime = Convert.ToInt32(tBox_PauseTime_ClearBots.Text); } else { setting.PauseTime = 30; } setting.LimitBlock = Convert.ToInt32(tBox_LimitCount_ClearBots.Text); setting.CheckedNoAvatarUser = metroCheckBoxNoAvatar.Checked; setting.CheckedPublicCountLess = metroCheckBoxPublishLess.Checked; setting.PublicCountLess = Convert.ToInt32(metroTextBoxPublishLess.Text); setting.ChekedFollowsCountLess = metroCheckBoxFollowersLess.Checked; setting.FollowsCountLess = Convert.ToInt32(metroTextBoxFollowersLess.Text); setting.ChekedSubscriptionsLess = metroCheckBoxSSubscriptionsLess.Checked; setting.SubscriptionsLess = Convert.ToInt32(metroTextBoxSubscriptionLess.Text); setting.ChekedSubscriptionsMore = metroCheckBoxSubscriptionsMore.Checked; setting.SubscriptionMore = Convert.ToInt32(metroTextBoxSubscriptionsMore.Text); setting.ChekedUserBlock = metroCheckBoxBlockUser.Checked; setting.WhomClear = metroComboBoxWhomClear.Text; if (infoDefenderTask == null) { string username = (await api.GetCurrentUserAsync()).Value.UserName; dictionaryTask[username] = new TaskClearBots(api, setting); dictionaryTask[username].Start(); } else { if (infoDefenderTask.OneTask == null) { infoDefenderTask.OneTask = new TaskClearBots(infoDefenderTask.Api, setting); } } Close(); }