Beispiel #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;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Call this method about all registered devices, after calling MessageReceivingForm.SetupDi.Update(); in EgsDevicesManagers
        /// </summary>
        internal void UpdateHidDeviceConnectionStatus()
        {
            // TODO: It should be able to use multiple devices, even if "ProductId" is changed in future.  If the app checks them, the place may be here.
            var newDevicePath = refToSetupDi.GetHidDevicePath(IndexInHidDevicePathList);

            if (string.IsNullOrEmpty(newDevicePath))
            {
                _HidDeviceDevicePath = "";
                // NOTE: When the device is disconnected, the ReportMonitoringThread must be completed.
                if (HidReportsUpdate != null)
                {
                    HidReportsUpdate.OnDisable();
                }
                _IsHidDeviceConnected = false;
            }
            else
            {
                _HidDeviceDevicePath = newDevicePath;
                if (HidReportsUpdate != null)
                {
                    HidReportsUpdate.Start(_HidDeviceDevicePath);
                }
                _IsHidDeviceConnected = true;
                SetAllSettingsToDeviceAndReadStatusFromDevice();
            }

            OnHidDeviceDevicePathChanged(EventArgs.Empty);
            OnIsHidDeviceConnectedChanged(EventArgs.Empty);
        }
 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 (HidReportsUpdate != null)
     {
         HidReportsUpdate.OnDisable();
         HidReportsUpdate = null;
     }
 }