跨线程的异步处理

(1)
// 声明警情加载异步委托
private delegate void DGE_InitAlarmListToDGV(string org_code, string state);


/// <summary>
/// 加载所有的待处理报警信息
/// </summary>
/// <returns>true、false</returns>
private void Load_AlarmList(object sender, EventArgs e)
{
DGE_InitAlarmListToDGV degeInit = new DGE_InitAlarmListToDGV(InitAlarmListToDGV);
degeInit.BeginInvoke(App.org_code, "", null, null);
}

/// <summary>
/// 加载警情到警情信息栏中
/// </summary>
/// <param name="org_code"></param>
/// <param name="state"></param>
private void InitAlarmListToDGV(string org_code, string state)
{
....
}


(2)

////异步加载数据库数据
new MethodInvoker(delegate() { LoadAllData(userId, org_code,picType); }).BeginInvoke(null, null);


 

posted @ 2016-05-17 13:29  FiberHomer  阅读(234)  评论(0编辑  收藏  举报