Thread t3 = new Thread(() =>
{
Console.WriteLine("a2....");
WriteLog("ComListForm.t3.begin..");
RefreshListFormDb();
});
t3.IsBackground = true;
t3.Start();
RefreshListFormDb()需要更新datagridView:
List<ComPhoneBean> list = rv_list.Value;
MethodInvoker mi = new MethodInvoker(() =>
{
WriteLog("ComListForm.RefreshListFormDb....5.");
UpdateDataGrid(list);
});
this.BeginInvoke(mi);
UpdateDataGrid这个方法更新Datagridview的内容:
private void UpdateDataGrid(List<ComPhoneBean> list)
{
WriteLog("ComListForm.UpdateDataGrid....1.");
if (list==null || list.Count == 0)
{
WriteLog("ComListForm.UpdateDataGrid....2.");
return;
}
WriteLog("ComListForm.UpdateDataGrid....3.");
this.dataGridView1.Rows.Clear();
WriteLog("ComListForm.UpdateDataGrid....4.");
int index = 0;
foreach(ComPhoneBean bean in list)
{
index++;
this.dataGridView1.Rows.Add(new string[] { "" + index, bean.ComPort, bean.Phone, "" + bean.SignalIntensity });
}
WriteLog("ComListForm.UpdateDataGrid....5.");
}
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。