private void Clean() { if (swipeGestureRecognizer != null) { swipeGestureRecognizer.OnGestureDetected -= OnGestureDetected; } if (audioManager != null) { audioManager.Dispose(); audioManager = null; } if (parallelCombinedGestureDetector != null) { parallelCombinedGestureDetector.Remove(swipeGestureRecognizer); parallelCombinedGestureDetector.Remove(circleGestureRecognizer); parallelCombinedGestureDetector.Remove(triangleGestureRecognizer); parallelCombinedGestureDetector = null; //Add Triangle } CloseGestureDetector(); ClosePostureDetector(); if (voiceCommander != null) { voiceCommander.OrderDetected -= voiceCommander_OrderDetected; voiceCommander.Stop(); voiceCommander = null; } if (recorder != null) { recorder.Stop(); recorder = null; } if (eyeTracker != null) { eyeTracker.Dispose(); eyeTracker = null; } if (kinectSensor != null) { kinectSensor.DepthFrameReady -= kinectSensor_DepthFrameReady; kinectSensor.SkeletonFrameReady -= kinectRuntime_SkeletonFrameReady; kinectSensor.ColorFrameReady -= kinectRuntime_ColorFrameReady; kinectSensor.Stop(); kinectSensor = null; } }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { CloseGestureDetector(); ClosePostureDetector(); voiceCommander.Stop(); if (recorder != null) { recorder.Stop(); } }