public async Task Execute(IJobExecutionContext context) { if (SeleniumBot.Items.Any()) { await SeleniumBot.UpdateDataGrid(); } }
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 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) { } } }
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); }
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(); }