基于WebView2实现的Win11桌面框架,利用插件自定义
Moli
2026-05-03 2fd6e68025d4b987cfde52b8402038ca34116876
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
using Moli.Desktop.Plugins;
using System.Windows;
 
namespace Moli.Desktop.WebView;
 
/// <summary>Runtime wrapper around a WebView2 instance owned by one plugin surface.</summary>
public interface IWebViewHost : IAsyncDisposable
{
    string HostId { get; }
    PluginId PluginId { get; }
    PluginType PluginType { get; }
    FrameworkElement View { get; }
    Task InitializeAsync(WebViewHostOptions options, CancellationToken cancellationToken = default);
    Task NavigateAsync(Uri entryUri, CancellationToken cancellationToken = default);
    Task InjectBridgeAsync(PluginBridgeContext context, CancellationToken cancellationToken = default);
    Task DispatchLifecycleEventAsync(string eventName, object? payload, CancellationToken cancellationToken = default);
    Task ReloadAsync(CancellationToken cancellationToken = default);
}