static void MarkReceivedEvent(object sender, MarkReceivedEventArgs e) { Console.WriteLine("Mark received."); QuizResult result = e.Result; if (result.correctAnswers == 0) { Console.WriteLine("Correct answers: 0, as expected"); } else { Console.WriteLine("Correct answers: " + result.correctAnswers + " -- wrong"); } Console.ReadKey(); Environment.Exit(0); }
private void DisplayMark(object sender, MarkReceivedEventArgs e) { //Show the label with the result and the close button lblResult.Show(); lblConnectionProgress.Hide(); btnClose.Show(); if (e.Result.answersAccepted) { //If the server accepted our answers, display the result and the percentage lblResult.Text = "Correct answers: " + e.Result.correctAnswers + "/" + answers.answers.Count + string.Format(" ({0:#0}%)", e.Result.correctAnswers * 100 / answers.answers.Count) + Environment.NewLine + "Hints used: " + answers.hintsUsed + Environment.NewLine + "Total mark: " + e.Result.mark; } else { //The user tried to take the quiz twice, report that on the label lblResult.Text = "The server has reported that you have already sent the answers once." + Environment.NewLine + "You cannot submit the answers twice in one session." + Environment.NewLine + "Only your first result will be stored on the server."; } }