private async void ShowWrongAnswerWarning() { var wrongAnswerWarning = new MessageDialog("Your answer is wrong"); var retryCommand = new UICommand("Retry") { Id = 0 }; var showAnswerCommand = new UICommand("Show answer") { Id = 1 }; wrongAnswerWarning.Commands.Add(retryCommand); wrongAnswerWarning.Commands.Add(showAnswerCommand); var result = await wrongAnswerWarning.ShowAsync(); if (result == retryCommand) { Clear(); } if (result == showAnswerCommand) { InteractionTools.ShowTemplateImage(this.TemplateImage, this.currentImageTemplate); } }
private void ShowVisualFeedback() { InteractionTools.ShowTemplateImage(TemplateImage, currentImageTemplate); StrokeCountFeedbackTextBlock.Text = "Location: " + visAssessor.LocationFeedback + "\n"; StrokeOrderFeedbackTextBlock.Text = "Shape: " + visAssessor.ShapeFeedback + "\n"; StrokeDirectionFeedbackTextBlock.Text = "Distribution: " + visAssessor.ProjectionFeedback + "\n"; StrokeIntersectionFeedbackTextBlock.Text = ""; }
private void LoadQuestion(int questionIndex) { this.currentQuestion = this.questions[questionIndex]; this.InstructionTextBlock.Text = this.currentQuestion.Text; this.currentTemplateSketch = this.strokeTemplates[this.currentQuestion.Answer]; this.currentTemplateSketchStrokes = SketchPreprocessing.ScaleToFrame(currentTemplateSketch, writingFrameLength); this.LoadTemplateImage(this.currentQuestion.Answer); InteractionTools.ShowTemplateImage(this.SmallTemplateImage, this.currentImageTemplate); }
private void StrokeOrderPlayButton_Click(object sender, RoutedEventArgs e) { if (!techAssessor.IsCorrectStrokeCount) { return; } InteractionTools.DemoStrokeOrder(this.AnimationCanvas, this.WritingInkCanvas, this.techAssessor.StrokeToStrokeCorrespondenceSameCount); this.AnimationCanvas.Children.Clear(); }
private void StrokeDirectionPlayButton_Click(object sender, RoutedEventArgs e) { if (!techAssessor.IsCorrectStrokeCount) { return; } this.AnimationCanvas.Children.Clear(); this.DisablePlayButtons(); InteractionTools.DemoStrokeDirection(this.AnimationCanvas, this.sketchStrokes, this.techAssessor.WrongDirectionStrokeIndices); this.EnablePlayButtons(); }
private void StrokeIntersectionPlayButton_Click(object sender, RoutedEventArgs e) { if (!this.techAssessor.IsCorrectStrokeCount) { return; } this.AnimationCanvas.Children.Clear(); int[] correspondance = this.techAssessor.StrokeToStrokeCorrespondenceSameCount; string[,] sampleIntersections = this.techAssessor.SampleIntersectionMatrix; string[,] templateIntersections = this.techAssessor.TemplateIntersectionMatrix; for (int i = 0; i < sampleIntersections.GetLength(0); i++) { for (int j = 0; j < sampleIntersections.GetLength(0); j++) { if (i == j) { continue; } if (sampleIntersections[i, j] != templateIntersections[i, j]) { int realI = 0; int realJ = 0; for (int index = 0; index < correspondance.GetLength(0); index++) { if (correspondance[index] == i) { realI = index; } if (correspondance[index] == j) { realJ = index; } } SketchPoint intersection = SketchStrokeFeatureExtraction.Intersection(this.sketchStrokes[realI], this.sketchStrokes[realJ]); if (intersection != null) { InteractionTools.HighlightWrongIntersection(this.AnimationCanvas, intersection); } else { InteractionTools.HighlightStrokes(this.AnimationCanvas, this.WritingInkCanvas, realI, realJ); } } } } }
private void StrokeCountPlayButton_Click(object sender, RoutedEventArgs e) { this.AnimationCanvas.Children.Clear(); if (this.techAssessor.ConcatenatingCorrespondence != null) { this.DisablePlayButtons(); InteractionTools.DemoStrokeCount(this.AnimationCanvas, this.WritingInkCanvas, this.techAssessor.ConcatenatingCorrespondence, "concatenating"); this.EnablePlayButtons(); } if (this.techAssessor.BrokenStrokeCorrespondence != null) { this.DisablePlayButtons(); InteractionTools.DemoStrokeCount(this.AnimationCanvas, this.WritingInkCanvas, this.techAssessor.BrokenStrokeCorrespondence, "broken"); this.EnablePlayButtons(); } }
private void StrokeInput_StrokesCollected(InkPresenter sender, InkStrokesCollectedEventArgs args) { if (this.IsSkritter == true) { var strokes = this.WritingInkCanvas.InkPresenter.StrokeContainer.GetStrokes(); SketchStroke lastStroke = new SketchStroke(strokes[strokes.Count - 1], this.timeCollection[this.timeCollection.Count - 1]); if (SkritterHelpers.ValidateStroke(lastStroke, this.currentTemplateSketchStrokes[this.sketchStrokes.Count]) == true) { this.sketchStrokes.Add(lastStroke); InteractionTools.ShowStroke(this.AnimationCanvas, this.currentTemplateSketchStrokes[this.sketchStrokes.Count - 1]); } else { this.timeCollection.RemoveAt(this.timeCollection.Count - 1); } strokes[strokes.Count - 1].Selected = true; this.WritingInkCanvas.InkPresenter.StrokeContainer.DeleteSelected(); } }
public static void DemoStrokeDirection(Canvas canvas, List <SketchStroke> strokes, HashSet <int> wrongDirectionStrokeIndices) { List <List <SketchPoint> > solutionStrokeTraces = new List <List <SketchPoint> >(); foreach (int index in wrongDirectionStrokeIndices) { List <SketchPoint> origPoints = strokes[index].Points; List <SketchPoint> reversed = new List <SketchPoint>(); for (int i = origPoints.Count - 1; i >= 0; i--) { reversed.Add(origPoints[i]); } solutionStrokeTraces.Add(reversed); } List <Storyboard> storyboards = InteractionTools.GenerateStoryBoards(canvas, solutionStrokeTraces, AnimationPointSize, AnimationPointDuration); foreach (var sb in storyboards) { sb.Begin(); } }