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


C# Controller.Dispose方法代码示例

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


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

示例1: Main

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

            Console.ReadKey();
            controller.Dispose();
        }
开发者ID:ufouz1990,项目名称:LeapMotion,代码行数:9,代码来源:Program.cs

示例2: 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

示例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

        static void Main(string[] args)
        {
            Controller controller = new Leap.Controller(); // initialize the leap controller

            while (!controller.IsConnected) { } // wait for it to connect

            PhaseModulationProvider pmProvider = new PhaseModulationProvider(440, (440f / 2f), 0.5f, 0.5f, 0.2f); // initialize the pm oscillator

            MixingSampleProvider mixer = new MixingSampleProvider(new[] { pmProvider });

            mixer.ReadFully = true;

            SynthController synthController = new SynthController(pmProvider, 0.1f); // initialize the object that controls the synth with leap

            WaveOut audioOut = new WaveOut(); // hear things

            audioOut.Init(mixer); // give it the oscillator

            audioOut.Play(); // play it

            RenderWindow window = new RenderWindow(new VideoMode(200, 200), "Test Window, Please Ignore"); // make the sfml window

            window.Closed += (object sender, EventArgs e) => // so I can close it
            {
                RenderWindow w = sender as RenderWindow;
                controller.Dispose();
                w.Close();
            };

            window.KeyPressed += (object sender, KeyEventArgs e) =>
            {
                if (e.Code == Keyboard.Key.Escape)
                {
                    RenderWindow w = sender as RenderWindow;
                    w.Close();
                }
            };

            while (window.IsOpen) // main loop
            {
                synthController.HandleFrame(controller);
                window.DispatchEvents();
                window.Clear();
                window.Display();
            }
        }
开发者ID:amixtum,项目名称:jump-synth,代码行数:46,代码来源:Program.cs

示例6: 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

示例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: LoadListListFrame

        public static List<List<Frame>> LoadListListFrame(string path)
        {
            List<List<Frame>> listListF = new List<List<Frame>>();
            Stream readStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
            IFormatter formatter = new BinaryFormatter();
            List<List<byte[]>> listListB = (List<List<byte[]>>)formatter.Deserialize(readStream);
            readStream.Close();

            Controller control = new Controller();
            for (int i = 0; i < listListB.Count; i++)
            {
                List<Frame> listF = new List<Frame>();
                for (int j = 0; j < listListB[i].Count; j++)
                {
                    Frame f = new Frame();
                    f.Deserialize(listListB[i][j]);
                    listF.Add(f);
                }
                listListF.Add(listF);
            }
            control.Dispose();

            return listListF;
        }
开发者ID:Wolfox,项目名称:SIGame,代码行数:24,代码来源:Utils.cs

示例10: LoadFrame

 public static Frame LoadFrame(string path)
 {
     byte[] frameData = System.IO.File.ReadAllBytes(path);
     Controller control = new Controller();
     Frame f = new Frame();
     f.Deserialize(frameData);
     control.Dispose();
     return f;
 }
开发者ID:Wolfox,项目名称:SIGame,代码行数:9,代码来源:Utils.cs

示例11: 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

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