예제 #1
0
        public QuestionViewModel(IQuestionService questionService, 
                                    INavigationService navigationService,
                                    IBadgeService badgeService,
                                    ISettingsService settingsService,
                                    ILocalizationService localizationService,
                                    IAudioService audioService)
        {
            _questionService = questionService;
            _navigationService = navigationService;
            _badgeService = badgeService;
            _settingsService = settingsService;
            _localizationService = localizationService;
            _audioService = audioService;

            Messenger.Default.Register<Set>(this, Load);
            Messenger.Default.Register<CleanUp>(this, CallCleanUp);
#if DEBUG
            if (IsInDesignMode)
            {
                SelectedQuestion = new Question();

                BindQuestion(SelectedQuestion);

                ProgresLabel = "1/10";

                CorrectAnswers = 0;
                IncorrectAnswers = 0;
            }
#endif
        }
        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);
        }
예제 #3
0
        private void BindQuestion(Question selectedQuestion)
        {
            Text = selectedQuestion.Text;

            if (RandomNumber(1, 10) > 5)
            {
                AnswerCorrect = selectedQuestion.AnswerCorrect;
                AnswerIncorrect = selectedQuestion.AnswerIncorrect;
            }
            else
            {
                AnswerCorrect = selectedQuestion.AnswerIncorrect;
                AnswerIncorrect = selectedQuestion.AnswerCorrect;
            }
        }