public void SyncGestureTest()
        {
            try {
                GestureRecognizer_Accessor recognizer = new GestureRecognizer_Accessor(_directoryPath);

                // Hold our sync gesture
                IavaGesture syncGesture = new IavaGesture("Sync", new List<IavaSnapshot>());

                try {
                    // Set the Sync Gesture
                    recognizer.SyncGesture = syncGesture;

                    // Make sure the Sync Gesture was updated
                    Assert.AreEqual(syncGesture, recognizer.SyncGesture);
                }
                catch (Exception ex) {
                    Assert.Fail(ex.Message);
                }
            }
            catch (Exception ex) {
                Assert.Fail(ex.Message);
            }
        }
        /// <summary>
        /// Initializes the Gesture Recognizer to the point where it can detect gestures.
        /// </summary>
        /// <param name="token"></param>
        private void SetupGestureDevice(CancellationToken token)
        {
            try {
                if (!token.IsCancellationRequested) {
                    // Read the gestures in from the config file
                    SupportedGestures = GestureFolderReader.Read(_filepath);
                    SyncGesture = SupportedGestures.Single(x => x.Name == "Sync");

                    // Set the Gestures for our GestureEngine
                    _engine.SyncGesture = SyncGesture;
                    _engine.SupportedGestures = SupportedGestures;
                    _engine.Initialize();

                    Status = RecognizerStatus.Running;
                }

                // Register with some camera events
                IavaCamera.SkeletonReady += OnSkeletonReady;
                _engine.GestureRecognized += OnGestureRecognized;
            }

            catch (Exception e) {
                StatusLogger.LogMessage(new Message("Failed to detect Kinect or start camera.",
                                                    GetType().Name,
                                                    MessageType.Error,
                                                    e));
                Status = RecognizerStatus.Error;
                throw e;
            }

            finally { m_resetEvent.Set(); }
        }
        /// <summary>
        /// Saves the IavaGesture state to the specified xml file.
        /// </summary>
        /// <param name="gesture">IavaGesture to be saved</param>
        /// <param name="filepath">Filepath where the gesture should be written to</param>
        public static void Save(IavaGesture gesture, string filepath)
        {
            foreach (IavaSnapshot snapshot in gesture.Snapshots) {
                // Create a hipCenter joint placeholder
                IavaBodyPart hipCenter = new IavaBodyPart(IavaJointType.HipCenter);

                // Get the HipCenter position...
                hipCenter.Position = new Core.Math.IavaSkeletonPoint()
                {
                    X = snapshot.BodyParts[(int)IavaJointType.HipCenter].Position.X,
                    Y = snapshot.BodyParts[(int)IavaJointType.HipCenter].Position.Y,
                    Z = snapshot.BodyParts[(int)IavaJointType.HipCenter].Position.Z
                };

                // Translate each bodypart position based on original hipcenter position
                foreach (IavaBodyPart bodyPart in snapshot.BodyParts) {
                    bodyPart.Position = Iava.Core.Math.Geometry.Translate(bodyPart.Position, hipCenter.Position);
                }
            }
            XmlSerializer serializer = new XmlSerializer(typeof(IavaGesture));
            TextWriter textWriter = new StreamWriter(filepath);
            serializer.Serialize(textWriter, gesture);
            textWriter.Close();
        }