public void Evaluate(int SpreadMax) { if (this.FInvalidateConnect) { if (this.FInRuntime.PluginIO.IsConnected) { //Cache runtime node this.runtime = this.FInRuntime[0]; if (runtime != null) { faceSrc = new Microsoft.Kinect.Face.FaceFrameSource(this.runtime.Runtime); faceSrc.FaceFrameFeatures = FaceFrameFeatures.BoundingBoxInInfraredSpace | FaceFrameFeatures.BoundingBoxInColorSpace; faceReader = faceSrc.OpenReader(); faceReader.FrameArrived += this.faceReader_FrameArrived; /* hdSrc = new HighDefinitionFaceFrameSource(this.runtime.Runtime); * hdRead = hdSrc.OpenReader(); * hdRead.FrameArrived += hdRead_FrameArrived;*/ } } else { if (faceSrc != null) { faceReader.FrameArrived -= faceReader_FrameArrived; faceReader.Dispose(); } } this.FInvalidateConnect = false; } }
private void DisposeOfObjects() { engine.Dispose(); engine = null; closeFile(); m_colorBitmap = null; m_FaceSource.Dispose(); m_FaceSource = null; m_FaceReader.Dispose(); m_FaceReader = null; m_currentTrackedBody = null; m_MSFReader.Dispose(); m_MSFReader = null; m_CoordMapper = null; m_Sensor.Close(); m_Sensor = null; }