void BtnDown(object b, MouseEventArgs e) { CustomBtn btn = (CustomBtn)b; if (btn.StartImgNumb + 3 >= btn.ImageIndex + 1) { btn.ImageIndex = btn.ImageIndex + 1; } }
void BtnUp(object b, MouseEventArgs e) { CustomBtn btn = (CustomBtn)b; if (btn.ImageIndex - 1 >= btn.StartImgNumb) { btn.ImageIndex = btn.ImageIndex - 1; } }
void BtnHover(object b, EventArgs e) { CustomBtn btn = (CustomBtn)b; if (btn.StartImgNumb + 3 >= btn.ImageIndex + 1) { btn.ImageIndex = btn.ImageIndex + 1; } }
internal void SetButton1Text(object[] obj) { this.Invoke((MethodInvoker) delegate { CustomBtn b = obj[0] as CustomBtn; var str = obj[1] as string; if (str.ToLower().Equals("start")) { b.ImageIndex = b.ImageIndex - 3;//.Text = str; b.StartImgNumb = b.ImageIndex; if (!b.Enabled) { b.Enabled = true; } } }); }
void writefile(string filepath, CustomBtn b) { StringBuilder builder = new StringBuilder(); if (b == button4) { foreach (ListViewItem item in this.listView1.Items) { builder.AppendLine(item.SubItems[0].Text); } } else if (b == button9) { builder.Append(richTextBox2.Text); } File.WriteAllText(filepath, builder.ToString()); }
void writefile(string filepath, CustomBtn b) { StringBuilder builder = new StringBuilder(); if (b == button4) { foreach (ListViewItem item in this.listView1.Items) { builder.AppendLine(item.SubItems[0].Text); } } else if(b==button9){ builder.Append(richTextBox2.Text); } File.WriteAllText(filepath, builder.ToString()); }
void process(object sender) { GC.Collect(); CustomBtn b = (CustomBtn)sender; if (b.ImageIndex == 5 || b.ImageIndex == 20) { cancel(); b.Enabled = false; return; } bool check = false; // indicate if testproxy or scrape proxy bool newcheck = false; if (b.Name.Equals(button1.Name))//if button is scrape proxy from url { if (richTextBox2.Text.Trim().Equals(string.Empty)) { return; } if (button11.ImageIndex == 18) { MessageBox.Show("Please stop proxy test first"); return; } //reset labels and variable counter to 0 listView1.Items.Clear(); label6.Text = "0"; label7.Text = "0"; label12.Text = "0"; label13.Text = "0"; label14.Text = "0"; //fill listproxy with url from textbox new deg_ProcessStart(ProcessStart).BeginInvoke(new object[] { check, newcheck }, null, null); } else { //button is testproxy's button if (button1.ImageIndex == 3) { MessageBox.Show("Please stop proxy gathering"); return; } if (listView1.Items.Count > 0) { var result = MessageBox.Show("New Test ? (otherwise will continue)", "Confirmation", MessageBoxButtons.YesNoCancel); if (result == DialogResult.Cancel) { return; } else if (result == DialogResult.Yes)//perform new test { newcheck = true; } check = true; new deg_ProcessStart(ProcessStart).BeginInvoke(new object[] { check, newcheck }, null, null); } else {//listview is empty , return MessageBox.Show("There is no Proxy to check,please get it first !"); return; } } b.ImageIndex = b.ImageIndex + 1; }