本文整理汇总了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;
}
示例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;
}
}
}
示例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.");
}
示例4: LeapListener
public LeapListener()
{
this.LeapInfo = new LeapFrame();
this.controller = new Controller();
this.listener = new LeapEventListener(this);
controller.AddListener(listener);
}
示例5: MainWindow
public MainWindow()
{
InitializeComponent();
this.controller = new Controller();
this.listener = new LeapEventListener(this);
controller.AddListener(listener);
}
示例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();
}
示例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
}
示例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;
}
示例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);
}
示例10: Main
static void Main(string[] args)
{
CustomListener listener = new CustomListener();
Controller controller = new Controller();
controller.AddListener(listener);
Console.ReadKey();
controller.Dispose();
}
示例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);
}
示例12: run
public void run()
{
if (!isListening)
{
isListening = true;
controller = new Controller();
controller.AddListener(this);
}
}
示例13: LeapMotinn
public LeapMotinn()
{
controller = new Controller();
if (controller.IsConnected)
{
IsConnected = true;
listener = new LeapListener();
controller.AddListener(listener);
}
}
示例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;
}
示例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();
}