bool isRunning() { if (m_runing.WaitOne(0)) { OptWaitWnd wnd = new OptWaitWnd("", "正在运行,请稍后操作"); wnd.ShowDialog(); return(true); } return(false); }
void Run(thrRun fun) { m_runing.Set(); Thread thread = new Thread(() => { try { fun(); m_runing.Reset(); } catch (Exception ex) { OptWaitWnd wnd = new OptWaitWnd("", ex.ToString()); wnd.ShowDialog(); m_runing.Reset(); } }); thread.IsBackground = true; thread.Start(); }