示例#1
0
文件: Test.cs 项目: swssr/TakeTestUI
 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);
 }
示例#2
0
        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);
        }