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


C# Controller.AddListener方法代码示例

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


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

示例1: InitLeapSensorAndRegisterToEvents

 private void InitLeapSensorAndRegisterToEvents()
 {
     _listener = new MotionListener();
     _controller = new Controller();
     _controller.AddListener(_listener);
     _listener.OnHandMoveOn += _listener_OnHandMoveOn;
 }
开发者ID:modulexcite,项目名称:events,代码行数:7,代码来源:MainWindow.xaml.cs

示例2: connect

        public void connect()
        {
            if (connected)
            {
                // Remove the listener
                controller.RemoveListener(listener);
                controller.Dispose();
                connected = false;
                connectbutton.Text = "Connect";
                fps_label.Text = "disconnected";
            }
            else
            {
                // Create listener and controller
                listener = new SampleListener();
                listener.form = this;
                controller = new Controller();

                if (controller.IsConnected)
                {
                    controller.AddListener(listener);
                    connectbutton.Text = "Disconnect";
                    connected = true;
                }
            }
        }
开发者ID:Brejlounek,项目名称:Leap-Input,代码行数:26,代码来源:Form1.cs

示例3: Form1

 public Form1()
 {
     InitializeComponent();
     oCamera = new InventorCamera();
     controller = new Controller();
     InitializeTexBox();
     AddToLog("Component initialization.");
     Thread.Sleep(100); // wait for connection
     if (controller.Devices.IsEmpty)
     {
         AddToLog("ERROR: No connection to Leap Motion service.");
         AddToLog("ERROR: Connect device and restart application.");
         return;
     }
     else
     {
         AddToLog("Connected to Leap Motion service.");
         controller.EnableGesture(Gesture.GestureType.TYPE_SWIPE);
         controller.EnableGesture(Gesture.GestureType.TYPE_CIRCLE);
         listener = new LeapEventListener(this);
         controller.SetPolicyFlags(Controller.PolicyFlag.POLICY_BACKGROUND_FRAMES);
         controller.AddListener(listener);
     }
     if (!oCamera.IsStarted())
         AddToLog("ERROR: Inventor instance not found.");
     else
         AddToLog("Iventor instance found. ");
     if (!oCamera.IsOpened())
         AddToLog("ERROR: Assembly, part or presentation document not found.");
     else
         AddToLog(oCamera.GetDocType() + " document found.");
 }
开发者ID:harrykeen18,项目名称:InventorIntegration,代码行数:32,代码来源:Form1.cs

示例4: LeapListener

 public LeapListener()
 {
     this.LeapInfo = new LeapFrame();
     this.controller = new Controller();
     this.listener = new LeapEventListener(this);
     controller.AddListener(listener);
 }
开发者ID:tbarczyk,项目名称:Lipmon,代码行数:7,代码来源:LeapListener.cs

示例5: MainWindow

 public MainWindow()
 {
     InitializeComponent();
     this.controller = new Controller();
     this.listener = new LeapEventListener(this);
     controller.AddListener(listener);
 }
开发者ID:ArthurFeitosa,项目名称:LeapHand,代码行数:7,代码来源:MainWindow.xaml.cs

示例6: StillLife

        public StillLife()
        {
            InitializeComponent();

            ConfigFile config = new ConfigFile(@"config.ini");
            speedUpDown = config.SettingGroups["Movement"].Settings["SpeedUpDown"].GetValueAsFloat();
            speedLeftRight = config.SettingGroups["Movement"].Settings["SpeedLeftRight"].GetValueAsFloat();
            idleTexturePosition.Width = config.SettingGroups["Idle"].Settings["IdleX"].GetValueAsInt();
            idleTexturePosition.Height = config.SettingGroups["Idle"].Settings["IdleY"].GetValueAsInt();
            timeTillIdle = config.SettingGroups["Idle"].Settings["IdleAfter"].GetValueAsFloat();
            idleSpeed = config.SettingGroups["Idle"].Settings["IdleSpeed"].GetValueAsFloat();

            leapController = new Controller();
            leapListener = new LeapListener();
            leapController.AddListener(leapListener);
            leapListener.LeapSwipe += new LeapListener.SwipeEvent(OnSwipe);
            leapListener.LeapRegisterFingers += new LeapListener.RegisterFingers(OnRegisterFingers);

            CalculateColumnsRows();
            InitializeIdleValues();

            stopWatch.Start();
            updateThread = new Thread(UpdateThread);
            updateThread.Start();
        }
开发者ID:RyamBaCo,项目名称:StillLife,代码行数:25,代码来源:StillLife.cs

示例7: Start

    private LeapManager manager; //This provides access to leap data

    #endregion Fields

    #region Methods

    // Use this for initialization
    void Start()
    {
        manager = Camera.main.GetComponent<LeapManager>();							//This links to some leap data
        listener   = new Leap.Listener ();											//initializes the listener
        controller = new Leap.Controller ();										//Initializes the controler
        controller.AddListener (listener);											//Pipes the listener stream into the controler
    }
开发者ID:Krewn,项目名称:LIOS,代码行数:14,代码来源:GetFrame.cs

示例8: Start

 //public bool scratch;
 // Use this for initialization
 void Start()
 {
     print("Inizializzo controller");
     listener = new Leap.Listener();
     controller = new Leap.Controller();
     controller.AddListener(listener);
     angle=0.0683f;
 }
开发者ID:NicolaGenesin,项目名称:Musicaleap,代码行数:10,代码来源:Ruota.cs

示例9: FrameDataForm

 //public Frame frame_read = new Frame();
 public FrameDataForm()
 {
     InitializeComponent();
     this.controller = new Controller();
     this.listener = new LeapEventListener(this);
     controller.AddListener(listener);
     this.controller.SetPolicy (Controller.PolicyFlag.POLICY_IMAGES);
 }
开发者ID:redsu,项目名称:Leapmotion,代码行数:9,代码来源:Form1.cs

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

示例11: LeapHandler

        public LeapHandler()
        {
            // Create a sample listener and controller
            _LeapListener = new LeapListener();
            _Controller = new Controller();

            // Have the sample listener receive events from the controller
            _Controller.AddListener(_LeapListener);
        }
开发者ID:hexate,项目名称:LeapMotion,代码行数:9,代码来源:LeapHandler.cs

示例12: run

 public void run()
 {
     if (!isListening)
     {
         isListening = true;
         controller = new Controller();
         controller.AddListener(this);
     }
 }
开发者ID:lkathke,项目名称:MotionGestureRecognizers-CSharp,代码行数:9,代码来源:MotionListener.cs

示例13: LeapMotinn

 public LeapMotinn()
 {
     controller = new Controller();
     if (controller.IsConnected)
     {
         IsConnected = true;
         listener = new LeapListener();
         controller.AddListener(listener);
     }
 }
开发者ID:jasine,项目名称:KinectExplorer,代码行数:10,代码来源:LeapMotion.cs

示例14: MainViewModel

 public MainViewModel(Controller controller, CustomLeapListener listener, GameModel gameModel)
 {
     GameModel = gameModel;
     _listener = listener;
     _controller = controller;
     _controller.AddListener(_listener);
     _dispatcher = Application.Current.Dispatcher;
     RegisterEvents();
     _enableMouse = false;
 }
开发者ID:cabsix1,项目名称:Leap-Motion,代码行数:10,代码来源:MainViewModel.cs

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


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