private void button4_Click(object sender, EventArgs e) { var mt = new MeiTuan(); var s = mt.GetDetail(); richTextBox1.Text = s; }
public void GetPhone() { var mtbase = new MeiTuan(); var tasklst = new List <Task>(); var t = Task.Run(() => { datas.ForEach(n => { this.Invoke((MethodInvoker) delegate { richTextBox1.Text += $"正在获取“{n.title}”的店铺联系方式,店铺ID为{n.poiId}\r\n"; }); n.dh = mtbase.GetDetail(n.poiId.ToString()); }); }); tasklst.Add(t); Task.Run(() => { Task.WaitAll(tasklst.ToArray()); this.Invoke((MethodInvoker) delegate { dataGridView1.DataSource = datas; richTextBox1.Text += "数据获取完毕"; }); }); }