示例#1
0
        public TestEditViewModel(Tests test)
        {
            _currentTest = test;
            _currentQuestion = new QuestionModel();
            _testQuestions = new ObservableCollection<QuestionModel>();

        }
示例#2
0
        private void InitQuestions(List<Question> questions)
        {
            foreach (var questionItem in questions)
            {
                QuestionModel questionModel = new QuestionModel();
                questionModel.QuestionText = questionItem.QuestionText;
                foreach (var variantItem in questionItem.Variants)
                {
                    var variant = new VariantModel();
                    if(variantItem.Type == "Image")
                    {
                        FileTransferClient fileTransfer = new FileTransferClient();

                        TransferedImage img = fileTransfer.DownloadImage(variantItem.ImageUri);
                        var path = SaveImage(img.data, img.Filename);
                        variant.ImageUri = path;
                        variant.Type = variantItem.Type;
                    }
                    else
                    {
                        variant.VariantText = variantItem.VariantText;                    
                    }
                    questionModel.Variants.Add(variant);
                }
                _questions.Add(questionModel);
            }
        }
示例#3
0
 public ImageQuestionBuilder(QuestionModel questionModel)
 {
     //TODO
 }
示例#4
0
 private void SaveQuestion()
 {
     TestQuestions.Add(CurrentQuestion);
     CurrentQuestion = new QuestionModel();
 }
示例#5
0
 private void LoadQuestion(int idx)
 {
     CurrentQuestion = _questions[idx];
 }
示例#6
0
 public TextQuestionBuilder(QuestionModel questionModel)
 {
     _questionModel = questionModel;
 }