Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GestureController"/> class.
        /// </summary>
        public GestureController()
        {
            gestureGroups = new List<GestureGroup>();
            for (int i = 0; i < 6; i++)
            {
                // For each of the six possible skeletons, we create a gesture group, and add the gestures we will check for.
                GestureGroup gestureGroup = new GestureGroup();

                // Define the gestures
                // Each gesture monitors one hand, and each can trigger a GestureRecognized event independently.
                IRelativeGestureSegment[] waveRightSegments = new IRelativeGestureSegment[4];
                WaveRightSegment1 waveRightSegment1 = new WaveRightSegment1();
                WaveRightSegment2 waveRightSegment2 = new WaveRightSegment2();
                waveRightSegments[0] = waveRightSegment1;
                waveRightSegments[1] = waveRightSegment2;
                waveRightSegments[2] = waveRightSegment1;
                waveRightSegments[3] = waveRightSegment2;
                Gesture gesture = new Gesture(GestureType.WaveRight, waveRightSegments);
                gesture.GestureRecognized += OnGestureRecognized;
                gestureGroup.gestures.Add(gesture);

                IRelativeGestureSegment[] waveLeftSegments = new IRelativeGestureSegment[4];
                WaveLeftSegment1 waveLeftSegment1 = new WaveLeftSegment1();
                WaveLeftSegment2 waveLeftSegment2 = new WaveLeftSegment2();
                waveLeftSegments[0] = waveLeftSegment1;
                waveLeftSegments[1] = waveLeftSegment2;
                waveLeftSegments[2] = waveLeftSegment1;
                waveLeftSegments[3] = waveLeftSegment2;
                gesture = new Gesture(GestureType.WaveLeft, waveLeftSegments);
                gesture.GestureRecognized += OnGestureRecognized;
                gestureGroup.gestures.Add(gesture);

                gestureGroups.Add(gestureGroup);
            }
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GestureController"/> class.
        /// </summary>
        public GestureController()
        {
            gestureGroups = new List <GestureGroup>();
            for (int i = 0; i < 6; i++)
            {
                // For each of the six possible skeletons, we create a gesture group, and add the gestures we will check for.
                GestureGroup gestureGroup = new GestureGroup();

                // Define the gestures
                // Each gesture monitors one hand, and each can trigger a GestureRecognized event independently.
                IRelativeGestureSegment[] waveRightSegments = new IRelativeGestureSegment[4];
                WaveRightSegment1         waveRightSegment1 = new WaveRightSegment1();
                WaveRightSegment2         waveRightSegment2 = new WaveRightSegment2();
                waveRightSegments[0] = waveRightSegment1;
                waveRightSegments[1] = waveRightSegment2;
                waveRightSegments[2] = waveRightSegment1;
                waveRightSegments[3] = waveRightSegment2;
                Gesture gesture = new Gesture(GestureType.WaveRight, waveRightSegments);
                gesture.GestureRecognized += OnGestureRecognized;
                gestureGroup.gestures.Add(gesture);


                IRelativeGestureSegment[] waveLeftSegments = new IRelativeGestureSegment[4];
                WaveLeftSegment1          waveLeftSegment1 = new WaveLeftSegment1();
                WaveLeftSegment2          waveLeftSegment2 = new WaveLeftSegment2();
                waveLeftSegments[0]        = waveLeftSegment1;
                waveLeftSegments[1]        = waveLeftSegment2;
                waveLeftSegments[2]        = waveLeftSegment1;
                waveLeftSegments[3]        = waveLeftSegment2;
                gesture                    = new Gesture(GestureType.WaveLeft, waveLeftSegments);
                gesture.GestureRecognized += OnGestureRecognized;
                gestureGroup.gestures.Add(gesture);

                gestureGroups.Add(gestureGroup);
            }
        }