예제 #1
0
        /// <summary>
        /// Helper function to register all available
        /// </summary>
        private void RegisterGestures()
        {
            // define the gestures for the demo
            IRelativeGestureSegment[] mouseClick = new IRelativeGestureSegment[2];
            mouseClick[0] = new MouseClick();
            mouseClick[1] = new MouseClick2();
            gestureController.AddGesture("MouseClick", mouseClick);

            IRelativeGestureSegment[] mouseDownSegments = new IRelativeGestureSegment[2];
            mouseDownSegments[0] = new MouseDown();
            mouseDownSegments[1] = new MouseDown2();
            gestureController.AddGesture("MouseDown", mouseDownSegments);

            IRelativeGestureSegment[] mouseUpSegments = new IRelativeGestureSegment[2];
            mouseUpSegments[0] = new MouseUp();
            mouseUpSegments[1] = new MouseUp2();
            gestureController.AddGesture("MouseUp", mouseUpSegments);

            IRelativeGestureSegment[] handtoear = new IRelativeGestureSegment[50];
            for (int i = 0; i < handtoear.Count(); i++)
            {
                handtoear[i] = new HandToEar();
            }
            gestureController.AddGesture("HandtoEar", handtoear);

            IRelativeGestureSegment[] swipeleftSegments = new IRelativeGestureSegment[3];
            swipeleftSegments[0] = new SwipeLeftSegment1();
            swipeleftSegments[1] = new SwipeLeftSegment2();
            swipeleftSegments[2] = new SwipeLeftSegment3();
            gestureController.AddGesture("SwipeLeft", swipeleftSegments);

            IRelativeGestureSegment[] swiperightSegments = new IRelativeGestureSegment[3];
            swiperightSegments[0] = new SwipeRightSegment1();
            swiperightSegments[1] = new SwipeRightSegment2();
            swiperightSegments[2] = new SwipeRightSegment3();
            gestureController.AddGesture("SwipeRight", swiperightSegments);

            IRelativeGestureSegment[] waveLeftSegments = new IRelativeGestureSegment[5];
            WaveLeftSegment1          waveLeftSegment1 = new WaveLeftSegment1();
            WaveLeftSegment2          waveLeftSegment2 = new WaveLeftSegment2();

            waveLeftSegments[0] = waveLeftSegment1;
            waveLeftSegments[1] = waveLeftSegment2;
            waveLeftSegments[2] = waveLeftSegment1;
            waveLeftSegments[3] = waveLeftSegment2;
            // waveLeftSegments[4] = waveLeftSegment1;
            //waveLeftSegments[5] = waveLeftSegment2;
            gestureController.AddGesture("WaveLeft", waveLeftSegments);

            IRelativeGestureSegment[] zoomInSegments = new IRelativeGestureSegment[3];
            zoomInSegments[0] = new ZoomSegment1();
            zoomInSegments[1] = new ZoomSegment2();
            zoomInSegments[2] = new ZoomSegment3();
            gestureController.AddGesture("ZoomIn", zoomInSegments);

            IRelativeGestureSegment[] scrolldownsegments = new IRelativeGestureSegment[4];
            scrolldownsegments[0] = new ScrollDown1();
            scrolldownsegments[1] = new ScrollDown2();
            scrolldownsegments[2] = new ScrollDown3();
            scrolldownsegments[3] = new ScrollDown4();
            gestureController.AddGesture("ScrollDown", scrolldownsegments);

            IRelativeGestureSegment[] scrollupsegments = new IRelativeGestureSegment[4];
            scrollupsegments[0] = new ScrollUp1();
            scrollupsegments[1] = new ScrollUp2();
            scrollupsegments[2] = new ScrollUp3();
            scrollupsegments[3] = new ScrollUp4();
            gestureController.AddGesture("ScrollUp", scrollupsegments);

            /*IRelativeGestureSegment[] zoomInSegments = new IRelativeGestureSegment[3];
             * zoomInSegments[0] = new ZoomSegment1();
             * zoomInSegments[1] = new ZoomSegment2();
             * zoomInSegments[2] = new ZoomSegment3();
             * gestureController.AddGesture("ZoomIn", zoomInSegments);
             *
             * IRelativeGestureSegment[] zoomOutSegments = new IRelativeGestureSegment[3];
             * zoomOutSegments[0] = new ZoomSegment3();
             * zoomOutSegments[1] = new ZoomSegment2();
             * zoomOutSegments[2] = new ZoomSegment1();
             * gestureController.AddGesture("ZoomOut", zoomOutSegments);*/

            IRelativeGestureSegment[] swipeUpSegments = new IRelativeGestureSegment[3];
            swipeUpSegments[0] = new SwipeUpSegment1();
            swipeUpSegments[1] = new SwipeUpSegment2();
            swipeUpSegments[2] = new SwipeUpSegment3();
            gestureController.AddGesture("SwipeUp", swipeUpSegments);

            IRelativeGestureSegment[] swipeDownSegments = new IRelativeGestureSegment[3];
            swipeDownSegments[0] = new SwipeDownSegment1();
            swipeDownSegments[1] = new SwipeDownSegment2();
            swipeDownSegments[2] = new SwipeDownSegment3();
            gestureController.AddGesture("SwipeDown", swipeDownSegments);

            IRelativeGestureSegment[] volumeIncrease = new IRelativeGestureSegment[15];
            for (int i = 0; i < volumeIncrease.Count(); i++)
            {
                volumeIncrease[i] = new volumeUp();
            }
            gestureController.AddGesture("VolumeUp", volumeIncrease);

            IRelativeGestureSegment[] volumeDecrease = new IRelativeGestureSegment[15];
            for (int i = 0; i < volumeDecrease.Count(); i++)
            {
                volumeDecrease[i] = new volumeDown();
            }
            gestureController.AddGesture("VolumeDown", volumeDecrease);
        }
