当前位置: 首页>>代码示例>>C#>>正文


C# Controller.RemoveListener方法代码示例

本文整理汇总了C#中Leap.Controller.RemoveListener方法的典型用法代码示例。如果您正苦于以下问题:C# Controller.RemoveListener方法的具体用法?C# Controller.RemoveListener怎么用?C# Controller.RemoveListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Leap.Controller的用法示例。


在下文中一共展示了Controller.RemoveListener方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            Console.Title = "Leap Mousion v2.0";
            Console.WriteLine("Leap Mousion v2.0 by TangoChen    :)\r\n------------------------------------\r\nBlog: TangoChen.com\r\nYoutube Channel: www.youtube.com/tan9ochen\r\n--------------------\r\nTwitter:\ttwitter.com/tangochen\[email protected]\r\n微博(Weibo):\tweibo.com/tangochen\[email protected]\r\n--------------------\r\nPress any key to exit...\r\n--------------------");

            // Create a sample listener and controller
            SampleListener listener = new SampleListener();
            Controller controller = new Controller();

            foreach (string arg in args)
            {
                switch (arg.Substring(0, 1).ToLower())
                {
                    case "l": // L = Set isLeftHanded = true;
                        listener.isLeftHanded = true;
                        break;
                    case "s": // Scale
                        float.TryParse(arg.Substring(1), out listener.moveScale);
                        break;
                    case "r": // Reverse Orientation
                        /*
                         * It won't just reverse the horizontal axes but also change the fingerIndex...
                         * So this is used when the device get reversed horizontal axes
                         * and you don't want to click the [Reverse Orientation] inside the [Leap Motion Controller Settings] or
                         * rotate the device...
                         */
                        listener.isReversed = true;
                        break;
                    case "c": // Click-Only
                        listener.isClickOnly = true;
                        break;
                }
            }

            Console.WriteLine(
                "Speed: " + listener.moveScale.ToString() +
                "\r\nClick-Only: " + listener.isClickOnly.ToString() +
                "\r\nReversed: " + listener.isReversed.ToString() +
                "\r\nLeft Handed Mode: " + (listener.isLeftHanded ? "Enabled" : "Disabled") +
                "\r\n--------------------"
                );

            // Receive frames of tracking data while in the background
            controller.SetPolicyFlags(Controller.PolicyFlag.POLICYBACKGROUNDFRAMES);

            // Have the sample listener receive events from the controller
            controller.AddListener(listener);

            // Keep this process running until any key is pressed
            Console.ReadKey(true); //System.Diagnostics.Process.Start("pause"); Won't work...

            // Remove the sample listener when done
            controller.RemoveListener(listener);
            controller.Dispose();
        }
开发者ID:TangoChen,项目名称:LeapMousion,代码行数:55,代码来源:Program.cs

示例2: Main

        static void Main( string[] args )
        {
            SampleListener listener = new SampleListener();
            Controller leap = new Controller();
            leap.AddListener( listener );

            Console.WriteLine( "Press Enter to quit..." );
            Console.ReadLine();

            leap.RemoveListener( listener );
        }
开发者ID:beyondhxl,项目名称:LeapMotionIntroduction,代码行数:11,代码来源:Program.cs

示例3: Main

        static void Main(string[] args)
        {
            ReportingListener listener = new ReportingListener(new Reporter());
            Controller controller = new Controller();
            controller.AddListener(listener);

            Console.WriteLine("Listening! Press any key when you're finished to exit.");
            Console.ReadKey();

            controller.RemoveListener(listener);
            controller.Dispose();
        }
开发者ID:jamesseanwright,项目名称:leapmotion-console,代码行数:12,代码来源:Program.cs

示例4: AppModel

        public AppModel()
        {
            var controller = new Controller();
            var listener = new FrameListener();
            controller.AddListener(listener);

            AppDomain.CurrentDomain.ProcessExit += (o, e) =>
            {
                controller.RemoveListener(listener);
                listener.Dispose();
                controller.Dispose();
            };

            listener.FrameArrived += listener_FrameArrived;
        }
开发者ID:sakapon,项目名称:Samples-2014,代码行数:15,代码来源:AppModel.cs

示例5: Main

        public static void Main()
        {
            // Create a sample listener and controller
            var listener = new LeapListener();
            var controller = new Controller();

            // Have the sample listener receive events from the controller
            controller.AddListener(listener);

            // Keep this process running until Enter is pressed
            Console.WriteLine("Press Enter to quit...");
            Console.ReadLine();

            // Remove the sample listener when done
            controller.RemoveListener(listener);
            controller.Dispose();
        }
开发者ID:kkurni,项目名称:KK.Leap3D.MouseCursor,代码行数:17,代码来源:Program.cs

