Now resets and kicks user back to chunk selection if the chunk has been learnt

This commit is contained in:
BOT Alex 2023-06-29 13:19:27 +02:00
parent 2a49117995
commit 1a0c59af3a
1 changed files with 18 additions and 1 deletions

View File

@ -125,7 +125,11 @@
void GenerateQuestion() 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); 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() async void Submit()
{ {
bool isCorrect = Answers.Any(x => x.isCorrect && x.isSelected); bool isCorrect = Answers.Any(x => x.isCorrect && x.isSelected);