コード例 #1
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;
        }
    }
コード例 #2
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);
        }
コード例 #3
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;
     }
 }
コード例 #4
0
    protected virtual void OnApplicationQuit()
    {
        if (bodyFrameReader != null)
        {
            bodyFrameReader.Dispose();
            bodyFrameReader = null;
        }

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

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

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

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

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

        if (frameView != null)
        {
            frameView.FrameTexture = null;
        }

        if (KinectSensor != null && KinectSensor.IsOpen)
        {
            KinectSensor.Close();
            KinectSensor = null;
        }
    }
コード例 #5
0
    private void Dispose(bool disposing)
    {
        if (Disposed)
        {
            return;
        }

        if (disposing)
        {
            //Free any other managed objects here...

            ClosePipes();

            Client.CloseMainWindow();
            Client.Close();
            Client.Dispose();
            Client = null;

            SpeechSynthesizer.SpeakAsyncCancelAll();
            SpeechSynthesizer.Dispose();
            SpeechSynthesizer = null;

            SpeechRecognitionEngine.RecognizeAsyncStop();
            SpeechRecognitionEngine.Dispose();
            SpeechRecognitionEngine = null;

            HighDefinitionFaceFrameReader.Dispose();
            HighDefinitionFaceFrameReader = null;
            HighDefinitionFaceFrameSource = null;

            BodyFrameReader.Dispose();
            BodyFrameReader = null;
            BodyFrameSource = null;

            KinectSensor.Close();
            KinectSensor = null;

            Form.Close();
            Form.Dispose();
            Form = null;
        }

        //Free any unmanaged objects here...

        Disposed = true;
    }
コード例 #6
0
 void OnApplicationQuit()
 {
     if (bodyReader != null)
     {
         bodyReader.Dispose();
         bodyReader = null;
     }
     if (hdFaceFrameReader != null)
     {
         hdFaceFrameReader.Dispose();
         hdFaceFrameReader = null;
     }
     if (sensor == null)
     {
         if (sensor.IsOpen)
         {
             sensor.Close();
         }
         sensor = null;
     }
 }
コード例 #7
0
        public void Dispose()
        {
            if (bodyFrameReader != null)
            {
                bodyFrameReader.Dispose();
                bodyFrameReader = null;
            }

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

            setColorFeedEnabled(false, activeSensor);

            if (activeSensor != null)
            {
                activeSensor.Close();
                activeSensor = null;
                Connected    = false;
            }
        }
コード例 #8
0
        void IFaceCamera <System.Drawing.PointF> .Stop()
        {
            if (_bodyReader != null)
            {
                _bodyReader.Dispose();
                _bodyReader = null;
            }

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

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

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

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

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