Error occurs at the onConnect event: previousTime = currentFrame.Timestamp;
The program is just the same as the c# example in console, just modified into a WinFormApplication.
What is the possible cause?
This is Program.cs:
namespace WindowsFormsApplication1
{
class Program
{
public static Controller cntrl = new Controller();
public static LeapListener listener = new LeapListener();
/// <summary>
/// 應用程式的主要進入點。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
// Put your own handler here
Application.Run(new Form1());
}
}
}
Form1.cs:
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
KeyboardHook hk = new KeyboardHook();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
//hk.InstallHook();
Program.cntrl.EnableGesture(Leap.Gesture.GestureType.TYPEKEYTAP);
Program.cntrl.EnableGesture(Leap.Gesture.GestureType.TYPESWIPE);
Program.cntrl.AddListener(Program.listener);
}
private void Form1_Unload(object sender, EventArgs e)
{
hk.RemoveHook();
if (Program.listener != null) Program.cntrl.RemoveListener(Program.listener);
Program.cntrl.Dispose();
Application.Exit();
}
}