Ejemplo n.º 1
0
 /// <summary>
 /// handles GestureRecognized event and resets all gestures
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void WhenGestureRecognized(object sender, GestureEventArgs e)
 {
     if (this.GestureRecognized != null)
     {
         this.GestureRecognized(this, e);
     }
     foreach (Gesture g in this.gestures)
     {
         g.Reset();
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// method for actions taken when a gesture is recognized
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void WhenGestureRecognized(object sender, GestureEventArgs e)
        {
            //audioThread = new Thread(startAudioListening);
            //audioThread.Start();
            //initializeSpeech();
            //startAudioListening();

            /// disable gesture service
            // GestureServiceOff();
            /// output gesture type to console
            mostRecentGesture = e.gestureType;
            System.Console.Write(e.gestureType + "\n");
            /// MessageBox.Show(e.gestureType);
            ///
            if (!inSpeech)
            {
                /// spin wheel
                if (e.gestureType == "swipe_left" || e.gestureType == "swipe_right" ||
                    e.gestureType == "kick_left" || e.gestureType == "kick_right")
                {
                    double randomDouble; ;
                    Random random = new Random();
                    randomDouble = 180.00 + random.NextDouble() * 720;
                    this.findBodyPart(randomDouble);
                    if (e.gestureType == "swipe_left" || e.gestureType == "kick_left")
                    {
                        randomDouble *= -1;
                    }
                    this.spinWheel(randomDouble);
                    initializeSpeech();
                    startAudioListening();
                }
            }
            else
            {
                if (e.gestureType == "raise_hand_right")
                {
                    armConfirm = 1;
                }
            }
        }