Speech, auto avoid, bug fixes, iu improments
This commit is contained in:
parent
bc45154b70
commit
bb125e7c7d
8 changed files with 164 additions and 22 deletions
|
@ -2,6 +2,7 @@
|
|||
@inject NavigationManager navigator
|
||||
@inject HttpClient httpClient
|
||||
@inject Blazored.LocalStorage.ILocalStorageService localStorage
|
||||
@inject SpeechSynthesis SpeechSynthesis
|
||||
|
||||
<PageTitle>Index</PageTitle>
|
||||
|
||||
|
@ -105,17 +106,35 @@
|
|||
Parallel.For(0, numOfChunks, async (i)=>
|
||||
{
|
||||
await Task.Delay(10*i);
|
||||
jsonChunks[i] = await httpClient.GetStringAsync($"Data/Normalized_chunk_{i.ToString("000")}.json");
|
||||
try
|
||||
{
|
||||
jsonChunks[i] = await httpClient.GetStringAsync($"Data/Normalized_chunk_{i.ToString("000")}.json");
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
await Task.Delay(100);
|
||||
jsonChunks[i] = await httpClient.GetStringAsync($"Data/Normalized_chunk_{i.ToString("000")}.json");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(jsonChunks[i])) return;
|
||||
if (string.IsNullOrEmpty(jsonChunks[i])) throw new Exception("Couldn't load chunk: " + i);
|
||||
|
||||
await localStorage.SetItemAsync($"Normalized_chunk_{i.ToString("000")}.json", jsonChunks[i]);
|
||||
savedChunks = i + 1;
|
||||
try
|
||||
{
|
||||
await localStorage.SetItemAsync($"Normalized_chunk_{i.ToString("000")}.json", jsonChunks[i]);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
await Task.Delay(100);
|
||||
await localStorage.SetItemAsync($"Normalized_chunk_{i.ToString("000")}.json", jsonChunks[i]);
|
||||
}
|
||||
|
||||
if (!await localStorage.ContainKeyAsync($"Normalized_chunk_{i.ToString("000")}.json")) throw new Exception("Couldn't save chunk: " + i);
|
||||
});
|
||||
|
||||
while (jsonChunks.Any(x => x == null))
|
||||
{
|
||||
await Task.Delay(1);
|
||||
savedChunks = jsonChunks.Count(x=>x != null);
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue