Example #1
0
        private void DrawingCanvas_StrokesCollected(InkPresenter sender, InkStrokesCollectedEventArgs args)
        {
            System.Collections.Generic.IReadOnlyList <InkStroke> strokes = sender.StrokeContainer.GetStrokes();
            StrokeSampleBuilder sampleBuilder = new StrokeSampleBuilder((uint)strokes.Count);

            foreach (InkStroke stroke in strokes)
            {
                System.Collections.Generic.IReadOnlyList <InkPoint> points = stroke.GetInkPoints();
                StrokeBuilder strokeBuilder = new StrokeBuilder((uint)points.Count);

                foreach (InkPoint point in points)
                {
                    strokeBuilder.AddPoint(point.Position.X, point.Position.Y);
                }

                sampleBuilder.AddStroke(strokeBuilder.build());
            }

            StrokeSample sample = sampleBuilder.build();
            Scores       scores = classifier.classify(sample);

            ResultsList.Items.Clear();

            foreach (Score score in scores)
            {
                ResultsList.Items.Add(new SymbolListItem(score.Symbol, score.Value));
            }
        }
Example #2
0
 public Scores classify(StrokeSample sample)
 {
     unsafe { return(new Scores(Bindings.Classify(classifier, sample.Ptr))); }
 }