private void EvaluateConfidence(object sender, EmotionEventArgs e) { /* The quiz instance lives within this class (not ProblemPage.xaml.cs) * so increment the number of times emotion values have been analyzed * for the quiz class object. This is not always 1:1 with the number * of answered problems because a bad picture may be taken with no results. */ quiz.AddEmotionsForLastSolvedProblem(e.Anger, e.Contempt, e.Disgust, e.Fear, e.Happiness, e.Neutral, e.Sadness, e.Surprise); //If the last math problem has been solved, then the results screen //is being shown and we do not need to generate the last problem. if (MathProblems.Count != 0) { //Generate a new problem only if the user got the answer correct //but was not confident if (quiz.WasPreviousAnswerCorrect && !quiz.IsUserConfident(e)) { var newProblemQueue = quiz.GenerateMathProblems(1); MathProblems.Enqueue(newProblemQueue.Dequeue()); quiz.NumberOfGeneratedProblems++; } } else { /* This means the results screen is showing, so raise event letting * the results screen know that the average confidence has been * returned and calculated. */ ResultsScreenDataReady(this, new ConfidenceEventArgs(quiz.ConfidenceAverage)); } }
public void HintRequested(object sender, EventArgs e) { //Enqueue a new problem when user requests a hint var newProblemQueue = quiz.GenerateMathProblems(1); MathProblems.Enqueue(newProblemQueue.Dequeue()); quiz.NumberOfGeneratedProblems++; }