void OnPropertiesRelatedToFaceDetectionAndIsToDetectHandsOnDeviceChanged()
 {
     if (CurrentConnectedEgsDevice == null)
     {
         if (ApplicationCommonSettings.IsDebugging)
         {
             Debugger.Break();
         }
         return;
     }
     CurrentConnectedEgsDevice.On_FaceDetectionMethod_IsToDetectFaces_IsToDetectHands_IsHidDeviceConnected_Changed();
     CurrentConnectedEgsDevice.ResetHidReportObjects();
 }
Exemplo n.º 2
0
        internal void AttachInternalEventHandlers()
        {
            foreach (var item in HidAccessPropertyList)
            {
                item.ValueUpdated += delegate
                {
                    if (CurrentConnectedEgsDevice == null)
                    {
                        return;
                    }
                    HidAccessPropertyUpdatedEventArgs e = new HidAccessPropertyUpdatedEventArgs(item);
                    OnHidAccessPropertyUpdated(e);
                };
            }

            CaptureExposureMode.ValueUpdated += delegate
            {
                OnPropertyChanged(nameof(IsCaptureExposureModeManual));
            };
            FaceDetectionMethod.ValueUpdated += delegate
            {
                OnPropertyChanged(nameof(IsFaceDetectionMethodDefaultProcessOnEgsDevice));
                OnPropertyChanged(nameof(IsFaceDetectionMethodDefaultProcessOnEgsHostApplication));
            };

            TouchInterfaceKind.ValueUpdated += (sender, e) =>
            {
                switch (TouchInterfaceKind.Value)
                {
                case PropertyTypes.TouchInterfaceKinds.MultiTouch:
                    TrackableHandsCount.Value = 2;
                    break;

                case PropertyTypes.TouchInterfaceKinds.SingleTouch:
                    TrackableHandsCount.Value = 1;
                    break;

                case PropertyTypes.TouchInterfaceKinds.Mouse:
                    TrackableHandsCount.Value = 1;
                    break;

                default:
                    Debug.WriteLine(string.Format(System.Globalization.CultureInfo.InvariantCulture, "TouchInterfaceKind: {0}", TouchInterfaceKind.Value));
                    break;
                }
                if (CurrentConnectedEgsDevice != null)
                {
                    CurrentConnectedEgsDevice.ResetHidReportObjects();
                }
            };

            CursorSpeedAndPrecisionMode.ValueUpdated += (sender, e) =>
            {
                // TODO: test
                switch (CursorSpeedAndPrecisionMode.Value)
                {
                case CursorSpeedAndPrecisionModes.Beginner:
                case CursorSpeedAndPrecisionModes.Standard:
                    FastMovingHandsGestureMode.Value = FastMovingHandsGestureModes.None;
                    break;

                case CursorSpeedAndPrecisionModes.FruitNinja:
                    FastMovingHandsGestureMode.Value = FastMovingHandsGestureModes.Touch;
                    break;

                default:
                    Debug.WriteLine(string.Format(System.Globalization.CultureInfo.InvariantCulture, "CursorSpeedAndPrecisionMode: {0}", CursorSpeedAndPrecisionMode.Value));
                    break;
                }
                if (CurrentConnectedEgsDevice != null)
                {
                    CurrentConnectedEgsDevice.ResetHidReportObjects();
                }
            };

            CaptureImageSize.ValueUpdated += delegate { OnImageSizeRelatedPropertiesUpdated(); };
            CameraViewImageSourceBitmapSize.ValueUpdated += delegate { OnImageSizeRelatedPropertiesUpdated(); };

            // NOTE: this property depends on CaptureImageSize and CameraViewImageSourceBitmapSize.  So ValueUpdate event handler is unnecessary.
            if (false)
            {
                CameraViewImageSourceRectInCaptureImage.ValueUpdated += delegate { OnImageSizeRelatedPropertiesUpdated(); };
            }

            OnImageSizeRelatedPropertiesUpdated();
        }