AbsQuizView CreateViewFor (Quiz quiz)
		{
			if (quiz.QuizType == QuizType.AlphaPicker)
				return new AlphaPickerQuizView (context, category, (AlphaPickerQuiz)quiz);
			if (quiz.QuizType == QuizType.FillBlank)
				return new FillBlankQuizView (context, category, (FillBlankQuiz)quiz);
			if (quiz.QuizType == QuizType.FillTwoBlanks)
				return new FillTwoBlanksQuizView (context, category, (FillTwoBlanksQuiz)quiz);
			if (quiz.QuizType == QuizType.FourQuarter)
				return new FourQuarterQuizView (context, category, (FourQuarterQuiz)quiz);
			if (quiz.QuizType == QuizType.MultiSelect)
				return new MultiSelectQuizView (context, category, (MultiSelectQuiz)quiz);
			if (quiz.QuizType == QuizType.Picker)
				return new PickerQuizView (context, category, (PickerQuiz)quiz);
			if (quiz.QuizType == QuizType.SingleSelect || quiz.QuizType == QuizType.SingleSelectItem)
				return new SelectItemQuizView (context, category, (SelectItemQuiz)quiz);
			if (quiz.QuizType == QuizType.ToggleTranslate)
				return new ToggleTranslateQuizView (context, category, (ToggleTranslateQuiz)quiz);
			if (quiz.QuizType == QuizType.TrueFalse)
				return new TrueFalseQuizView (context, category, (TrueFalseQuiz)quiz);
			throw new InvalidOperationException ("Quiz of type " + quiz.QuizType + " can not be displayed.");
		}
Example #2
0
		public bool IsSolvedCorrectly(Quiz quiz) {
			return GetScore(quiz) == GoodScore;
		}
Example #3
0
		public void SetScore(Quiz which, bool correctlySolved) {
			var index = quizzes.IndexOf(which);
			Log.Debug(TAG, "Setting score for " + which + " with index " + index);
			if (index == -1) {
				return;
			}
			scores[index] = correctlySolved ? GoodScore : NoScore;
		}
Example #4
0
		public int GetScore(Quiz which) {
			try {
				return scores[quizzes.IndexOf(which)];
			} catch (IndexOutOfRangeException) {
				return 0;
			}
		}
		AbsQuizView GetViewInternal (Quiz quiz)
		{
			if (quiz == null)
				throw new InvalidOperationException ("Quiz must not be null");
			return CreateViewFor (quiz);
		}
Example #6
0
		public void SetScore (Quiz which, bool correctlySolved)
		{
			var index = Quizzes.IndexOf (which);
			Log.Debug (TAG, string.Format ("Setting score for {0} with index {1}", which, index));
			if (index == -1)
				return;
			
			Scores [index] = correctlySolved ? GoodScore : NoScore;
		}