-
-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathProgram.cs
45 lines (36 loc) · 1.62 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
37
38
39
40
41
42
43
44
45
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using System.Globalization;
using Havit.Blazor.Documentation.Services;
using Havit.Blazor.Documentation.DemoData;
using Havit.Blazor.Documentation.Shared.Components.DocColorMode;
using Havit.Blazor.Documentation.Pages.Showcase.Data;
namespace Havit.Blazor.Documentation;
public class Program
{
public static async Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);
var cultureInfo = new CultureInfo("en-US");
CultureInfo.DefaultThreadCurrentCulture = cultureInfo;
CultureInfo.DefaultThreadCurrentUICulture = cultureInfo;
builder.Services.AddHxServices();
builder.Services.AddHxMessenger();
builder.Services.AddHxMessageBoxHost();
builder.Services.AddTransient<IComponentApiDocModelBuilder, ComponentApiDocModelBuilder>();
builder.Services.AddSingleton<IDocXmlProvider, DocXmlProvider>();
builder.Services.AddSingleton<IDocPageNavigationItemsTracker, DocPageNavigationItemsTracker>();
builder.Services.AddSingleton<IHttpContextProxy, WebAssemblyHttpContextProxy>();
builder.Services.AddSingleton<IShowcaseDataService, ShowcaseDataService>();
builder.Services.AddScoped<IDocColorModeProvider, DocColorModeProvider>();
builder.Services.AddCascadingValue<ColorMode>(services =>
{
var docColorModeStateProvider = services.GetRequiredService<IDocColorModeProvider>();
return new DocColorModeCascadingValueSource(docColorModeStateProvider);
});
builder.Services.AddTransient<IDemoDataService, DemoDataService>();
#if DEBUG
builder.Logging.SetMinimumLevel(LogLevel.Debug);
#endif
await builder.Build().RunAsync();
}
}