PWA Fundvelo der Caritas.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

IndexPage.razor 2.6KB

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