Able to download whole data to local

This commit is contained in:
BOT Alex 2023-06-29 21:27:58 +02:00
parent d2ab28372f
commit 059088121e
5 changed files with 78 additions and 7 deletions

View file

@ -76,6 +76,8 @@
@code {
public bool ShowOverlay = false;
bool isSavedLocally = false;
public Answer[] Answers = new Answer[4];
public void SelectButton(int selectedIndex)
{
@ -109,10 +111,17 @@
{
Program.UpdateUiEvent += OnUiUpdate;
isSavedLocally = await localStorage.ContainKeyAsync("Normalized_chunk_001.json");
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");
if (!isSavedLocally)
Charecters = await httpClient.GetFromJsonAsync<CChar[]>($"Data/Normalized_chunk_{selectedChunk.ToString("000")}.json");
else
{
string json = await localStorage.GetItemAsync<string>($"Normalized_chunk_{selectedChunk.ToString("000")}.json");
Charecters = JsonConvert.DeserializeObject<CChar[]>(json);
}
DontSkipTheseCChar = Charecters.ToList();
Program.CCharsLeft = DontSkipTheseCChar.Count;