|
1 | | -using System; |
2 | | -using Microsoft.AspNetCore.Components.Authorization; |
3 | | -using Microsoft.AspNetCore.Components.Web; |
4 | | -using Microsoft.AspNetCore.Components.WebAssembly.Authentication; |
5 | | -using Microsoft.AspNetCore.Components.WebAssembly.Hosting; |
6 | | -using Microsoft.Extensions.DependencyInjection; |
7 | | -using MudBlazor; |
8 | | -using MudBlazor.Services; |
9 | | -using NetEvent.Client; |
10 | | -using NetEvent.Client.Extensions; |
11 | | -using NetEvent.Client.Services; |
12 | | -using NetEvent.Shared.Policy; |
13 | | - |
14 | | -var builder = WebAssemblyHostBuilder.CreateDefault(args); |
15 | | - |
16 | | -builder.RootComponents.Add<App>("#app"); |
17 | | -builder.RootComponents.Add<HeadOutlet>("head::after"); |
18 | | - |
19 | | -builder.Services.AddOptions(); |
20 | | -builder.Services.AddAuthorizationCore(config => config.AddPolicies()); |
21 | | -builder.Services.AddScoped<NetEventAuthenticationStateProvider>(); |
22 | | -builder.Services.AddScoped<AuthenticationStateProvider>(s => s.GetRequiredService<NetEventAuthenticationStateProvider>()); |
23 | | -builder.Services.AddScoped<IAuthService, AuthService>(); |
24 | | - |
25 | | -builder.Services.AddLocalization(options => options.ResourcesPath = "Resources"); |
26 | | -builder.Services.AddScoped<ISystemSettingsDataService, SystemSettingsService>(); |
27 | | -builder.Services.AddScoped<IUserService, UserService>(); |
28 | | -builder.Services.AddScoped<IThemeService, ThemeService>(); |
29 | | -builder.Services.AddScoped<IRoleService, RoleService>(); |
30 | | - |
31 | | -builder.Services.AddHttpClient(Constants.BackendApiHttpClientName) |
32 | | - .ConfigureHttpClient(client => client.BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)); |
33 | | - |
34 | | -builder.Services.AddHttpClient(Constants.BackendApiSecuredHttpClientName) |
35 | | - .ConfigureHttpClient(client => client.BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)) |
36 | | - .AddHttpMessageHandler<BaseAddressAuthorizationMessageHandler>(); |
37 | | - |
38 | | -builder.Services.AddMudServices(config => |
39 | | -{ |
40 | | - config.SnackbarConfiguration.PositionClass = Defaults.Classes.Position.BottomCenter; |
41 | | - |
42 | | - config.SnackbarConfiguration.PreventDuplicates = false; |
43 | | - config.SnackbarConfiguration.MaxDisplayedSnackbars = 5; |
44 | | - config.SnackbarConfiguration.NewestOnTop = false; |
45 | | - config.SnackbarConfiguration.ShowCloseIcon = true; |
46 | | - config.SnackbarConfiguration.VisibleStateDuration = 10000; |
47 | | - config.SnackbarConfiguration.HideTransitionDuration = 400; |
48 | | - config.SnackbarConfiguration.ShowTransitionDuration = 400; |
49 | | - config.SnackbarConfiguration.SnackbarVariant = Variant.Filled; |
50 | | -}); |
51 | | - |
52 | | -var app = builder.Build(); |
53 | | -await app.SetDefaultCultureAsync(); |
54 | | - |
55 | | -await app.RunAsync(); |
| 1 | +using System; |
| 2 | +using Microsoft.AspNetCore.Components.Authorization; |
| 3 | +using Microsoft.AspNetCore.Components.Web; |
| 4 | +using Microsoft.AspNetCore.Components.WebAssembly.Authentication; |
| 5 | +using Microsoft.AspNetCore.Components.WebAssembly.Hosting; |
| 6 | +using Microsoft.Extensions.DependencyInjection; |
| 7 | +using MudBlazor; |
| 8 | +using MudBlazor.Services; |
| 9 | +using NetEvent.Client; |
| 10 | +using NetEvent.Client.Extensions; |
| 11 | +using NetEvent.Client.Services; |
| 12 | +using NetEvent.Shared.Policy; |
| 13 | + |
| 14 | +var builder = WebAssemblyHostBuilder.CreateDefault(args); |
| 15 | + |
| 16 | +builder.RootComponents.Add<App>("#app"); |
| 17 | +builder.RootComponents.Add<HeadOutlet>("head::after"); |
| 18 | + |
| 19 | +builder.Services.AddOptions(); |
| 20 | +builder.Services.AddAuthorizationCore(config => config.AddPolicies()); |
| 21 | +builder.Services.AddScoped<NetEventAuthenticationStateProvider>(); |
| 22 | +builder.Services.AddScoped<AuthenticationStateProvider>(s => s.GetRequiredService<NetEventAuthenticationStateProvider>()); |
| 23 | +builder.Services.AddScoped<IAuthService, AuthService>(); |
| 24 | + |
| 25 | +builder.Services.AddLocalization(options => options.ResourcesPath = "Resources"); |
| 26 | +builder.Services.AddScoped<ISystemSettingsDataService, SystemSettingsService>(); |
| 27 | +builder.Services.AddScoped<ISystemInfoDataService, SystemInfoDataService>(); |
| 28 | +builder.Services.AddScoped<IUserService, UserService>(); |
| 29 | +builder.Services.AddScoped<IThemeService, ThemeService>(); |
| 30 | +builder.Services.AddScoped<IRoleService, RoleService>(); |
| 31 | + |
| 32 | +builder.Services.AddHttpClient(Constants.BackendApiHttpClientName) |
| 33 | + .ConfigureHttpClient(client => client.BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)); |
| 34 | + |
| 35 | +builder.Services.AddHttpClient(Constants.BackendApiSecuredHttpClientName) |
| 36 | + .ConfigureHttpClient(client => client.BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)) |
| 37 | + .AddHttpMessageHandler<BaseAddressAuthorizationMessageHandler>(); |
| 38 | + |
| 39 | +builder.Services.AddMudServices(config => |
| 40 | +{ |
| 41 | + config.SnackbarConfiguration.PositionClass = Defaults.Classes.Position.BottomCenter; |
| 42 | + |
| 43 | + config.SnackbarConfiguration.PreventDuplicates = false; |
| 44 | + config.SnackbarConfiguration.MaxDisplayedSnackbars = 5; |
| 45 | + config.SnackbarConfiguration.NewestOnTop = false; |
| 46 | + config.SnackbarConfiguration.ShowCloseIcon = true; |
| 47 | + config.SnackbarConfiguration.VisibleStateDuration = 10000; |
| 48 | + config.SnackbarConfiguration.HideTransitionDuration = 400; |
| 49 | + config.SnackbarConfiguration.ShowTransitionDuration = 400; |
| 50 | + config.SnackbarConfiguration.SnackbarVariant = Variant.Filled; |
| 51 | +}); |
| 52 | + |
| 53 | +var app = builder.Build(); |
| 54 | +await app.SetDefaultCultureAsync(); |
| 55 | + |
| 56 | +await app.RunAsync(); |
0 commit comments