mirror of
https://github.com/DrMboga/WotBlitzStatisticsBlazor.git
synced 2026-10-21 10:27:18 +02:00
48 lines
1.8 KiB
C#
48 lines
1.8 KiB
C#
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using System;
|
|
using System.Globalization;
|
|
using System.Net.Http;
|
|
using System.Threading.Tasks;
|
|
using MediatR;
|
|
using Microsoft.JSInterop;
|
|
using Radzen;
|
|
using WotBlitzStatisticsPro.Blazor.Model;
|
|
using WotBlitzStatisticsPro.Blazor.Services;
|
|
|
|
namespace WotBlitzStatisticsPro.Blazor
|
|
{
|
|
public class Program
|
|
{
|
|
public static async Task Main(string[] args)
|
|
{
|
|
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
|
builder.RootComponents.Add<App>("#app");
|
|
builder.Services.AddLocalization(options => options.ResourcesPath = "Resources");
|
|
|
|
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
|
|
|
|
builder.Services.AddScoped<DialogService>();
|
|
builder.Services.AddScoped<ISearchDialogService, SearchDialogService>();
|
|
|
|
builder.Services.AddMediatR(typeof(Program));
|
|
|
|
builder.Services.AddSingleton<NavigationMessagesInterceptor>();
|
|
builder.Services.AddScoped<ILocalStorageService, LocalStorageService>();
|
|
|
|
var host = builder.Build();
|
|
// Reading Current Culture from LocalStorage
|
|
var localStorageService = host.Services.GetRequiredService<ILocalStorageService>();
|
|
var settings = await localStorageService.GetItemAsync<UserSettings>(UserSettings.UserSettingsLocalStorageKey);
|
|
if (settings != null)
|
|
{
|
|
var culture = new CultureInfo(settings.Culture);
|
|
CultureInfo.DefaultThreadCurrentCulture = culture;
|
|
CultureInfo.DefaultThreadCurrentUICulture = culture;
|
|
}
|
|
|
|
await host.RunAsync();
|
|
}
|
|
}
|
|
}
|