-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathProgram.cs
More file actions
25 lines (23 loc) · 863 Bytes
/
Program.cs
File metadata and controls
25 lines (23 loc) · 863 Bytes
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
global using DCSoft.WinForm2WASM;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.JSInterop;
using Microsoft.Extensions.DependencyInjection;
using System.ComponentModel;
using MWGAWinFormDemo;
[assembly: System.Reflection.AssemblyMetadata("IsTrimmable", "false")]
namespace DCSoft.WinForm2WASM
{
[System.Runtime.Versioning.SupportedOSPlatform("browser")]
internal class Prograss
{
public static async Task Main(string[] args)
{
// 1. 构建极简宿主(仅初始化核心服务,不含 RootComponent)
var builder = WebAssemblyHostBuilder.CreateDefault(args);
var host = builder.Build();
var jsRuntime = host.Services.GetRequiredService<IJSRuntime>() as JSInProcessRuntime;
await MWGAEngine.Start(jsRuntime);
await host.RunAsync();
}
}
}