基于WebView2实现的Win11桌面框架,利用插件自定义
chunhualin1
2026-08-14 09d4e2f1a1bc206c80d8d3287d070c70ec7fd63d
src/Moli.Desktop/Host/DesktopHostBuilder.cs
@@ -25,8 +25,10 @@
        return Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder(args)
            .ConfigureLogging(logging =>
            {
                var paths = new DesktopPaths();
                logging.ClearProviders();
                logging.AddDebug();
                logging.AddProvider(new DailyFileLoggerProvider(paths.LogDirectory));
            })
            .ConfigureServices(services =>
            {
@@ -41,6 +43,8 @@
                services.AddSingleton<ILlmModelRegistry, LlmModelRegistry>();
                services.AddSingleton<ICredentialStore, EnvironmentCredentialStore>();
                services.AddHttpClient<OpenAICompatibleAdapter>();
                services.AddHttpClient<AiChatClient>();
                services.AddSingleton<IAiChatClient>(sp => sp.GetRequiredService<AiChatClient>());
                services.AddSingleton<ILlmProviderAdapter>(sp => sp.GetRequiredService<OpenAICompatibleAdapter>());
                services.AddSingleton<ILlmProviderAdapterFactory, LlmProviderAdapterFactory>();
                services.AddSingleton<ILlmGatewayService, LlmGatewayService>();
@@ -50,6 +54,10 @@
                services.AddSingleton<ILayoutManager, LayoutManager>();
                services.AddSingleton<IDesktopLayerStrategy, WorkerWDesktopLayerStrategy>();
                services.AddSingleton<IDesktopLayerStrategy, BottomDesktopLayerStrategy>();
                services.AddSingleton<DisplayChangeMonitor>();
                services.AddSingleton<INativeHotkeyApi, Win32HotkeyApi>();
                services.AddSingleton<IHotkeyMessageWindow, WpfHotkeyMessageWindow>();
                services.AddSingleton<IHotkeyService, HotkeyService>();
                services.AddSingleton<IWin32InteropService, Win32InteropService>();
                services.AddSingleton<PluginBridgeDispatcher>();
                services.AddSingleton<IWebViewHostFactory, WebViewHostFactory>();