Exemplo n.º 1
0
 /// <summary>
 /// select question from question link
 /// </summary>
 /// <param name="question"></param>
 public void SelectBack(Question question)
 {
     while (QuestionLink.Last() != question)
     {
         QuestionLink.Remove(QuestionLink.Last());
     }
     updateByCurentQuestion();
 }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="answer"></param>
        public void SelectAnswer(Answer answer)
        {
            Question subq = QuestionLink.Last().getQuestionByAnswer(answer.Id);

            if (!QuestionLink.Contains(subq))
            {
                QuestionLink.Add(subq);
                updateByCurentQuestion();
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// updates model by current questions
        /// </summary>
        private void updateByCurentQuestion()
        {
            Answers.Clear();
            //last question in question link is actual
            Question rootQuestion = QuestionLink.Last();

            if (rootQuestion == null)
            {
                ActualQuestion = "K dispozícii nie sú žiadne otázky.";
                return;
            }
            ActualQuestion = rootQuestion.Text;
            //actualise answers by current question
            foreach (KeyValuePair <int, Model.Answer> answ in rootQuestion.PossibleAnswers.Where(a => rootQuestion.getQuestionByAnswer(a.Key) != null))
            {
                Answers.Add(new Answer()
                {
                    Id     = answ.Key,
                    Text   = answ.Value.MainText,
                    Detail = answ.Value.Detail
                });
            }
        }