Created
December 9, 2010 20:11
-
-
Save clupprich/735256 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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