App.razor.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using FNZCM.BlazorWasm.Helpers;
  2. using FNZCM.Shared.MediaModels;
  3. using FNZCM.Shared.MetadataModels;
  4. namespace FNZCM.BlazorWasm.UI
  5. {
  6. public partial class App
  7. {
  8. private string LoadingMessage { get; set; }
  9. private LoadingProgress Progress { get; set; }
  10. protected override async Task OnInitializedAsync()
  11. {
  12. base.OnInitialized();
  13. do
  14. {
  15. Progress = await ApiClient.GetProgress();
  16. StateHasChanged();
  17. if (Progress?.IsLoading == false) break;
  18. Thread.Sleep(1000);
  19. } while (true);
  20. LoadingMessage = "Fetching fileset...";
  21. StateHasChanged();
  22. Dictionary<string, Library> Libraries = null;
  23. Dictionary<string, MediaTag> MediaTags = null;
  24. TimeoutHelper.SetTimeout(1, async () =>
  25. {
  26. Libraries = await ApiClient.GetLibraries();
  27. LoadingMessage = "Fetching tags...";
  28. StateHasChanged();
  29. }, async () =>
  30. {
  31. MediaTags = await ApiClient.GetMediaTags();
  32. LoadingMessage = "Processing model...";
  33. StateHasChanged();
  34. }, async () =>
  35. {
  36. FnzDataSet.InitFeModules2(ApiClient.ApiBase, Libraries, MediaTags);
  37. LoadingMessage = null;
  38. StateHasChanged();
  39. });
  40. }
  41. }
  42. }