// move this in gesture detector? private void InitialPositionEventHandler(object sender, InitialPositionEventArgs e) { if (e.PositionState == InitialPositionState.Enter) { if (bodyManager.RecordedData.Count > 50) // consider each gesture with less than 50 samples incorrect // change this such that each gesture performed by user to be saved in a separate file; maybe append the time at which the gesture ended { string gestureName = (string)gestureList.SelectedItem; if (gestureDetector.IsCorrectGesture(gestureName, bodyManager.RecordedDataAsArray)) { Console.WriteLine("correct gesture"); // update the score } else { Console.WriteLine("incorrect gesture"); PlotFeedback(gestureDetector.ClosestSample.RecordedDataAsArray, bodyManager.RecordedDataAsArray); } } } if (e.PositionState == InitialPositionState.Exit) { // record the new gesture -> clear body data and don't do anything else. bodymanager pushes // any new body sample into a queue so if one clears the body data when the user is no more // in initial position, when it will enter back into the initial position, body manager will // contain only the last performed gesture bodyManager.ClearBodyData(); } }
protected virtual void FireEvent(InitialPositionEventArgs e) { if (InitialPositionEventHandler != null) { InitialPositionEventHandler(this, e); } }
private void InitialPositionEventHandler(object sender, InitialPositionEventArgs e) { if (e.PositionState == InitialPositionState.Enter) { ProcessSample(); } if (e.PositionState == InitialPositionState.Exit) { // to start recording a new sample, just clear body data and body manager will accumulate // the new samples in a queue bodyManager.ClearBodyData(); } }