本文整理汇总了C#中Leap.Controller.SetPolicyFlags方法的典型用法代码示例。如果您正苦于以下问题:C# Controller.SetPolicyFlags方法的具体用法?C# Controller.SetPolicyFlags怎么用?C# Controller.SetPolicyFlags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Leap.Controller
的用法示例。
在下文中一共展示了Controller.SetPolicyFlags方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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.");
}
示例2: LeapInterface
public LeapInterface()
{
listener = new LeapListener();
controller = new Controller();
controller.SetPolicyFlags(Controller.PolicyFlag.POLICYBACKGROUNDFRAMES);
Start();
}
示例3: OnInit
public override void OnInit(Controller controller)
{
controller.EnableGesture(Gesture.GestureType.TYPECIRCLE);
controller.EnableGesture(Gesture.GestureType.TYPEKEYTAP);
controller.EnableGesture(Gesture.GestureType.TYPESCREENTAP);
controller.EnableGesture(Gesture.GestureType.TYPESWIPE);
controller.SetPolicyFlags(Controller.PolicyFlag.POLICYBACKGROUNDFRAMES);
}
示例4: OnConnect
public override void OnConnect(Controller controller)
{
controller.SetPolicyFlags(Controller.PolicyFlag.POLICY_IMAGES);
//enable all four types of gestures
controller.EnableGesture(Gesture.GestureType.TYPE_SWIPE);
controller.EnableGesture(Gesture.GestureType.TYPE_KEY_TAP);
controller.EnableGesture(Gesture.GestureType.TYPE_SCREEN_TAP);
controller.EnableGesture(Gesture.GestureType.TYPE_CIRCLE);
this.eventDelegate.LeapEventNotification("onConnect");
}
示例5: 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();
}
示例6: LeapInterface
/// <summary>
/// Constructor for LeapInterface class
/// </summary>
public LeapInterface()
{
// Create a listener and controller
this.listener = new LeapListener();
this.controller = new Controller();
// Have the sample listener receive events from the controller
controller.AddListener(listener);
controller.SetPolicyFlags(Controller.PolicyFlag.POLICY_BACKGROUND_FRAMES);
// Register event handler
listener.GestureMade += new EventHandler<GestureEvent>(ProcessGesture);
}
示例7: 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);
}
}
}
示例8: OnInit
public override void OnInit(Controller controller)
{
_LogAction("Initialized");
controller.SetPolicyFlags(Controller.PolicyFlag.POLICYBACKGROUNDFRAMES);
}
示例9: Init
public void Init()
{
_leapController = new Controller();
_leapController.SetPolicyFlags(Controller.PolicyFlag.POLICY_BACKGROUND_FRAMES);
}
示例10: OnConnect
public override void OnConnect(Controller controller)
{
SafeWriteLine("Connected");
// enable gesture recognition for screen locking
controller.EnableGesture(Gesture.GestureType.TYPECIRCLE);
//controller.EnableGesture(Gesture.GestureType.TYPEKEYTAP);
//controller.EnableGesture(Gesture.GestureType.TYPESCREENTAP);
//controller.EnableGesture(Gesture.GestureType.TYPESWIPE);
controller.SetPolicyFlags(Controller.PolicyFlag.POLICYBACKGROUNDFRAMES);
}
示例11: OnInit
public override void OnInit(Controller controller)
{
SafeWriteLine("Initialized");
stopWatch = new Stopwatch();
stopWatch.Start();
controller.SetPolicyFlags(Controller.PolicyFlag.POLICYBACKGROUNDFRAMES);
}
示例12: OnInit
public override void OnInit(Controller controller)
{
SafeWriteLine("Initialized");
controller.SetPolicyFlags(Controller.PolicyFlag.POLICYBACKGROUNDFRAMES);
}
示例13: HandleController
// Enables/Disables the controller based on the visibility of the overlay
public void HandleController(object sender, DependencyPropertyChangedEventArgs e)
{
Window overlay = sender as Window;
if (overlay.Visibility == Visibility.Hidden)
{
leap.RemoveListener(listener);
leap.Dispose();
}
else if (overlay.Visibility == Visibility.Visible)
{
leap = new Controller();
// Runs the leap constantly so it can be used when the window loses focus
if (leap.PolicyFlags != Controller.PolicyFlag.POLICYBACKGROUNDFRAMES)
{
leap.SetPolicyFlags(Controller.PolicyFlag.POLICYBACKGROUNDFRAMES);
}
leap.AddListener(listener);
}
}