基于WebView2实现的Win11桌面框架,利用插件自定义
Moli
2026-05-04 b3bde921167ee0a7dc21cf7e3d642840a0fcc11e
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
using Moli.Desktop.Diagnostics;
using Moli.Desktop.Plugins;
using Moli.Desktop.Runtime;
 
namespace Moli.Desktop.WebView;
 
public sealed class WebViewHostFactory : IWebViewHostFactory
{
    private readonly IDiagnosticsService _diagnostics;
    private readonly IRuntimeEventBus _events;
    private readonly PluginBridgeDispatcher _bridgeDispatcher;
 
    public WebViewHostFactory(
        IDiagnosticsService diagnostics,
        IRuntimeEventBus events,
        PluginBridgeDispatcher bridgeDispatcher)
    {
        _diagnostics = diagnostics;
        _events = events;
        _bridgeDispatcher = bridgeDispatcher;
    }
 
    public IWebViewHost Create(PluginDescriptor plugin)
    {
        return new WebViewHost(plugin, _diagnostics, _events, _bridgeDispatcher);
    }
}