示例#1
0
        private void RingBeingreadySndPlay(object threadNum)
        {
            bool reRing = true;

            do
            {
                WavPlayer.sndPlay(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, string.Format("wav\\{0}.wav", ((int)threadNum) % 6).ToString()));
                m_SynContext.Post(SetRichTextSafePost, threadNum);
                Thread.Sleep(3000);
                //WavPlayer.Stop(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, string.Format("wav\\{0}.wav", ((int)threadNum) % 6).ToString()));
            } while (reRing);
        }
示例#2
0
        private void RingBeingreadyMciPlay(object threadNum)
        {
            try
            {
                m_SynContext.Post(SetRichTextSafePost, threadNum + "-1");
                Thread.Sleep(4000);
                Thread.CurrentThread.Join();
                WavPlayer.mciPlay(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, string.Format("wav\\第{0}次测试.wav", ((int)threadNum) % 5 + 1).ToString()));
                //SetRichTextSafePost(threadNum);
                //Thread.CurrentThread.Abort();
                #region //继续响铃?
                if (DialogResult.OK == (new FrmSetTime()).ShowDialog())
                {
                    LogTextHelper.WriteLine("DialogResult.OK");
                }
                else
                {
                    LogTextHelper.WriteLine("DialogResult....");
                }
                #endregion
                m_SynContext.Post(SetRichTextSafePost, threadNum + "-2");
                //WavPlayer.mciStop(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, string.Format("wav\\第{0}次测试.wav", ((int)threadNum) % 5 + 1).ToString()));
                return;

                m_SynContext.Post(SetRichTextSafePostByContent, DateTime.Now.ToString() + "开始");
                LogTextHelper.WriteLine("正常执行m_SynContext.Post");
                #region //继续响铃?
                //if (DialogResult.OK == (new FrmSetTime()).ShowDialog())
                //{
                //    LogTextHelper.WriteLine("DialogResult.OK");
                //}
                //else
                //{
                //    LogTextHelper.WriteLine("DialogResult....");
                //}
                #endregion
                //LogTextHelper.WriteLine("在弹窗后执行");
                //Thread.Sleep(20000);
                m_SynContext.Post(SetRichTextSafePostByContent, DateTime.Now + "结束");
                LogTextHelper.WriteLine("休眠后结束");
            }
            catch (ThreadAbortException ex)
            {
                m_SynContext.Post(SetRichTextSafePostByContent, DateTime.Now + "进入Catch ThreadAbortException");
                //RingBeingreadyMciPlay(threadNum);
                Thread.ResetAbort();
            }
            catch (ThreadInterruptedException ex)
            {
                RingBeingreadyMciPlay(threadNum);
            }
            m_SynContext.Post(SetRichTextSafePost, string.Format(threadNum + "---End"));

            return;

            bool reRing = true;
            do
            {
                //WavPlayer.mciPlay(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, string.Format("wav\\{0}.wav", ((int)threadNum) % 6).ToString()));
                //m_SynContext.Post(SetRichTextSafePost, threadNum);
                ////SetRichTextSafePost(threadNum);
                //Thread.Sleep(4000);
                //WavPlayer.mciStop(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, string.Format("wav\\{0}.wav", ((int)threadNum) % 6).ToString()));

                WavPlayer.mciPlay(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, string.Format("wav\\平凡之路.wav").ToString()));
                m_SynContext.Post(SetRichTextSafePost, threadNum);
                //SetRichTextSafePost(threadNum);
                Thread.Sleep(4000);
                //WavPlayer.mciStop(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, string.Format("wav\\平凡之路.wav").ToString()));
            } while (false);
        }