private void OnDestroy() { if (_videoCapture != null) { _videoCapture.FrameSampleAcquired -= OnFrameSampleAcquired; _videoCapture.Dispose(); } }
private void OnDestroy() { if (_videoCapture == null) { return; } _videoCapture.FrameSampleAcquired += null; _videoCapture.Dispose(); }
/// <summary> /// Raises the destroy event. /// </summary> protected override void OnDestroy() { Dispose(); if (videoCapture != null) { if (videoCapture.IsStreaming) { videoCapture.StopVideoModeAsync(result => { videoCapture.Dispose(); videoCapture = null; }); } else { videoCapture.Dispose(); videoCapture = null; } } }