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.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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<ScrollLockRemover>();
  27. builder.Services.AddSingleton<InputCursorHandler>();
  28. builder.Services.AddScoped<ReportRepositoryService>();
  29. builder.Services.AddScoped<Toaster>();
  30. builder.Services.AddScoped<UserDataProvider>();
  31. builder.Services.AddScoped<MasterDataService>();
  32. builder.Services.AddScoped<BlazorGeolocationService>();
  33. builder.Services.AddLocalization();
  34. builder.Services.AddBlazorLeafletMaps();
  35. builder.Services.AddMatToaster(config => {
  36. config.Position = MatToastPosition.BottomCenter;
  37. config.PreventDuplicates = true;
  38. config.NewestOnTop = true;
  39. config.MaxDisplayedToasts = 5;
  40. config.ShowCloseButton = true;
  41. config.ShowProgressBar = true;
  42. config.MaximumOpacity = 100;
  43. config.VisibleStateDuration = 5000;
  44. config.ShowTransitionDuration = 300;
  45. config.HideTransitionDuration = 150;
  46. });
  47. builder.Services.AddIndexedDB(dbStore => {
  48. dbStore.DbName = "CwebPlusAppDB";
  49. dbStore.Version = 1;
  50. dbStore.Stores.Add(new StoreSchema {
  51. Name = "FoundReportRepositoryItems",
  52. PrimaryKey = new IndexSpec { Name = "id", KeyPath = "id", Auto = true },
  53. Indexes = new List<IndexSpec> {
  54. new IndexSpec{Name="serverRefNbr", KeyPath = "serverRefNbr", Auto=false},
  55. new IndexSpec{Name="status", KeyPath = "status", Auto=false}
  56. }
  57. });
  58. dbStore.Stores.Add(new StoreSchema {
  59. Name = "MissingReportRepositoryItems",
  60. PrimaryKey = new IndexSpec { Name = "id", KeyPath = "id", Auto = true },
  61. Indexes = new List<IndexSpec> {
  62. new IndexSpec{Name="serverRefNbr", KeyPath = "serverRefNbr", Auto=false},
  63. new IndexSpec{Name="status", KeyPath = "status", Auto=false}
  64. }
  65. });
  66. });
  67. await builder.Build().RunAsync();
  68. }
  69. }
  70. }