Exemplo n.º 1
0
        public void Dispose()
        {
            if (Server != null)
            {
                Server.Dispose();
            }

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

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

            if (Sensor != null)
            {
                Sensor.Close();
            }

            Server               = null;
            BodyFrameReader      = null;
            BodyIndexFrameReader = null;
            Sensor               = null;
        }
Exemplo n.º 2
0
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (_bodyReader != null)
            {
                _bodyReader.Dispose();
                _bodyReader = null;
            }

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

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

            if (_sensor != null)
            {
                _sensor.Close();
                _sensor = null;
            }
        }
Exemplo n.º 3
0
        // Execute shutdown tasks
        private void MainWindow_Closing(object sender, CancelEventArgs e)
        {
            if (bodyFrameReader != null)
            {
                // BodyFrameReader is IDisposable
                bodyFrameReader.FrameArrived -= Reader_BodyFrameArrived;
                bodyFrameReader.Dispose();
                bodyFrameReader = null;
            }

            if (gestureDetectorList != null)
            {
                // The GestureDetector contains disposable members (VisualGestureBuilderFrameSource and VisualGestureBuilderFrameReader)
                foreach (GestureDetector detector in gestureDetectorList)
                {
                    detector.Dispose();
                }

                gestureDetectorList.Clear();
                gestureDetectorList = null;
            }

            if (kinectSensor != null)
            {
                kinectSensor.IsAvailableChanged -= Sensor_IsAvailableChanged;
                kinectSensor.Close();
                kinectSensor = null;
            }
        }
Exemplo n.º 4
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (faceModelBuilder != null)
     {
         faceModelBuilder.Dispose();
         faceModelBuilder = null;
     }
     if (hdFaceFrameReader != null)
     {
         hdFaceFrameReader.Dispose();
         hdFaceFrameReader = null;
     }
     if (bodyFrameReader != null)
     {
         bodyFrameReader.Dispose();
         bodyFrameReader = null;
     }
     if (faceModel != null)
     {
         faceModel.Dispose();
         faceModel = null;
     }
     if (kinect != null)
     {
         kinect.Close();
         kinect = null;
     }
 }
        private void Page_Unloaded(object sender, RoutedEventArgs e)
        {
            if (_colorReader != null)
            {
                _colorReader.Dispose();
                _colorReader = null;
            }

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

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

            if (_faceSource != null)
            {
                _faceSource = null;
            }

            if (_sensor != null)
            {
                _sensor.Close();
            }
        }
Exemplo n.º 6
0
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            for (int i = 0; i < bodyCount; i++)
            {
                if (faceFrameReaders[i] != null)
                {
                    faceFrameReaders[i].Dispose();
                    faceFrameReaders[i] = null;
                }
                if (faceFrameSources[i] != null)
                {
                    faceFrameSources[i].Dispose();
                    faceFrameSources[i] = null;
                }
            }
            if (bodyFrameReader != null)
            {
                bodyFrameReader.Dispose();
                bodyFrameReader = null;
            }
            if (kinect != null)
            {
                kinect.Close();
                kinect = null;
            }

            sw.Close();
        }
