MainForm.cscsharp

Documentation

Lilith.DesktopWeb2App (Version 5)

Windows desktop shell (WebView2 + local Kestrel) hosting Lilith.RazorWebGui for Version 5.

dotnet run --project Lilith.DesktopWeb2App.csproj

Requires [WebView2 Runtime](https://developer.microsoft.com/microsoft-edge/webview2/).

using Microsoft.Web.WebView2.WinForms;namespace Lilith.DesktopWeb2App;internal sealed class MainForm : Form{    private readonly WebView2 _webView = new() { Dock = DockStyle.Fill };    public MainForm(string startUrl)    {        Text = "Lilith Desktop";        Width = 1100;        Height = 800;        StartPosition = FormStartPosition.CenterScreen;        Controls.Add(_webView);        Load += async (_, _) =>        {            await _webView.EnsureCoreWebView2Async();            _webView.CoreWebView2?.Navigate(startUrl);        };    }}