1
0
mirror of synced 2024-12-19 09:55:55 +01:00
TaikoLocalServer/TaikoWebUI/Program.cs

25 lines
842 B
C#
Raw Normal View History

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");
builder.Services.AddSingleton(sp => new HttpClient
2022-09-04 19:19:42 +02:00
{
BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
2022-09-04 19:19:42 +02:00
});
builder.Services.AddMudServices();
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>();
var host = builder.Build();
var gameDataService = host.Services.GetRequiredService<IGameDataService>();
await gameDataService.InitializeAsync(builder.HostEnvironment.BaseAddress);
await host.RunAsync();