/// <summary>
 /// Invokes the <see cref="GestureDetected"/> event.
 /// </summary>
 /// <param name="gestureId"></param>
 protected void OnGestureDetected(GestureId gestureId)
 {
     if (GestureDetected != null)
     {
         GestureDetected.Invoke(gestureId);
     }
 }
Пример #2
0
        /// <summary>
        /// Invokes the <see cref="SensorsUpdated"/> event.
        /// If the frame contains a gesture, also invokes the <see cref="GestureDetected"/> event.
        /// </summary>
        /// <param name="frame"></param>
        private void OnSensorsUpdated(SensorFrame frame)
        {
            if (SensorsUpdated != null)
            {
                SensorsUpdated.Invoke(frame);
            }

            if (frame.gestureId != GestureId.None)
            {
                if (GestureDetected != null)
                {
                    GestureDetected.Invoke(frame.gestureId);
                }

                switch (frame.gestureId)
                {
                case GestureId.DoubleTap:
                    if (DoubleTapDetected != null)
                    {
                        DoubleTapDetected.Invoke();
                    }
                    break;

                case GestureId.None:
                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
        }
Пример #3
0
        public void Dispose()
        {
            if (Sensor != null)
            {
                Sensor.Dispose();
            }
            if (SpeechRecognizer != null)
            {
                SpeechRecognizer.Dispose();
            }
            SpeechRecognizer = null;
            Sensor           = null;

            skeletons = null;

            foreach (var item in SpeechRecognized.GetInvocationList())
            {
                SpeechRecognized -= (EventHandler <VoiceCommandEventArgs>)item;
            }
            foreach (var item in GestureDetected.GetInvocationList())
            {
                GestureDetected -= (EventHandler <GestureDetectedEventArgs>)item;
            }
        }