Exemplo n.º 1
0
        public async Task<IList<Question>> GetAll(Set set)
        {
            XDocument loadedData = XDocument.Load(FilesPath + set.Id + XmlExt);

            var data = from query in loadedData.Descendants("question")
                       select new Question
                       {
                           Id = (int)query.Element("id"),
                           Text = (string)query.Element("text"),
                           AnswerCorrect = (int)query.Element("answearcorrect"),
                           AnswerIncorrect = (int)query.Element("answearincorrect")
                       };

            return (IList<Question>)data.ToList();
        }
Exemplo n.º 2
0
        public async Task<IList<Set>> GetAll()
        {
            var result = new List<Set>();

            for (var index = 0; index < 6; index++)
            {
                var set = new Set
                {
                    Name = "Set: " + index,
                    IsPassed = false
                };

                result.Add(set);
            }

            return await Task.FromResult<IList<Set>>(result);
        }
Exemplo n.º 3
0
        public async Task<IList<Question>> GetAll(Set set)
        {
            string xmlPath = Path.Combine(Package.Current.InstalledLocation.Path, FilesPath + set.Id + XmlExt);

            XDocument loadedData = XDocument.Load(xmlPath);

            var data = from query in loadedData.Descendants("question")
                       select new Question
                       {
                           Id = (int)query.Element("id"),
                           Text = (string)query.Element("text"),
                           AnswerCorrect = (int)query.Element("answearcorrect"),
                           AnswerIncorrect = (int)query.Element("answearincorrect")
                       };

            return (IList<Question>)data.ToList();
        }
        public async Task<IList<Question>> GetAll(Set set)
        {
            var result = new List<Question>();

            for (var index = 0; index < 30; index++)
            {
                var question = new Question
                {
                    Id = index,
                    Text = "Question: " + index,
                    AnswerCorrect = index + 1,
                    AnswerIncorrect = index
                };

                result.Add(question);
            }

            return await Task.FromResult<IList<Question>>(result);
        }
Exemplo n.º 5
0
 public async Task<int> GetCount(Set set)
 {
     IList<Question> list = await GetAll(set);
     return list.Count();
 }
Exemplo n.º 6
0
 public async Task<Question> GetById(Set set, int id)
 {
     IList<Question> list = await GetAll(set);
     return list.Skip(id).FirstOrDefault();
 }
Exemplo n.º 7
0
        public async void GetQuestions(Set set, int aqn)
        {
            SelectedQuestion = await _questionService.GetById(set, aqn);

            BindQuestion(SelectedQuestion);

            IList<Question> list = await _questionService.GetAll(set);

            TotalNumberOfQuestions = await _questionService.GetCount(set);

            ProgresLabel = SelectedQuestion.Id + "/" + TotalNumberOfQuestions;
        }
Exemplo n.º 8
0
        private void Load(Set set, int actualQuestionNumber)
        {
            SelectedSet = set;

            BackgroundSource = "Assets/Background/" + SelectedSet.Id + ".png";
            AnswerButtonImage = "Assets/Background/button" + SelectedSet.Id + ".png";
            AnswerButtonPressedImage = "Assets/Background/button_pressed" + SelectedSet.Id + ".png";

            if (!IsInDesignMode)
            {
                GetQuestions(SelectedSet, ActualQuestionNumber);
            }
        }
Exemplo n.º 9
0
 private void Load(Set set)
 {
     Load(set, 1);
 }