Exemplo n.º 7
0
        private void Window_Closing(object sender,
                                    System.ComponentModel.CancelEventArgs e)
        {
            if (bodyIndexFrameReader != null)
            {
                bodyIndexFrameReader.Dispose();
                bodyIndexFrameReader = null;
            }

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

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

            if (kinect != null)
            {
                kinect.Close();
                kinect = null;
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Windowが閉じるときの処理(終了処理)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            StopWatch.Stop();

            if (sw != null)
            {
                sw.Close();
            }

            if (Directory.Exists(@pathSaveFolder))
            {
                //Directoryの名前変更
                //Directory.Move(@pathSaveFolder, dateFolderName+"fin/");
            }

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

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

            if (kinect != null)
            {
                kinect.Close();
                kinect = null;
            }
        }
Exemplo n.º 9
0
    void OnApplicationQuit()
    {
        if (CurrentFaceModel != null)
        {
            CurrentFaceModel.Dispose();
            CurrentFaceModel = null;
        }

        highDefinitionFaceFrameSource = null;

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

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

        if (_Sensor != null)
        {
            if (_Sensor.IsOpen)
            {
                _Sensor.Close();
            }

            _Sensor = null;
        }
    }
 public void Close()
 {
     depthReader.Dispose();
     colorReader.Dispose();
     bodyReader.Dispose();
     sensor.Close();
 }
Exemplo n.º 11
0
        private void Window_Unloaded(object sender, RoutedEventArgs e)
        {
            socket.Disconnect();

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

            if (_sensor != null)
            {
                _sensor.Close();
            }

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


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

            if (_faceSource != null)
            {
                _faceSource.Dispose();
                _faceSource = null;
            }
        }
Exemplo n.º 12
0
        public void Close()
        {
            if (colorFrameReader != null)
            {
                colorFrameReader.Dispose();
                colorFrameReader = null;
            }

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

            if (kinect != null)
            {
                kinect.Close();
                kinect = null;
            }

            if (record != null)
            {
                record.Close();
            }

            if (gesture != null)
            {
                gesture.Close();
            }
        }
Exemplo n.º 13
0
 /// <summary>
 /// Disables the skeleton stream
 /// </summary>
 public void stopBodyStream()
 {
     if (null != sensor)
     {
         bodyFrameReader.Dispose();
     }
 }
Exemplo n.º 14
0
        // Free up the resources upon leaving this screen
        private void Page_Unloaded(object sender, RoutedEventArgs e)
        {
            currFaceState = FaceState.None;
            if (_faceReader != null)
            {
                _faceReader.Dispose();
            }

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

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

            if (_sensor != null)
            {
                _sensor.Close();
            }

            GC.SuppressFinalize(this);
        }
        private void Page_Unloaded(object sender, RoutedEventArgs e)
        {
            _settingsVM.SaveContext(SETTINGS_FILENAME);

            if (_faceFrameReader != null)
            {
                this._faceFrameReader.Dispose();
                this._faceFrameReader = null;
            }

            if (_faceFrameSource != null)
            {
                _faceFrameSource = null;
            }


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

            if (_sensor != null)
            {
                _sensor.Close();
            }
        }
 /// <summary>
 /// Stops this handler
 /// </summary>
 public override void Stop()
 {
     if (reader != null)
     {
         reader.Dispose();
     }
 }
Exemplo n.º 17
0
    void OnApplicationQuit()
    {
        if (_Reader != null)
        {
            _Reader.Dispose();
            _Reader = null;
        }

        for (int i = 0; i < bodyCount; i++)
        {
            if (faceFrameReaders[i] != null)
            {
                faceFrameReaders[i].Dispose();
                faceFrameReaders[i] = null;
            }
        }

        if (_Sensor != null)
        {
            if (_Sensor.IsOpen)
            {
                _Sensor.Close();
            }

            _Sensor = null;
        }
    }
Exemplo n.º 18
0
        protected override void OnNavigatingFrom(
            NavigatingCancelEventArgs e)
        {
            base.OnNavigatingFrom(e);

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

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

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

            if (kinect != null)
            {
                kinect.Close();
                kinect = null;
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// Close opened reader and sensors.
        /// </summary>
        public void Close()
        {
            if (_multiFrameReader != null)
            {
                _multiFrameReader.MultiSourceFrameArrived -= MultiFrameArrived;
                _multiFrameReader.Dispose();
                _multiFrameReader = null;
            }

            if (_colorFrameReader != null)
            {
                _colorFrameReader.FrameArrived -= ColorFrameArrived;
                _colorFrameReader.Dispose();
                _colorFrameReader = null;
            }

            if (_bodyFrameReader != null)
            {
                _bodyFrameReader.FrameArrived -= BodyFrameArrived;
                _bodyFrameReader.Dispose();
                _bodyFrameReader = null;
            }

            if (!_kinectUsedExternally)
            {
                _kinectSensor?.Close();
            }
        }
Exemplo n.º 20
0
        // sensor value position at times.
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (_colorReader != null)
            {
                _colorReader.Dispose();
                _colorReader = null;
            }

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

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

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

            if (_sensor != null)
            {
                _sensor.Close();
            }
        }
Exemplo n.º 21
0
 void OnApplicationQuit()
 {
     Reader.Dispose();
     if (Sensor.IsOpen)
     {
         Sensor.Close();
     }
 }
Exemplo n.º 22
0
    void OnDestroy()
    {
        bodyFrameReader?.Dispose();
        bodyFrameReader = null;

        kinect?.Close();
        kinect = null;
    }
        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();
        }
Exemplo n.º 24
0
    public void DisposeBodyManager()
    {
        if (_Reader != null)
        {
            _Reader.Dispose();
            _Reader = null;
            _Sensor = null;
            GC.SuppressFinalize(this);
        }

        if (_Sensor != null)
        {
            if (_Sensor.IsOpen)
            {
                _Sensor.Close();
            }

            _Sensor = null;
        }

        _Sensor = KinectSensor.GetDefault();

        if (_Sensor != null)
        {
            _Reader = _Sensor.BodyFrameSource.OpenReader();

            if (_Data == null)
            {
                Debug.Log("_bodies: " + GetData());

                _Data = new Body[_Sensor.BodyFrameSource.BodyCount];                 // evtl hier in "new Body[1]" einsetzen
//				_Data = new Body[1]; // evtl hier in "new Body[1]" einsetzen
                Debug.Log("_bodies new: " + GetData());
                Debug.Log("_bodies new lengt: " + GetData().Length);
            }

            if (!_Sensor.IsOpen)
            {
                _Sensor.Open();
            }
        }
    }
        public void StopWatching()
        {
            if (bodyFrameReader != null)
            {
                bodyFrameReader.FrameArrived -= BodyFrameReader_FrameArrived;
                bodyFrameReader.Dispose();
                bodyFrameReader = null;
            }

            sensor.Close();
        }
Exemplo n.º 26
0
 public void Close()
 {
     bfReader?.Dispose();
     try {
         kSensor?.Close();
     } catch { }
     if (kinect != null)
     {
         kinect = null;
     }
 }
Exemplo n.º 27
0
    public void CloseSensor(KinectInterop.SensorData sensorData)
    {
        if (coordMapper != null)
        {
            coordMapper = null;
        }

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

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

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

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

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

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

        if (kinectSensor != null)
        {
            if (kinectSensor.IsOpen)
            {
                kinectSensor.Close();
            }

            kinectSensor = null;
        }
    }
Exemplo n.º 28
0
        void Uninitialize()
        {
            // 終了処理
            if (bodyFrameReader != null)
            {
                bodyFrameReader.FrameArrived -= bodyFrameReader_FrameArrived;
                bodyFrameReader.Dispose();
                bodyFrameReader = null;
            }

            CanvasBody.Children.Clear();
            TextFps.Text = "0";
        }
    private void OnDestroy()
    {
        if (bodyFrameReader != null)
        {
            bodyFrameReader.Dispose();
            bodyFrameReader = null;
        }

        //if (sensor != null)
        //{

        //}
    }
Exemplo n.º 30
0
 public void Stop()
 {
     if (_sensor.IsOpen)
     {
         _sensor.Close();
         if (_reader != null)
         {
             _reader.Dispose();
         }
         _started = false;
     }
     _bodyControllers = new List <BodyController>();
 }