Ejemplo n.º 1
0
        /// <summary>
        /// Конвертер AnswerBase в MultiChoiceBallAnswer
        /// </summary>
        /// <param name="ans"></param>
        /// <returns></returns>
        public static MultiChoiceBallAswer FromAswerBase(AnswerBase ans)
        {
            MultiChoiceBallAswer res = new MultiChoiceBallAswer();
            try
            {
                res = (MultiChoiceBallAswer) ans;
            }
            catch (Exception)
            {
                int ball = 0;
                if (ans.IsTrue == true)
                {
                    ball = 1;
                }

                res = new MultiChoiceBallAswer(ans.Data,ball) {ID = ans.ID};
            }

            return res;
        }
Ejemplo n.º 2
0
        public static ObservableCollection<QuestionBase> _Debug_GetTestQuestions()
        {
            ObservableCollection<QuestionBase> res;
            res = new ObservableCollection<QuestionBase>();

            {
                QSingleChoice q = new QSingleChoice()
                {
                    Name = "A1",
                    Number = 1,
                    Data = new MediaData("Lol1")
                    {
                       Files = new ObservableCollection<MediaFile>()
                       {
                           new MediaFile("TEXT1")
                       }
                    }
                };

                Answer ans = new Answer(new MediaData("Answer1"), true);
                q.Answers.Add(ans);

                Answer ans2 = new Answer(new MediaData("Answer2"), false);
                q.Answers.Add(ans2);

                res.Add(q);
            }


            {
                QSingleChoice q2 = new QSingleChoice()
                {
                    Name = "A2",
                    Number = 2,
                    Data = new MediaData("Lol2")
                    {
                        Files = new ObservableCollection<MediaFile>()
                       {
                           new MediaFile("TEXT2")
                       }
                    }
                };

                var ans = new Answer(new MediaData("Answer1"), false);
                q2.Answers.Add(ans);

                var ans2 = new Answer(new MediaData("Answer2"), true);
                q2.Answers.Add(ans2);

                res.Add(q2);
            }

            {
                QMultiChoice q3 = new QMultiChoice()
                {
                    Name = "A3",
                    Number = 3,
                    Data = new MediaData("Lol3")
                };


                var ans = new MultiChoiceBallAswer(new MediaData("Answer1"), true);
                q3.Answers.Add(ans);

                var ans2 = new MultiChoiceBallAswer(new MediaData("Answer2"), true);
                q3.Answers.Add(ans2);

                res.Add(q3);
            }

            return res;
        }