Exemplo n.º 1
0
        private void LoadXML()
        {
            XmlSerializer serializer = new XmlSerializer(typeof(List <QuestionBlock>));

            if (File.Exists(Library.filePath))
            {
                using (FileStream fileStream = new FileStream(Library.filePath, FileMode.Open))
                {
                    questionsBlock = (List <QuestionBlock>)serializer.Deserialize(fileStream);
                    questionsBlock.Shuffle();

                    SelectQuestionCount     select     = new SelectQuestionCount(questionsBlock.Count);
                    selectQuestionCountForm selectForm = new selectQuestionCountForm(select);
                    selectForm.ShowDialog();
                    questionsBlock.RemoveRange(0, questionsBlock.Count - select.value);

                    questionsBlock.ForEach(x => x.Answers.Shuffle());
                    result.notAnswered         = questionsBlock.Count;
                    result.QuestionsAndAnswers = new Dictionary <int, int>();
                }
            }

            //QuestionsXML.xml
            LoadQuestions();
        }
Exemplo n.º 2
0
 public selectQuestionCountForm(SelectQuestionCount select)
 {
     InitializeComponent();
     this.Controls.Add(select);
 }