Пример #1
0
        internal void Close()
        {
            // NOTE: Stop gesture recognition, if the host application is not running.
            if (Settings != null)
            {
                Settings.IsToDetectFacesOnDevice.Value = false;
                // NOTE: If the firmware version is larger than 1.1, stopping hand detection changes the LED color from blue to red.
                Settings.IsToDetectHandsOnDevice.Value = false;
            }
            if (FaceDetectionOnHost != null)
            {
                FaceDetectionOnHost.Dispose(); FaceDetectionOnHost = null;
            }

            // static event
            Microsoft.Win32.SystemEvents.DisplaySettingsChanged -= EgsGestureHidReport.OnDisplaySettingsChanged;
            if (CameraViewImageSourceBitmapCapture != null)
            {
                CameraViewImageSourceBitmapCapture.DisposeWithClearingVideoCaptureDeviceInformationOnDeviceDisconnected();
                // TODO: FIX: The next line can cause exception, in the other threads or in getting images with a Timer.
                CameraViewImageSourceBitmapCapture = null;
            }
            if (HidReportsUpdate != null)
            {
                HidReportsUpdate.OnDisable();
                HidReportsUpdate = null;
            }
        }
Пример #2
0
 /// <summary>
 /// This method should be called only from EgsDevicesManager.  This updates only connection state of "Camera".
 /// </summary>
 internal void SetIsCameraDeviceConnectedToFalse()
 {
     Debug.WriteLine("[EgsDevice] TrySetIsConnectedToFalse() called.  DateTime.Now = " + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.fff", CultureInfo.InvariantCulture));
     // This also updates CameraViewImageSourceBitmapCapture.IsCameraDeviceConnected
     if (CameraViewImageSourceBitmapCapture.IsCameraDeviceConnected)
     {
         CameraViewImageSourceBitmapCapture.DisposeWithClearingVideoCaptureDeviceInformationOnDeviceDisconnected();
     }
     CameraViewImageSourceBitmapCapture.UpdateIsUpdatingImageSource();
     ResetHidReportObjects();
 }