diff --git a/LearningChineseFixed/Pages/Learn.razor b/LearningChineseFixed/Pages/Learn.razor index 9854df0..1b8e74f 100644 --- a/LearningChineseFixed/Pages/Learn.razor +++ b/LearningChineseFixed/Pages/Learn.razor @@ -125,7 +125,11 @@ void GenerateQuestion() { - if (DontSkipTheseCChar.Count < 5) throw new Exception("Finished this chunk of CChars"); + if (DontSkipTheseCChar.Count < 5) + { + FinishAndKickBackToLearn(); + return; + } int correctIndex = Random.Shared.Next(0, Answers.Length); @@ -142,6 +146,19 @@ } } + void FinishAndKickBackToLearn() + { + Snackbar.Add("Congrats, you have compleated this chunk!", Severity.Success, config => + { + config.RequireInteraction = true; + config.CloseAfterNavigation = false; + }); + Program.UpdateUiEvent -= OnUiUpdate; + Program.CCharsLeft = 0; + + navigator.NavigateTo(""); + } + async void Submit() { bool isCorrect = Answers.Any(x => x.isCorrect && x.isSelected);