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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. showProgressCircle = true;
  38. StateHasChanged();
  39. try {
  40. try {
  41. BicycleRestService.Initialize(Configuration);
  42. await MasterDataService.SynchronizeMasterdata();
  43. } catch (Exception) {
  44. Toaster.ShowWarning(I18n.GetString("Warning.Masterdata.Title"), I18n.GetString("Warning.Masterdata.Msg"));
  45. }
  46. int sent = await BicycleRestService.TrySendPendingReports();
  47. if (sent > 0) {
  48. Toaster.ShowSuccess(I18n.GetString("Info.SendPendigs.Title"), I18n.GetString("Info.SendPendigs.Msg", sent));
  49. }
  50. } finally {
  51. showProgressCircle = false;
  52. NavigateToNext();
  53. }
  54. btnDisabled = false;
  55. PageHistoryManager.Reset();
  56. StateHasChanged();
  57. }
  58. private void NavigateToNext() {
  59. NavigationManager.NavigateTo("./caritas_services");
  60. }
  61. }