Beispiel #1
0
        /// <summary>
        /// Adds question this view model will be based on
        /// NOTE: needs to be done before attaching this view model to the page
        /// </summary>
        /// <param name="question">The question to be attached to this viewmodel</param>
        public void AttachQuestion(MultipleCheckBoxesQuestion question)
        {
            // Get the question
            Question = question;

            // Convert from dictionary to answer items list
            Options = ListConvertQuestions();
        }
        private bool IsCorrect(MultipleCheckBoxesQuestion question)
        {
            var TaskIsCorrect          = question.Task == Task;
            var OptionsAreCorrect      = question.Options == Options;
            var CorrectAnswerIsCorrect = question.CorrectAnswer == CorrectAnswer;
            var ScoringIsCorrect       = question.Scoring == Scoring;

            var ifCorrect = TaskIsCorrect && OptionsAreCorrect && CorrectAnswerIsCorrect && ScoringIsCorrect;

            return(ifCorrect);
        }
        /// <summary>
        /// Adds question this view model will be based on
        /// NOTE: needs to be done before attaching this view model to the page
        /// </summary>
        /// <param name="question">The question to be attached to this viewmodel</param>
        /// <param name="ReadOnly">Indicates if this viewmodel is readonly</param>
        public void AttachQuestion(MultipleCheckBoxesQuestion question, bool ReadOnly = false)
        {
            // Get the question
            Question = question;

            // Convert from dictionary to answer items list
            Options = ListConvertQuestion();

            IsReadOnly = ReadOnly;

            // If not in readonly mode...
            if (!IsReadOnly)
            {
                // Make all the answers unchecked
                foreach (var item in Options)
                {
                    item.IsChecked = false;
                }
            }
        }