private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            //註銷掉事件
            bodyFrameReader.FrameArrived    -= BodyFrameReader_FrameArrived;
            _reader.MultiSourceFrameArrived -= _reader_MultiSourceFrameArrived;
            poseture.Poseture_List          -= Success_Change_word;
            dispatcherTimer.Tick            -= DispatcherTimer_Tick;
            dispatcherGameTimer.Tick        -= GameTimer_Tick;
            QRcodeTimer.Tick -= QRCodeTimer_Tick;

            //關閉Socket.io連線
            sokcet_Connect.SocketClose();

            //Stop Text To Speech
            textToSpeech.SpeechPause();

            //Stop SoundPlay
            SoundPlay.PlayStop();

            //停止偵測QRCode
            QRcodeTimer.Stop();

            //暫停拍照倒數時間
            dispatcherTimer.Stop();

            //將音效的狀態設定為初始值
            PostureSoundStatus = false;

            if (_reader != null)
            {
                _reader.Dispose();
                _reader = null;
            }

            if (bodyFrameReader != null)
            {
                bodyFrameReader.Dispose();
                bodyFrameReader = null;
            }

            if (null != this.convertStream)
            {
                this.convertStream.SpeechActive = false;
            }

            if (null != this.speechEngine)
            {
                this.speechEngine.SpeechRecognized          -= this.SpeechRecognized;
                this.speechEngine.SpeechRecognitionRejected -= this.SpeechRejected;
                this.speechEngine.RecognizeAsyncStop();
            }

            PeerMainWidnow peerMainWidnow = new PeerMainWidnow();

            peerMainWidnow.Show();
        }
Пример #2
0
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            //Close socket
            sokcet_Connect.SocketClose();

            //註銷掉事件
            bodyFrameReader.FrameArrived    -= BodyFrameReader_FrameArrived;
            _reader.MultiSourceFrameArrived -= _reader_MultiSourceFrameArrived;
            poseture.Poseture_List          -= Success_Change_word;
            dispatcherTimer.Tick            -= DispatcherTimer_Tick;
            QRcodeTimer.Tick -= QRCodeTimer_Tick;

            //Stop Text To Speech
            textToSpeech.SpeechPause();

            //Stop SoundPlay
            SoundPlay.PlayStop();

            //停止偵測QRCode
            QRcodeTimer.Stop();

            //停止拍照倒數時間
            dispatcherTimer.Stop();

            if (_reader != null)
            {
                _reader.Dispose();
                _reader = null;
            }

            if (bodyFrameReader != null)
            {
                bodyFrameReader.Dispose();
                bodyFrameReader = null;
            }

            if (null != this.convertStream)
            {
                this.convertStream.SpeechActive = false;
            }

            if (null != this.speechEngine)
            {
                this.speechEngine.SpeechRecognized          -= this.SpeechRecognized;
                this.speechEngine.SpeechRecognitionRejected -= this.SpeechRejected;
                this.speechEngine.RecognizeAsyncStop();
            }

            //用來判斷該呼叫哪個主頁面
            BasicMethod.CallMainWindow();
        }