private async void MySymbolCorrectnessPlayButton_Click(object sender, RoutedEventArgs e) { // //EnableStructureButtons(false); MyImage.Visibility = Visibility.Collapsed; // get the model and input strokes Sketch model = SketchTools.Clone(myTemplates[MyCurrentIndex]); Sketch input = Sketch.CreateStroke("", new List <InkStroke>(MyInkStrokes.GetStrokes()), myTimeCollection, 0, 0, BorderLength, BorderLength); // store and remove the original strokes from the ink canvas List <InkStroke> originalStrokes = SketchTools.Clone(new List <InkStroke>(MyInkStrokes.GetStrokes())); foreach (InkStroke stroke in MyInkStrokes.GetStrokes()) { stroke.Selected = true; } MyInkStrokes.DeleteSelected(); // set the animation colors SolidColorBrush modelBrush = new SolidColorBrush(Colors.Green) { Opacity = 1.0 }; SolidColorBrush inputBrush = new SolidColorBrush(Colors.Red) { Opacity = 1.0 }; // get the animations List <Storyboard> modelStoryboards = Helper.DisplaySymbol(MyCanvas, model.Strokes, modelBrush, SMALL_DOT_SIZE, STROKE_DURATION); List <Storyboard> inputStoryboards = Helper.DisplaySymbol(MyCanvas, input.Strokes, inputBrush, StrokeVisuals.Size.Width, STROKE_DURATION); // animate the feedback foreach (Storyboard storyboard in modelStoryboards) { storyboard.Begin(); } foreach (Storyboard storyboard in inputStoryboards) { storyboard.Begin(); } // re-add the original strokes to the ink canvas and re-enable return button int delay = STROKE_DURATION; await InteractionTools.Delay(delay); MyInkStrokes.AddStrokes(originalStrokes); // //EnableStructureButtons(true); MyImage.Visibility = Visibility.Visible; }
private async void MyStrokeOrderPlayButton_Click(object sender, RoutedEventArgs e) { // do not show feedback if canvas has no strokes if (MyInkStrokes.GetStrokes().Count <= 0) { return; } if (!myTechniqueRecognizer.StrokeCountResult) { return; } // EnableTechniqueButtons(false); // get the model and input strokes Sketch model = myTemplates[MyCurrentIndex]; model = SketchTools.Clone(model); Sketch input = Sketch.CreateStroke("", new List <InkStroke>(MyInkStrokes.GetStrokes()), myTimeCollection, 0, 0, BorderLength, BorderLength); input = SketchTools.Clone(input); input = SketchTransformation.Resample(input, 128); // store and remove the original strokes from the ink canvas List <InkStroke> originalStrokes = SketchTools.Clone(new List <InkStroke>(MyInkStrokes.GetStrokes())); foreach (InkStroke stroke in MyInkStrokes.GetStrokes()) { stroke.Selected = true; } MyInkStrokes.DeleteSelected(); // set the animation colors SolidColorBrush modelBrush = new SolidColorBrush(Colors.Green) { Opacity = 1.0 }; SolidColorBrush inputBrush = new SolidColorBrush(Colors.Red) { Opacity = 1.0 }; // get the animations List <Storyboard> modelStoryboards = InteractionTools.DisplayPaths(MyCanvas, model.Strokes, modelBrush, LARGE_STROKE_SIZE, STROKE_DURATION); List <Storyboard> inputStoryboards = InteractionTools.DisplayPaths(MyCanvas, input.Strokes, inputBrush, SMALL_STROKE_SIZE, STROKE_DURATION); // animate the feedback foreach (Storyboard storyboard in modelStoryboards) { storyboard.Begin(); } foreach (Storyboard storyboard in inputStoryboards) { storyboard.Begin(); } // re-add the original strokes to the ink canvas and re-enable return button int delay = STROKE_DURATION * model.Strokes.Count; await InteractionTools.Delay(delay); MyInkStrokes.AddStrokes(originalStrokes); // EnableTechniqueButtons(true); }