PWA Fundvelo der Caritas.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

IndexPage.razor 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. @page "/"
  2. @using cwebplusApp.Shared.Services;
  3. @using Microsoft.Extensions.Configuration;
  4. @inject NavigationManager NavigationManager;
  5. @inject AppState AppState;
  6. @inject IStringLocalizer<Resources> i18n
  7. @inject PageHistoryManager PageHistoryManager
  8. @inject MasterDataService MasterDataService;
  9. @inject Toaster Toaster;
  10. @inject IConfiguration Configuration;
  11. @inject IBicycleRestService BicycleRestService;
  12. <div class="row h-100 justify-content-center">
  13. <div class="row d-flex align-items-center justify-content-center px-4 w-100">
  14. <img src="./images/caritas_logo.png" style="padding:1em;max-width:320px" class="w-100" alt="">
  15. </div>
  16. <div class="row align-items-end vw-100 h-50">
  17. <div class="col text-center">
  18. <h3 style="font-style:italic;padding-bottom:1em">@i18n["Welcome"]</h3>
  19. </div>
  20. </div>
  21. <div class="row align-items-center justify-content-center vw-100 h-25">
  22. <div>
  23. @if (showProgressCircle) {
  24. <div style="width:48px;margin:0 auto;">
  25. <MatProgressCircle Indeterminate="true" Size="MatProgressCircleSize.Large" />
  26. </div>
  27. <h6 style="font-style:italic;padding-bottom:1em">@i18n["Info.Masterdata.Initializing"]</h6>
  28. }
  29. </div>
  30. </div>
  31. </div>
  32. @code {
  33. private bool btnDisabled = true;
  34. private bool showProgressCircle = false;
  35. protected async override void OnInitialized() {
  36. base.OnInitialized();
  37. if (MasterDataService.FirstActivation) {
  38. Console.WriteLine("First activation");
  39. showProgressCircle = true;
  40. StateHasChanged();
  41. try {
  42. BicycleRestService.Initialize(Configuration);
  43. await MasterDataService.SynchronizeMasterdata();
  44. await BicycleRestService.TrySendPendingReports();
  45. } catch (Exception) {
  46. Toaster.ShowWarning(i18n.GetString("Warning.Masterdata.Title"), i18n.GetString("Warning.Masterdata.Msg"));
  47. } finally {
  48. showProgressCircle = false;
  49. NavigateToNext();
  50. }
  51. }
  52. btnDisabled = false;
  53. PageHistoryManager.Reset();
  54. StateHasChanged();
  55. }
  56. private void NavigateToNext() {
  57. NavigationManager.NavigateTo("./caritas_services");
  58. }
  59. }