Skip to content

Instantly share code, notes, and snippets.

@clupprich
Created December 9, 2010 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clupprich/735256 to your computer and use it in GitHub Desktop.
Save clupprich/735256 to your computer and use it in GitHub Desktop.
XnMSwipeDetector SwipeDetector;
XnMWaveDetector WaveDetector;
var context = new XnMOpenNIContext();
XnMSessionManager sessionManager;
try
{
context.Init();
sessionManager = new XnMSessionManager(context, "Wave,Click", "RaiseHand");
sessionManager.FocusStartDetected += new EventHandler<FocusStartEventArgs>(sessionManager_FocusStartDetected);
sessionManager.SessionStarted += new EventHandler<PointEventArgs>(sessionManager_SessionStarted);
sessionManager.SessionEnded += new EventHandler(sessionManager_SessionEnded);
SwipeDetector = new XnMSwipeDetector();
SwipeDetector.SwipeLeft += new EventHandler<SwipeDetectorEventArgs>(swipeDetector_SwipeLeft);
SwipeDetector.SwipeRight += new EventHandler<SwipeDetectorEventArgs>(swipeDetector_SwipeRight);
SwipeDetector.SwipeUp += new EventHandler<SwipeDetectorEventArgs>(SwipeDetector_SwipeUp);
SwipeDetector.SwipeDown += new EventHandler<SwipeDetectorEventArgs>(SwipeDetector_SwipeDown);
sessionManager.AddListener(SwipeDetector);
WaveDetector = new XnMWaveDetector();
WaveDetector.Wave += new EventHandler(waveDetector_Wave);
sessionManager.AddListener(WaveDetector);
}
catch (ManagedNite.XnMException ex)
{
throw ex;
}
Thread t = new Thread(() =>
{
while (true)
{
//Debug.WriteLine("Updating context.");
context.Update();
sessionManager.Update(context);
Thread.Sleep(10);
}
});
t.Start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment