public async Task Execute(IJobExecutionContext context) { if (SeleniumBot.Items.Any()) { await SeleniumBot.UpdateDataGrid(); } }
public async Task IsUpdateBot() { while (true) { await Task.Delay(1000); try { var client = new RestClient(_host); var request = new RestRequest($"GetIsUpdateBot/{Properties.Settings.Default.Key}"); var res = await client.ExecuteAsync(request); try { var isOn = bool.Parse(res.Content); if (isOn) { await SeleniumBot.ParseAll(); } } catch { } } catch { } } }
public async Task EditItem() { while (true) { await Task.Delay(200); try { var client = new RestClient(_host); var request = new RestRequest($"GetEditItem"); var content = client.Execute(request).Content.Replace("\"", ""); if (content == "") { continue; } var num = int.Parse(content.Split(',')[0]); var price = float.Parse(content.Split(',')[1]); var comment = content.Split(',')[2]; var crm = content.Split(',')[2]; SeleniumBot.Items.FirstOrDefault(f => f.Number == num).MinPrice = price; SeleniumBot.Items.FirstOrDefault(f => f.Number == num).Comment = comment; SeleniumBot.Items.FirstOrDefault(f => f.Number == num).CRMLink = crm; await SeleniumBot.UpdateDataGrid(); } catch (Exception ex) { } } }
public async Task AddUrl() { while (true) { await Task.Delay(1000); try { var client = new RestClient(_host); var request = new RestRequest($"GetUrl/{Properties.Settings.Default.Key}"); var res = await client.ExecuteAsync(request); if (res.Content == "\"no\"" || res.Content == "") { continue; } try { await SeleniumBot.ParseLink(res.Content, false, 0, false); } catch { } } catch { } } }
public async Task DeleteItem() { while (true) { await Task.Delay(300); try { var client = new RestClient(_host); var request = new RestRequest($"GetDeleteItems"); var content = client.Execute(request).Content; var num = int.Parse(content); if (num != 0) { SeleniumBot.Items.Remove(SeleniumBot.Items.FirstOrDefault(f => f.Number == num)); await SeleniumBot.UpdateDataGrid(); //Properties.Settings.Default.Items = JsonConvert.SerializeObject(SeleniumBot.Items); //Properties.Settings.Default.Save(); } } catch (Exception ex) { } } }
public async Task Execute(IJobExecutionContext context) { if (SeleniumBot.Items.Any()) { foreach (var item in SeleniumBot.Items) { if (item.Ostalos.TotalMinutes <= Properties.Settings.Default.StartParse) { if (SeleniumBot.Items.FirstOrDefault(f => f.Number == item.Number).MinPrice <= SeleniumBot.Items.FirstOrDefault(f => f.Number == item.Number).NextBet && SeleniumBot.Items.FirstOrDefault(f => f.Number == item.Number).MinPrice != 0) { _ = Task.Run(() => SeleniumBot.MakeBet(item)); await Task.Delay(500); } } } } }
private async void Form1_Load(object sender, EventArgs e) { panel1.AutoScroll = false; panel1.HorizontalScroll.Enabled = false; panel1.HorizontalScroll.Visible = false; panel1.HorizontalScroll.Maximum = 0; panel1.AutoScroll = true; var res = Properties.Settings.Default.Items; if (res != String.Empty) { SeleniumBot.Items = JsonConvert.DeserializeObject <List <Item> >(res); } SeleniumBot.textBoxFirst = textBox2; SeleniumBot.textBoxSecond = textBox3; SeleniumBot.textBoxTimer = proverka_textBox; try { await LoadSettings(); } catch { } dataGridView1.AllowUserToAddRows = false; SeleniumBot.MyDataGrid = dataGridView1; await SeleniumBot.UpdateDataGrid(); startStop_btn.BackColor = Color.Red; _ = Task.Run(StartOrStop); _ = Task.Run(IsUpdateBot); _ = Task.Run(AddUrl); _ = Task.Run(SendItems); _ = Task.Run(DeleteItem); _ = Task.Run(EditItem); }
public async Task Execute(IJobExecutionContext context) { Properties.Settings.Default.LastParse = ""; Properties.Settings.Default.Save(); await SeleniumBot.ParseAll(); }
private async void button3_Click(object sender, EventArgs e) { SeleniumBot.Items.Remove(SeleniumBot.Items.FirstOrDefault(f => f.Number == int.Parse(textBox9.Text))); await SeleniumBot.UpdateDataGrid(); }
private async void goToUrl_btn_Click(object sender, EventArgs e) { _ = Task.Run(() => SeleniumBot.GoToUrl(link_textBox.Text)); }
private async void updateLots_btn_Click(object sender, EventArgs e) { await SeleniumBot.ParseAll(); }
private async void addUrl_btn_Click(object sender, EventArgs e) { await SeleniumBot.ParseLink(link_textBox.Text, false, 0, parseNow_checkBox.Checked); }
private async void button1_Click_1(object sender, EventArgs e) { await SeleniumBot.InitializeBot((int)numericUpDown4.Value); }