Exemple #1
0
 bool isRunning()
 {
     if (m_runing.WaitOne(0))
     {
         OptWaitWnd wnd = new OptWaitWnd("", "正在运行,请稍后操作");
         wnd.ShowDialog();
         return(true);
     }
     return(false);
 }
Exemple #2
0
        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();
        }