Dreamine.Web 1.0.0.0
WPF와 Blazor를 한 코드 흐름으로 연결하고 반복적인 MVVM 코드를 줄이는 오픈소스 FullKit 공식 웹 애플리케이션입니다.
로딩중...
검색중...
일치하는것 없음
Program.cs
이 파일의 문서화 페이지로 가기
1using Dreamine.Hybrid.Wpf.DependencyInjection;
2using Dreamine.Hybrid.Wpf.Hosting;
3using DreamineWeb.Blazor;
8using Microsoft.AspNetCore.Components.Server;
9using Microsoft.Extensions.Configuration;
10using Microsoft.Extensions.DependencyInjection;
11using Microsoft.Extensions.Hosting;
12
13namespace DreamineWeb;
14
23public static class Program
24{
33 [STAThread]
34 public static void Main()
35 {
36 var builder = Host.CreateApplicationBuilder();
37 int port = builder.Configuration.GetValue("DreamineServer:Port", 4090);
38 bool listenAny = builder.Configuration.GetValue("DreamineServer:ListenAnyIp", true);
39 string? doxygenRoot = DocumentationPathResolver.ResolveDoxygenRoot(builder.Configuration);
40
41 var opts = builder.Configuration.GetSection("Dreamine").Get<DreamineOptions>() ?? new();
42 builder.Services.AddSingleton(opts);
43
44 builder.Services.AddDreamineHybridWpf();
45 builder.Services.AddSingleton<ILibraryStore, JsonLibraryStore>();
46 builder.Services.AddSingleton<IPlaygroundStore, JsonPlaygroundStore>();
47 builder.Services.AddSingleton<SiteSettingsService>();
48 builder.Services.AddSingleton<AdminAuthService>();
49 builder.Services.AddSingleton<MainWindow>();
50
51 builder.Services.AddDreamineBlazorServer<AppShell>(options =>
52 {
53 options.Port = port;
54 options.ListenAnyIp = listenAny;
55 options.SharedServiceTypes.Add(typeof(ILibraryStore));
56 options.SharedServiceTypes.Add(typeof(IPlaygroundStore));
57 options.SharedServiceTypes.Add(typeof(DreamineOptions));
58 options.SharedServiceTypes.Add(typeof(SiteSettingsService));
59 options.SharedServiceTypes.Add(typeof(AdminAuthService));
60 if (doxygenRoot is not null)
61 options.AddPhysicalStaticFiles(doxygenRoot, "/docs/doxygen");
62 options.ConfigureServices = services =>
63 {
64 services.AddScoped<XmlDocAutoLinker>();
65 services.AddScoped<LibraryCatalogSyncService>();
66 services.AddScoped<VersionSyncService>();
67 services.AddScoped<UserPreferencesService>();
68 services.AddSingleton<DocumentationCatalogService>();
69 services.AddScoped<PlaygroundMediaService>();
70 services.AddScoped<Dreamine.UI.Blazor.DreamineDialogService>();
71 services.AddScoped<HomeViewModel>();
72 services.AddScoped<DocViewModel>();
73 services.AddScoped<AdminViewModel>();
74 services.AddAntiforgery(o => o.Cookie.SameSite = Microsoft.AspNetCore.Http.SameSiteMode.Lax);
75 services.Configure<CircuitOptions>(o =>
76 {
77 o.DetailedErrors = true;
78 o.DisconnectedCircuitRetentionPeriod = TimeSpan.FromMinutes(3);
79 });
80 services.AddSignalR(o => o.MaximumReceiveMessageSize = null);
81 };
82 });
83
84 builder.Build().RunDreamineWpfApp<App>();
85 }
86}
static void Main()
Definition Program.cs:34
static ? string ResolveDoxygenRoot(IConfiguration configuration)