private void btn_Click(object sender, RoutedEventArgs e) { Unit unit = new Unit("*****@*****.**"); unit.UnitMsg += Unit_UnitMsg; unit.Registration(); //using (var reader = new StreamReader(Directory.GetCurrentDirectory() + @"\Emails\bad.txt")) //{ // string str = string.Empty; // while ((str = reader.ReadLine()) != null) // { // if (!emails.Contains(str)) // emails.Add(str); // } //} //Start(); }
public void Work() { while (!finish) { //Begin:; string email = null; lock (locker) { if (index < emails.Count) { email = emails[index].Trim(); index = index + 1; } else { finish = true; index = 0; //goto Begin; } } string s = "1"; Unit unit = new Unit(email); // unit.Registration(out s); tb.Dispatcher.BeginInvoke(new Action(() => { tb.Text += s + Environment.NewLine; })); } }