예제 #2
0
        /// <summary>
        /// Helper function to register all available
        /// </summary>
        private void RegisterGestures()
        {
            // define the gestures for the demo
            IRelativeGestureSegment[] mouseClick = new IRelativeGestureSegment[2];
            mouseClick[0] = new MouseClick();
            mouseClick[1] = new MouseClick2();
            gestureController.AddGesture("MouseClick", mouseClick);

            IRelativeGestureSegment[] mouseDownSegments = new IRelativeGestureSegment[2];
            mouseDownSegments[0] = new MouseDown();
            mouseDownSegments[1] = new MouseDown2();
            gestureController.AddGesture("MouseDown", mouseDownSegments);

            IRelativeGestureSegment[] mouseUpSegments = new IRelativeGestureSegment[2];
            mouseUpSegments[0] = new MouseUp();
            mouseUpSegments[1] = new MouseUp2();
            gestureController.AddGesture("MouseUp", mouseUpSegments);

            IRelativeGestureSegment[] handtoear = new IRelativeGestureSegment[50];
            for (int i = 0; i < handtoear.Count(); i++)
            {
                handtoear[i] = new HandToEar();
            }
            gestureController.AddGesture("HandtoEar", handtoear);


            IRelativeGestureSegment[] joinedhandsSegments = new IRelativeGestureSegment[20];
            JoinedHandsSegment1       joinedhandsSegment  = new JoinedHandsSegment1();

            for (int i = 0; i < 20; i++)
            {
                // gesture consists of the same thing 10 times
                joinedhandsSegments[i] = joinedhandsSegment;
            }
            gestureController.AddGesture("JoinedHands", joinedhandsSegments);

            IRelativeGestureSegment[] menuSegments = new IRelativeGestureSegment[20];
            MenuSegment1 menuSegment = new MenuSegment1();

            for (int i = 0; i < 20; i++)
            {
                // gesture consists of the same thing 20 times
                menuSegments[i] = menuSegment;
            }
            gestureController.AddGesture("Menu", menuSegments);

            IRelativeGestureSegment[] swipeleftSegments = new IRelativeGestureSegment[3];
            swipeleftSegments[0] = new SwipeLeftSegment1();
            swipeleftSegments[1] = new SwipeLeftSegment2();
            swipeleftSegments[2] = new SwipeLeftSegment3();
            gestureController.AddGesture("SwipeLeft", swipeleftSegments);

            IRelativeGestureSegment[] swiperightSegments = new IRelativeGestureSegment[3];
            swiperightSegments[0] = new SwipeRightSegment1();
            swiperightSegments[1] = new SwipeRightSegment2();
            swiperightSegments[2] = new SwipeRightSegment3();
            gestureController.AddGesture("SwipeRight", swiperightSegments);

            IRelativeGestureSegment[] waveRightSegments = new IRelativeGestureSegment[6];
            WaveRightSegment1         waveRightSegment1 = new WaveRightSegment1();
            WaveRightSegment2         waveRightSegment2 = new WaveRightSegment2();

            waveRightSegments[0] = waveRightSegment1;
            waveRightSegments[1] = waveRightSegment2;
            waveRightSegments[2] = waveRightSegment1;
            waveRightSegments[3] = waveRightSegment2;
            waveRightSegments[4] = waveRightSegment1;
            waveRightSegments[5] = waveRightSegment2;
            gestureController.AddGesture("WaveRight", waveRightSegments);

            IRelativeGestureSegment[] waveLeftSegments = new IRelativeGestureSegment[5];
            WaveLeftSegment1          waveLeftSegment1 = new WaveLeftSegment1();
            WaveLeftSegment2          waveLeftSegment2 = new WaveLeftSegment2();

            waveLeftSegments[0] = waveLeftSegment1;
            waveLeftSegments[1] = waveLeftSegment2;
            waveLeftSegments[2] = waveLeftSegment1;
            waveLeftSegments[3] = waveLeftSegment2;
            waveLeftSegments[4] = waveLeftSegment1;
            //waveLeftSegments[5] = waveLeftSegment2;
            gestureController.AddGesture("WaveLeft", waveLeftSegments);

            IRelativeGestureSegment[] zoomInSegments = new IRelativeGestureSegment[3];
            zoomInSegments[0] = new ZoomSegment1();
            zoomInSegments[1] = new ZoomSegment2();
            zoomInSegments[2] = new ZoomSegment3();
            gestureController.AddGesture("ZoomIn", zoomInSegments);

            IRelativeGestureSegment[] zoomOutSegments = new IRelativeGestureSegment[3];
            zoomOutSegments[0] = new ZoomSegment3();
            zoomOutSegments[1] = new ZoomSegment2();
            zoomOutSegments[2] = new ZoomSegment1();
            gestureController.AddGesture("ZoomOut", zoomOutSegments);

            IRelativeGestureSegment[] swipeUpSegments = new IRelativeGestureSegment[3];
            swipeUpSegments[0] = new SwipeUpSegment1();
            swipeUpSegments[1] = new SwipeUpSegment2();
            swipeUpSegments[2] = new SwipeUpSegment3();
            gestureController.AddGesture("SwipeUp", swipeUpSegments);

            IRelativeGestureSegment[] swipeDownSegments = new IRelativeGestureSegment[3];
            swipeDownSegments[0] = new SwipeDownSegment1();
            swipeDownSegments[1] = new SwipeDownSegment2();
            swipeDownSegments[2] = new SwipeDownSegment3();
            gestureController.AddGesture("SwipeDown", swipeDownSegments);
        }