private static void Completed(IAsyncResult result) { AsyncResult _result = (AsyncResult)result; ShowWaitFormEventHandler showHandler = (ShowWaitFormEventHandler)_result.AsyncDelegate; try { showHandler.EndInvoke(result); } catch { } WaitFormService.Close(); }
public static void CreateForm() { waitForm = new WaitForm(); waitForm.Show(); for (int i = 0; i < 10000; i++) { if (!Cancle()) { waitForm.Invoke((Action)(delegate { WaitFormService.SetText("正在执行 ,请耐心等待...." + i.ToString()); })); Application.DoEvents(); } else { break; } } }