private void RaiseSynchronizeGesturesActivation(object sender, SynchronizeGesturesStateEventArgs e) { if (SynchronizeGesturesState != null) { SynchronizeGesturesState(sender, e); } }
/// <summary> /// Callback when a gesture state is modified during operation of the engine /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnSynchronizeGesturesState(object sender, SynchronizeGesturesStateEventArgs e) { switch (e.GestureName) { case "SwipeLeft": if (!PropertiesPluginKinect.Instance.EnableGestureSwipeLeft) { if (!PropertiesPluginKinect.Instance.EnableGestureSwipeRight && m_refSwipeHandLeftChecker != null && m_refSwipeHandRightChecker != null) { DisableGestureChecker(m_refSwipeHandLeftChecker); DisableGestureChecker(m_refSwipeHandRightChecker); } } else { if (!PropertiesPluginKinect.Instance.EnableGestureSwipeRight) { m_refSwipeHandRightChecker = new SwipeGestureChecker(m_refUser, JointType.HandRight); EnableGestureChecker(m_refSwipeHandRightChecker); m_refSwipeHandLeftChecker = new SwipeGestureChecker(m_refUser, JointType.HandLeft); EnableGestureChecker(m_refSwipeHandLeftChecker); } } break; case "SwipeRight": if (!PropertiesPluginKinect.Instance.EnableGestureSwipeRight) { if (!PropertiesPluginKinect.Instance.EnableGestureSwipeLeft && m_refSwipeHandLeftChecker != null && m_refSwipeHandRightChecker != null) { DisableGestureChecker(m_refSwipeHandLeftChecker); DisableGestureChecker(m_refSwipeHandRightChecker); } } else { if (!PropertiesPluginKinect.Instance.EnableGestureSwipeLeft) { m_refSwipeHandRightChecker = new SwipeGestureChecker(m_refUser, JointType.HandRight); EnableGestureChecker(m_refSwipeHandRightChecker); m_refSwipeHandLeftChecker = new SwipeGestureChecker(m_refUser, JointType.HandLeft); EnableGestureChecker(m_refSwipeHandLeftChecker); } } break; case "Wave": if (!PropertiesPluginKinect.Instance.EnableGestureWave) { DisableGestureChecker(m_refHandLeftWaveChecker); DisableGestureChecker(m_refHandRightWaveChecker); } else { m_refHandRightWaveChecker = new WaveGestureChecker(m_refUser, JointType.HandRight); EnableGestureChecker(m_refHandLeftWaveChecker); m_refHandLeftWaveChecker = new WaveGestureChecker(m_refUser, JointType.HandLeft); EnableGestureChecker(m_refHandRightWaveChecker); } break; case "Grip": if (!PropertiesPluginKinect.Instance.EnableGestureGrip) { // Nothing to do ? } break; case "Push": if (!PropertiesPluginKinect.Instance.EnableGesturePush) { DisableGestureChecker(m_refPushLeftHandGestureChecker); DisableGestureChecker(m_refPushRightHandGestureChecker); } else { m_refPushRightHandGestureChecker = new PushGestureChecker(m_refUser, JointType.HandRight); EnableGestureChecker(m_refPushRightHandGestureChecker); m_refPushLeftHandGestureChecker = new PushGestureChecker(m_refUser, JointType.HandLeft); EnableGestureChecker(m_refPushLeftHandGestureChecker); } break; case "Maximize": if (!PropertiesPluginKinect.Instance.EnableGestureMaximize) { DisableGestureChecker(m_refMaximizeGestureChecker); } else { m_refMaximizeGestureChecker = new MaximizeGestureChecker(m_refUser); EnableGestureChecker(m_refMaximizeGestureChecker); } break; case "Minimize": if (!PropertiesPluginKinect.Instance.EnableGestureMinimize) { DisableGestureChecker(m_refMinimizeGestureChecker); } else { m_refMinimizeGestureChecker = new MinimizeGestureChecker(m_refUser); EnableGestureChecker(m_refMinimizeGestureChecker); } break; case "A": if (!PropertiesPluginKinect.Instance.EnablePostureA) { DisablePostureChecker(m_refPostureAChecker); } else { m_refPostureAChecker = new PostureAChecker(m_refUser); EnablePostureChecker(m_refPostureAChecker); } break; case "Home": if (!PropertiesPluginKinect.Instance.EnablePostureHome) { DisableGestureChecker(m_refPostureHomeChecker); } else { m_refPostureHomeChecker = new PostureHomeChecker(m_refUser); EnablePostureChecker(m_refPostureHomeChecker); } break; case "Stay": if (!PropertiesPluginKinect.Instance.EnablePostureStay) { DisablePostureChecker(m_refPostureHomeChecker); } else { m_refPostureHomeChecker = new PostureHomeChecker(m_refUser); EnablePostureChecker(m_refPostureHomeChecker); } break; case "T": if (!PropertiesPluginKinect.Instance.EnablePostureT) { DisablePostureChecker(m_refPostureTChecker); } else { m_refPostureTChecker = new PostureTChecker(m_refUser); EnablePostureChecker(m_refPostureTChecker); } break; case "U": if (!PropertiesPluginKinect.Instance.EnablePostureU) { DisablePostureChecker(m_refPostureUChecker); } else { m_refPostureUChecker = new PostureUChecker(m_refUser); EnablePostureChecker(m_refPostureUChecker); } break; case "V": if (!PropertiesPluginKinect.Instance.EnablePostureV) { DisablePostureChecker(m_refPostureVChecker); } else { m_refPostureVChecker = new PostureVChecker(m_refUser); EnablePostureChecker(m_refPostureVChecker); } break; case "Wait": if (!PropertiesPluginKinect.Instance.EnablePostureWait) { DisablePostureChecker(m_refPostureWaitChecker); } else { m_refPostureWaitChecker = new PostureWaitChecker(m_refUser); EnablePostureChecker(m_refPostureWaitChecker); } break; } }