private void button2_Click(object sender, EventArgs e) { button1.Enabled = false; Timer t = new Timer() { Interval = 1000 }; t.Start(); t.Tick += delegate(object _s, EventArgs _e) { Delege d = new Delege(PingIt); d.BeginInvoke(null, null); }; }
private void Poke() { GetLastPokeYou(); Regex rg = new Regex("poke=(?<uid>[^<]*)&gfid=(?<gfid>[^<]*)&refid=(?<refid>[^<]*)"); MatchCollection m = rg.Matches(result); List<string> UserID = new List<string>(); List<string> Gfid = new List<string>(); List<string> RefID = new List<string>(); foreach (Match item in m) { UserID.Add(item.Groups[1].Value); Gfid.Add(item.Groups[2].Value); RefID.Add(item.Groups[3].Value); } //Poke //Eğer dürtülecek kişi yoksa mesaj ver. if (UserID.Count == 0) { listBox1.Items.Add(String.Format("{0} Dürtülecek kişi bulunamadı.", DateTime.Now.ToShortTimeString())); } for (int i = 0; i < UserID.Count; i++) { Poke(UserID[i]); } timer1.Enabled = false; List<string> users = XML.ReadXML(); foreach (string item in users) { Delege d = new Delege(Poke); d.BeginInvoke(item, null, this); } timer1.Enabled = true; }