Esempio n. 1
0
 public static void ReadingToXML(ReadingTest rt, string projectName, int whichText)
 {
     //create text.xml
     ReadingTextToXML(rt.Text, projectName, whichText, rt.Title, rt.GivenTime);
     //create questions.xml
     ReadingQuestionsToXML(rt, projectName, whichText);
 }
Esempio n. 2
0
        private static void ReadingQuestionsToXML(ReadingTest rt, string projectName, int whichText)
        {
            XmlWriter xmlWriter = XmlWriter.Create(@"TPO_Resources/Tests/" + projectName + "/Reading/Text_" + whichText + "/question.xml");

            xmlWriter.WriteStartDocument();
            xmlWriter.WriteStartElement("TEXT_" + whichText);
            if (rt.Questions != null)
            {
                for (int i = 0; i < rt.Questions.Count; i++)
                {
                    xmlWriter.WriteStartElement("Question_" + (i + 1));

                    xmlWriter.WriteStartElement("Question_Title");
                    xmlWriter.WriteString(rt.Questions[i].Title);
                    xmlWriter.WriteEndElement();

                    for (int j = 0; j < rt.Questions[i].Options.Count; j++)
                    {
                        xmlWriter.WriteStartElement("Option_" + (j + 1));
                        xmlWriter.WriteString(rt.Questions[i].Options[j]);

                        xmlWriter.WriteStartElement("isRightOption");
                        xmlWriter.WriteString(rt.Questions[i].RightOptions[j].ToString());
                        xmlWriter.WriteEndElement();

                        xmlWriter.WriteEndElement();
                    }

                    xmlWriter.WriteEndElement();
                }
            }
            xmlWriter.WriteEndDocument();
            xmlWriter.Close();
        }
Esempio n. 3
0
        private void Save()
        {
            "Saving".Log();
            ReadingTest rt = new ReadingTest()
            {
                Title                           = textTitleBox.Text,
                GivenTime                       = time.Text != null?int.Parse(time.Text) : 0,
                                           Text = new List <string>()
                {
                    new TextRange(MainText.Document.ContentStart, MainText.Document.ContentEnd).Text
                    //Paragraphneri bajanel u listi mej lcnel
                }

                //Question avelacnel
            };

            Tools.ReadingToXML(rt, ProjectName, 1);
        }