public override void _presenter_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e) { InkCanvas inkCanvas = (InkCanvas)sender; Stroke lastStroke = inkCanvas.Strokes[inkCanvas.Strokes.Count - 1]; if (analyze.RootNode.Strokes.IndexOf(lastStroke) == -1) { analyze.AddStroke(inkCanvas.Strokes[inkCanvas.Strokes.Count - 1]); } analyze.BackgroundAnalyze(); string analyzeStr = analyze.GetRecognizedString(); MyGraphic MyGraphicContrainStroke = _inkCollector.Sketch.getMyGraphicContrainStroke(lastStroke); if (MyGraphicContrainStroke != null) { if (MyGraphicContrainStroke.textStrokeCollection.IndexOf(lastStroke) == -1) { MyGraphicContrainStroke.addTextStroke(lastStroke); MyGraphicContrainStroke.Text = analyzeStr; //Console.WriteLine("analyzeStr:" + analyzeStr); } } }
void _inkCanvas_StrokeCollected_StrokeInGraphic(object sender, InkCanvasStrokeCollectedEventArgs e) { InkCanvas inkCanvas = (InkCanvas)sender; Stroke lastStroke = inkCanvas.Strokes[inkCanvas.Strokes.Count - 1]; if (analyze.RootNode.Strokes.IndexOf(lastStroke) == -1) { analyze.AddStroke(inkCanvas.Strokes[inkCanvas.Strokes.Count - 1]); } analyze.BackgroundAnalyze(); string analyzeStr = analyze.GetRecognizedString(); MyGraphic MyGraphicContrainStroke = InkCollector.Sketch.getMyGraphicContrainStroke(lastStroke); if (MyGraphicContrainStroke != null) { if (MyGraphicContrainStroke.textStrokeCollection.IndexOf(lastStroke) == -1) { MyGraphicContrainStroke.addTextStroke(lastStroke); MyGraphicContrainStroke.Text = analyzeStr; //Console.WriteLine("analyzeStr" + analyzeStr); } } }