AppStore.Models.Question.setQuestion C# (CSharp) Method

setQuestion() public method

Sets the Question of the current QuizModel Object
public setQuestion ( string mQuestion ) : void
mQuestion string Question of the current QuizModel Object
return void
        public void setQuestion(string mQuestion)
        {
            this.mQuestion = mQuestion;
        }

Usage Example

 /// <summary>
 /// It reads the Quiz App-Template, from the .buildmlearn file.
 /// </summary>
 /// <param name="fileName">Name of the file</param>
 public static void readQuizFile(string fileName)
 {
     try
     {
         QuizModel model = QuizModel.getInstance();
         List<Question> mQuestionList = new List<Question>();
         XmlDocument doc = new XmlDocument();
         doc.LoadXml(XDocument.Load("Assets/Apps/" + fileName + ".xml").ToString());
         model.setQuizName(doc.GetElementsByTagName("title").ElementAt(0).InnerText.Trim());
         model.setQuizDescription(doc.GetElementsByTagName("description").ElementAt(0).InnerText.Trim());
         string[] author = doc.GetElementsByTagName("author").ElementAt(0).InnerText.Split('\n');
         model.setQuizAuthor(author[1].Trim());
         model.setQuizAuthorEmail(author[2].Trim());
         model.setQuizVersion(doc.GetElementsByTagName("version").ElementAt(0).InnerText.Trim());
         XmlNodeList questions = doc.GetElementsByTagName("item");
         for (int i = 0; i < questions.Length; i++)
         {
             Question q = new Question();
             string[] ar = questions.ElementAt(i).InnerText.Split('\n');
             List<string> options = new List<string>();
             options.Add(ar[2].Trim());
             options.Add(ar[3].Trim());
             options.Add(ar[4].Trim());
             options.Add(ar[5].Trim());
             q.setOptionNumber(Convert.ToInt16(ar[6].Trim()));
             q.setAnswerOption(options);
             q.setQuestion(ar[1].Trim());
             mQuestionList.Add(q);
         }
         model.setQueAnsList(mQuestionList);
     }
     catch (Exception) { }
 }