示例6: Main

        public static void Main()
        {
            using (UniListener listener = new UniListener())
            {
                using (Controller controller = new Controller())
                {
                    controller.SetPolicyFlags(Controller.PolicyFlag.POLICY_BACKGROUND_FRAMES);

                    // Have the listener receive events from the controller
                    controller.AddListener(listener);

                    // Keep this process running until Enter is pressed
                    Console.WriteLine("Press Enter to quit...");
                    string result = Console.ReadLine();

                    // Remove the listener when done
                    controller.RemoveListener(listener);
                }
            }
        }
开发者ID:rothda,项目名称:UniController2,代码行数:20,代码来源:Program.cs

示例7: Main

        public static void Main()
        {
            // Create a sample listener and controller
            SampleListener listener = new SampleListener();
            Controller controller = new Controller();

            // Have the sample listener receive events from the controller
            controller.AddListener(listener);

            // Keep this process running until Enter is pressed
            Console.WriteLine("Press Enter to quit...");
            Console.ReadLine();

            //used to keep things running when set to windows application build mode.
            while (listener != null)
            {

            }
            // Remove the sample listener when done
            controller.RemoveListener(listener);
            controller.Dispose();
        }
开发者ID:Zaeran,项目名称:LeapWindowsController,代码行数:22,代码来源:LeapControl.cs

示例8: Read

        void Read( ref SampleListener Listener, ref Controller Controller)
        {
            // Have the sample listener receive events from the controller
            Controller.AddListener(Listener);

            while (!StopRead)
            {
                //Do thing here
                //The listener class is gathering our data
            }

            // Remove the sample listener when done
            Controller.RemoveListener(Listener);
            Controller.Dispose();
            Listener.Dispose();
        }
开发者ID:neviim,项目名称:BBot,代码行数:16,代码来源:BBotLeapMotionWrapper.cs

示例9: Main

        static void Main(string[] args)
        {
            // Create a sample listener and controller
            GestureListener listener = new GestureListener();
            Controller controller = new Controller();

            listener.Gestures.GestureReceived += Gestures_GestureReceived;

            // Have the sample listener receive events from the controller
            controller.AddListener(listener);

            // Keep this process running until Enter is pressed
            Console.WriteLine("Press Enter to quit...");

            while (true)
            {
                var key = Console.ReadKey(true);

                if (key.Key == ConsoleKey.Enter)
                {
                    break;
                }

                switch (key.Key)
                {
                    case ConsoleKey.D1:
                        listener.Gestures.StartTraining();
                        Console.WriteLine("Training...");
                        break;

                    case ConsoleKey.D2:
                        listener.Gestures.StopTraining();
                        Console.WriteLine("Recorded gesture.");
                        break;

                    case ConsoleKey.D3:
                        var model = listener.Gestures.FinishTrainingSession();
                        Console.WriteLine("Enter a name for this gesture:");
                        var name = Console.ReadLine();
                        model.Name = name;
                        Console.WriteLine(String.Format("Completed training of gesture {0}.", name));
                        break;

                    case ConsoleKey.D4:
                        listener.Gestures.StartRecognition();
                        Console.WriteLine("Recognizing...");
                        break;

                    case ConsoleKey.D5:
                        listener.Gestures.StopRecognition();
                        break;
                }
            }

            // Remove the sample listener when done
            controller.RemoveListener(listener);
            controller.Dispose();
        }
开发者ID:NihithaDavis,项目名称:LeapGestures,代码行数:58,代码来源:Program.cs

示例10: Read

        public void Read(string path)
        {
            RecordListener listener = new RecordListener();
            listener.Initialization(numOfFramesPerRead, this);
            Controller controller = new Controller();
            controller.AddListener(listener);

            actualNumOfReads = 0;
            Console.WriteLine("Press enter to start reading frames to file " + path);
            Console.ReadLine();
            state = RecorderState.Idle;

            while (state != RecorderState.Saving)
            {
                Console.WriteLine("num: " + (actualNumOfReads + 1) + " in " + numOfReads);
                if (!isAuto)
                {
                    Console.ReadLine();
                }
                state = RecorderState.Reading;
                Console.WriteLine("Reading...");

                while (state == RecorderState.Reading)
                {
                    if (numOfFramesPerRead == 0)
                    {
                        Console.ReadLine();
                        listener.GetSequence();
                    }
                }
                while (state == RecorderState.Storing) { }
            }

            while (state != RecorderState.Saving) { }

            Utils.SaveListListFrame(sequencesToRead, path);

            controller.RemoveListener(listener);
            controller.Dispose();
        }
开发者ID:Wolfox,项目名称:SIGame,代码行数:40,代码来源:Recorder.cs


注:本文中的Leap.Controller.RemoveListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。