// Shuts down the context and closes any open devices
public static void ShutdownContext( )
{
if (freenectContext != IntPtr.Zero)
{
// shutdown context
int result = KinectNative.freenect_shutdown(freenectContext);
if (result != 0)
{
throw new ApplicationException("Could not shutdown freenect context. Error Code:" + result);
}
// Dispose pointer
KinectNative.freenectContext = IntPtr.Zero;
}
}