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.

Program.cs 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using BlazorGeolocation;
  2. using cwebplusApp;
  3. using cwebplusApp.Shared;
  4. using cwebplusApp.Shared.Services;
  5. using FisSst.BlazorMaps.DependencyInjection;
  6. using MatBlazor;
  7. using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
  8. using Microsoft.Extensions.DependencyInjection;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Net.Http;
  12. using System.Threading.Tasks;
  13. using TG.Blazor.IndexedDB;
  14. namespace CaritasPWA {
  15. public class Program {
  16. public static async Task Main(string[] args) {
  17. var builder = WebAssemblyHostBuilder.CreateDefault(args);
  18. builder.RootComponents.Add<App>("app");
  19. builder.Services.AddMatBlazor();
  20. builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
  21. builder.Services.AddScoped<IBicycleRestService, BicycleRestService>();
  22. builder.Services.AddSingleton<AppState>();
  23. builder.Services.AddSingleton<PageHistoryManager>();
  24. builder.Services.AddSingleton<ReportDataProvider>();
  25. builder.Services.AddSingleton<OnlineStatusProvider>();
  26. builder.Services.AddSingleton<PermissionsProvider>();
  27. builder.Services.AddSingleton<ScrollLockRemover>();
  28. builder.Services.AddSingleton<InputCursorHandler>();
  29. builder.Services.AddScoped<ReportRepositoryService>();
  30. builder.Services.AddScoped<Toaster>();
  31. builder.Services.AddScoped<UserDataProvider>();
  32. builder.Services.AddScoped<MasterDataService>();
  33. builder.Services.AddScoped<BlazorGeolocationService>();
  34. builder.Services.AddLocalization();
  35. builder.Services.AddBlazorLeafletMaps();
  36. builder.Services.AddMatToaster(config => {
  37. config.Position = MatToastPosition.BottomCenter;
  38. config.PreventDuplicates = true;
  39. config.NewestOnTop = true;
  40. config.MaxDisplayedToasts = 5;
  41. config.ShowCloseButton = true;
  42. config.ShowProgressBar = true;
  43. config.MaximumOpacity = 100;
  44. config.VisibleStateDuration = 10000;
  45. config.ShowTransitionDuration = 300;
  46. config.HideTransitionDuration = 150;
  47. });
  48. builder.Services.AddIndexedDB(dbStore => {
  49. dbStore.DbName = "CwebPlusAppDB";
  50. dbStore.Version = 1;
  51. dbStore.Stores.Add(new StoreSchema {
  52. Name = "FoundReportRepositoryItems",
  53. PrimaryKey = new IndexSpec { Name = "id", KeyPath = "id", Auto = true },
  54. Indexes = new List<IndexSpec> {
  55. new IndexSpec{Name="serverRefNbr", KeyPath = "serverRefNbr", Auto=false},
  56. new IndexSpec{Name="status", KeyPath = "status", Auto=false}
  57. }
  58. });
  59. dbStore.Stores.Add(new StoreSchema {
  60. Name = "MissingReportRepositoryItems",
  61. PrimaryKey = new IndexSpec { Name = "id", KeyPath = "id", Auto = true },
  62. Indexes = new List<IndexSpec> {
  63. new IndexSpec{Name="serverRefNbr", KeyPath = "serverRefNbr", Auto=false},
  64. new IndexSpec{Name="status", KeyPath = "status", Auto=false}
  65. }
  66. });
  67. });
  68. await builder.Build().RunAsync();
  69. }
  70. }
  71. }