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()); } }); }
seriously Disclaimer: This blog is for knowledge sharing in the required software and who, after the download is complete, please delete files on round the clock. Do not miss think there is anything about "sex" or anything .- resulting in what message the people of color, but today I had to make a statement = do not leave "what's up?..".. not reply,& also bring you turned away. filthy sharer spirit!! 29 / 8.Thankyou! [Thanks of the BLOGGER TEAM~!]2014
沒有留言:
張貼留言
if you like make fds, wellcome you here~~anytime***
my free place for everyones who want the good software,
come & download them~ wellcome!!