private void UserControl_Loaded(object sender, RoutedEventArgs e) { _question = (DescriptiveQuestion)QuestionData.DataContext; _question.AssignValidationRule(); }
private void Window_KeyUp(object sender, KeyEventArgs e) { if (e.Key == Key.N && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) { Speech.speakPurge(null); nextButton_Click(null, null); } else if (e.Key == Key.B && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) { Speech.speakPurge(null); backButton_Click(null, null); } else if (e.Key == Key.R && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) { if (solver.getCurrentQuestion() is ObjectiveQuestion) { ObjectiveQuestion q = (ObjectiveQuestion)solver.getCurrentQuestion(); Speech.speakPurge("Objective Question"); Speech.speakNormal(q.QuestionText); Speech.speakNormal("Correct Answer"); Speech.speakNormal(q.Choices[q.Answer.Answer - 1]); if (q.Submitted != null) { Speech.speakNormal("Your Answer"); Speech.speakNormal(q.Choices[q.Submitted.Answer - 1]); } else { Speech.speakNormal("You didn't answer"); } } else if (solver.getCurrentQuestion() is DescriptiveQuestion) { DescriptiveQuestion q = (DescriptiveQuestion)solver.getCurrentQuestion(); Speech.speakPurge("Descriptive Question"); Speech.speakNormal(q.QuestionText); Speech.speakNormal("Correct Answer"); Speech.speakNormal(q.QuestionText); if (q.Submitted != null) { Speech.speakNormal("Your Answer"); Speech.speakNormal(q.Submitted.Answer); } else { Speech.speakNormal("You didn't answer"); } } else { ///action-based here } } else if (e.Key == Key.F && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) { Speech.speakPurge(null); finishButton_Click(null, null); } else if (e.Key == Key.C && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) { Speech.changeVoice(); } }