/// <summary> /// Register passed gesture instance to be recognized by this API. Gesture can be any type implementing interface IGesture. /// This function should used for gestures, that require external datafile to load his configuration. /// </summary> /// <param name="gesture">Instance of gesture. Must impement IGesture interface.</param> /// <param name="gestureDataFile">Path to file containing gesture definition or configuration data.</param> /// <param name="forcedGestureRecognition">If true, thist gesture will be evaluated for every valid sequence and will be emited event for it. /// This means that event wil be emited for thist gesture every possible time not depending on his current likehood or if this event have maximal likehooh.</param> /// <returns>Returns passed gesture.</returns> /// <seealso cref="IGesture"/> /// <exception cref="KinectStateException">Gesture with this id already registered.</exception> /// <exception cref="GestureStateException">On some error in gesture initialization or loading.</exception> public IGesture RegisterGesture(IGesture gesture, string gestureDataFile, bool forcedGestureRecognition = false) { if (gestureStore.Select(gest => gest.Key.Id == gesture.Id).Contains(true)) throw new KinectStateException("Cannot register two gestures with same ID."); gestureStore.Add(gesture, forcedGestureRecognition); gesture.LoadData(gestureDataFile); players.RegisterGestureForAll(gesture, forcedGestureRecognition); return gesture; }