public void DataBase_AnswerProvided(object sender, AnswerEventArgs e) { // Method: DataBase_AnswerProvided // Test subscriber uses data from publisher DataBase // Stores the correct the answer in memory m_answers.Add(e.Answer); }
protected virtual void OnAnswerProvided(int questionNumber) { // Method: OnAnswerProvided // Return: None // Announces to it subscribers that it just pulled the correct answer // The the correct answer is available for use. string correctAnswer = string.Empty; // Pulling the correct answer foreach (DataRow dr in m_questions.Rows) { if (questionNumber == (int)dr["QuestionID"]) { correctAnswer = dr["Correct"].ToString(); break; } } Answer answer = new Answer(questionNumber, correctAnswer); AnswerEventArgs e = new AnswerEventArgs(answer); AnswerProvided(this, e); }