Now shows how many CChars left in the list

This commit is contained in:
BOT Alex 2023-06-29 12:47:18 +02:00
parent f634474923
commit dab3cb47b7
4 changed files with 23 additions and 1 deletions

View file

@ -107,16 +107,22 @@
protected override async Task OnInitializedAsync()
{
Program.UpdateUiEvent += OnUiUpdate;
int selectedChunk = await localStorage.GetItemAsync<int>("SelectedChunk");
//Charecters = await httpClient.GetFromJsonAsync<CChar[]>("Data/NormalizedDataset.json");
Charecters = await httpClient.GetFromJsonAsync<CChar[]>($"Data/Normalized_chunk_{selectedChunk.ToString("000")}.json");
DontSkipTheseCChar = Charecters.ToList();
Program.CCharsLeft = DontSkipTheseCChar.Count;
Program.InvokeUiUpdate();
GenerateQuestion();
}
void OnUiUpdate() => StateHasChanged();
void GenerateQuestion()
{
if (DontSkipTheseCChar.Count < 3) throw new Exception("Finished this chunk of CChars");
@ -190,6 +196,8 @@
CChar correctChar = GetCorrectCChar();
DontSkipTheseCChar.Remove(correctChar);
Console.WriteLine("Remaining CChars: " + DontSkipTheseCChar);
Program.CCharsLeft = DontSkipTheseCChar.Count;
Program.InvokeUiUpdate();
GenerateQuestion();
}