LearnChineseSimplified/CCharLearn/Client/Program.cs

38 lines
1.4 KiB
C#
Raw Permalink Normal View History

2023-07-07 19:41:56 +02:00
using CCharLearn;
2023-06-28 22:03:48 +02:00
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using MudBlazor;
using Blazored.LocalStorage;
using MudBlazor.Services;
using Toolbelt.Blazor.Extensions.DependencyInjection;
2023-06-28 22:03:48 +02:00
2023-07-07 19:41:56 +02:00
namespace CCharLearn
2023-06-28 22:03:48 +02:00
{
public class Program
{
public static int CCharsLeft = 0;
public static Action UpdateUiEvent;
2023-06-28 22:03:48 +02:00
public static async Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
builder.Services.AddMudServices(config =>
{
config.SnackbarConfiguration.ShowTransitionDuration = 100;
config.SnackbarConfiguration.HideTransitionDuration = 100;
2023-07-06 20:44:52 +02:00
config.SnackbarConfiguration.VisibleStateDuration = 5000;
2023-06-29 10:28:51 +02:00
config.SnackbarConfiguration.PositionClass = Defaults.Classes.Position.BottomCenter;
2023-06-28 22:03:48 +02:00
});
builder.Services.AddBlazoredLocalStorage();
builder.Services.AddSpeechSynthesis();
2023-06-28 22:03:48 +02:00
await builder.Build().RunAsync();
}
public static void InvokeUiUpdate() => UpdateUiEvent?.Invoke();
2023-06-28 22:03:48 +02:00
}
}