-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
36 lines (26 loc) · 1.36 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Blazored.LocalStorage;
using Vetra;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
builder.Services.AddSingleton(new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
builder.Services.AddBlazoredLocalStorageAsSingleton();
builder.Services.AddBlazorBootstrap();
builder.Services.AddSingleton<BlazorBootstrap.ToastService>();
builder.Services.AddSingleton<HelperService>();
builder.Services.AddSingleton<NotificationService>();
builder.Services.AddSingleton<TextToSpeechService>();
builder.Services.AddSingleton<SpeechToTextService>();
builder.Services.AddSingleton<AudioService>();
builder.Services.AddSingleton<SettingsService>();
builder.Services.AddSingleton<ProfileService>();
builder.Services.AddSingleton<LessonService>();
var host = builder.Build();
await host.Services.GetRequiredService<NotificationService>().LoadServiceWorker();
host.Services.GetRequiredService<TextToSpeechService>().Preload();
var lessonService = host.Services.GetRequiredService<LessonService>();
await lessonService.LoadLessonHeadersAsync("data/lesson-headers.json");
await lessonService.LoadVocabHeadersAsync("data/vocab-headers.json");
await host.RunAsync();