public bool AddPerson(string form) { if (string.IsNullOrWhiteSpace(form)) { return(false); } PeopleInGroup += 1; var questions = form.ToCharArray(); foreach (var q in questions) { if (Questions.ContainsKey(q)) { Questions[q] += 1; } else { Questions.Add(q, 1); } } return(true); }
public void CheckAnswer(string key, IEnumerable <string> answerKeys) { NumberOfAnswers++; RaisePropertyChanged(nameof(NumberOfAnswers)); if (!Questions.ContainsKey(key)) { } else if (Questions[key].CorrectAnswerKeys.OrderBy(i => i).SequenceEqual(answerKeys.OrderBy(i => i))) { Reoccurrences[key] -= 1; NumberOfCorrectAnswers++; RaisePropertyChanged(nameof(NumberOfCorrectAnswers)); } else { Reoccurrences[key] += SettingsHelper.ReoccurrencesIfBad; if (Reoccurrences[key] > SettingsHelper.MaxReoccurrences) { Reoccurrences[key] = SettingsHelper.MaxReoccurrences; } NumberOfBadAnswers++; RaisePropertyChanged(nameof(NumberOfBadAnswers)); } if (Reoccurrences.ContainsKey(key) && Reoccurrences[key] == 0) { NumberOfLearnedQuestions++; RaisePropertyChanged(nameof(NumberOfLearnedQuestions)); NumberOfRemainingQuestions--; RaisePropertyChanged(nameof(NumberOfRemainingQuestions)); } if (IsTestCompleted()) { StopTimer(); } }