2022-09-04 19:19:42 +02:00
|
|
|
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
|
|
|
using MudBlazor.Services;
|
2023-10-16 11:38:27 +02:00
|
|
|
using TaikoWebUI.Settings;
|
2022-09-04 19:19:42 +02:00
|
|
|
|
|
|
|
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
|
|
|
builder.RootComponents.Add<App>("#app");
|
|
|
|
builder.RootComponents.Add<HeadOutlet>("head::after");
|
|
|
|
|
2022-09-09 14:31:45 +02:00
|
|
|
builder.Services.AddSingleton(sp => new HttpClient
|
2022-09-04 19:19:42 +02:00
|
|
|
{
|
2022-09-22 16:14:55 +02:00
|
|
|
BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
|
2022-09-04 19:19:42 +02:00
|
|
|
});
|
|
|
|
builder.Services.AddMudServices();
|
2022-09-09 14:31:45 +02:00
|
|
|
builder.Services.AddSingleton<IGameDataService, GameDataService>();
|
2022-09-04 19:19:42 +02:00
|
|
|
|
2023-10-16 11:38:27 +02:00
|
|
|
builder.Services.Configure<WebUiSettings>(builder.Configuration.GetSection(nameof(WebUiSettings)));
|
|
|
|
|
|
|
|
builder.Services.AddScoped<LoginService>();
|
|
|
|
|
2022-09-09 14:31:45 +02:00
|
|
|
var host = builder.Build();
|
|
|
|
|
|
|
|
var gameDataService = host.Services.GetRequiredService<IGameDataService>();
|
2022-09-22 16:14:55 +02:00
|
|
|
await gameDataService.InitializeAsync(builder.HostEnvironment.BaseAddress);
|
2022-09-09 14:31:45 +02:00
|
|
|
|
|
|
|
await host.RunAsync();
|