Beispiel #1
0
        private void GestureOverlayViewOnGesturePerformed(object sender, GestureOverlayView.GesturePerformedEventArgs gesturePerformedEventArgs)
        {
            IEnumerable <Prediction> predictions = from p in _gestureLibrary.Recognize(gesturePerformedEventArgs.Gesture)
                                                   orderby p.Score descending
                                                   where p.Score > 1.0
                                                   select p;
            Prediction prediction = predictions.FirstOrDefault();

            if (prediction == null)
            {
                Log.Debug(GetType().FullName, "Nothing seemed to match the user's gesture, so don't do anything.");
                return;
            }

            Log.Debug(GetType().FullName, "Using the prediction named {0} with a score of {1}.", prediction.Name, prediction.Score);

            if (prediction.Name.StartsWith("checkmark"))
            {
                _imageView.SetImageResource(Resource.Drawable.checked_me);
            }
            else if (prediction.Name.StartsWith("erase", StringComparison.OrdinalIgnoreCase))
            {
                // Match one of our "erase" gestures
                _imageView.SetImageResource(Resource.Drawable.check_me);
            }
        }
Beispiel #2
0
        private void GestureOverlayViewOnGesturePerformed(object sender, GestureOverlayView.GesturePerformedEventArgs gesturePerformedEventArgs)
        {
            //TODO: Step 12 - Get gestures that have a good decent score
            //IEnumerable<Prediction> predictions = from p in _gestureLibrary.Recognize(gesturePerformedEventArgs.Gesture)
            //                                      orderby p.Score descending
            //                                        where p.Score > 1.0d
            //                                      select p;
            //
            //Prediction prediction = predictions.FirstOrDefault();
            //
            //if (prediction == null)
            //{
            //    Log.Debug(GetType().FullName, "Nothing seemed to match the user's gesture, so don't do anything.");
            //    return;
            //}
            //
            //Log.Debug(GetType().FullName, "Using the prediction named {0} with a score of {1}.", prediction.Name, prediction.Score);

            //TODO: Step 13 - Determine which gesture was performed
            //if (prediction.Name.StartsWith("checkmark") && prediction.Score > 4.0f /* Use this to eliminate false positives */)
            //{
            //    _imageView.SetImageResource(Resource.Drawable.checked_me);
            //}
            //else if (prediction.Name.StartsWith("erase", StringComparison.OrdinalIgnoreCase))
            //{
            //    // Match one of our "erase" gestures
            //    _imageView.SetImageResource(Resource.Drawable.check_me);
            //}
        }