Example #1
0
    private void ParseQuestions()
    {
        XmlDocument doc = new XmlDocument();

        doc.LoadXml(questionsXml);
        Console.WriteLine(doc.FirstChild.Name);
        int questionIdx = 0;

        foreach (XmlNode qNode in doc.GetElementsByTagName("q"))
        {
            string   title   = "question";
            string[] answers = new string[4];
            int      correct = 0;

            int.TryParse(qNode.Attributes["correct"].InnerText, out correct);
            title = qNode.Attributes["title"].InnerText;

            for (int i = 0; i < 4; i++)
            {
                answers[i] = qNode.ChildNodes[i].InnerText;
            }
            QuestionKnowledgeContent content = new QuestionKnowledgeContent(title, correct, answers);
            questions.Add(new QuestionKnowledge(content, QuestionKnowledge.fourAnswers, questionRect, "questknow_" + questionIdx));
            questionIdx++;
        }
    }
Example #2
0
 public QuestionKnowledge(QuestionKnowledgeContent content, int answerCount, Rectangle position, string UID)
     : base(position, UID)
 {
     this.content     = content;
     this.answerCount = answerCount;
 }