28/01/2014 MCAFEE SECURE 認證的網站

https://www.mcafeesecure.com/RatingVerify?ref=www.HongKongCupid.com

2013年7月6日 星期六

protected void btnLongExec_Click(object sender, EventArgs e) { les.Execute( sender as Button, (rp) => { bool done = false; int i = 0; //另開一條Thread執行耗時作業,完成時將done設為true Thread t = new Thread(() => { //執行同步式耗時作業,例如執行Stored Procedure、大規模DB批次更新 //在此使用Thread.Sleep取代之 Thread.Sleep(20000); done = true; }); t.Start(); //跑迴圈等候,每隔一秒傳回耗時統計(如有需要還可加入Timeout概念) while (!done) { Thread.Sleep(1000); i++; rp("Process - " + i.ToString()); } });

protected void btnLongExec_Click(object sender, EventArgs e) { les.Execute( sender as Button, (rp) => { bool done = false; int i = 0; //另開一條Thread執行耗時作業,完成時將done設為true Thread t = new Thread(() => { //執行同步式耗時作業,例如執行Stored Procedure、大規模DB批次更新 //在此使用Thread.Sleep取代之 Thread.Sleep(20000); done = true; }); t.Start(); //跑迴圈等候,每隔一秒傳回耗時統計(如有需要還可加入Timeout概念) while (!done) { Thread.Sleep(1000); i++; rp("Process - " + i.ToString()); } }); }