A 增加跨平台通信桥接实现(CSharp/Tauri/WebMock)
A 新增全局类型定义文件(global.d.ts) A 新增 WebPanel 组件及其集成到 Shell UI A 新增 BridgeFactory 工厂类用于动态创建桥接实例 U 优化 CommandManager 组件使用新通信桥接逻辑 D 移除未使用的旧代码和配置(e.g., 命令相关的 JS 文件)
This commit is contained in:
1 parent
709ca30f12
commit
71fb7e2db1
22 files changed
+641
-199
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
@@ -19,26 +20,5 @@ public partial class MainWindow : Window
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
InitWebView();
|
||||
}
|
||||
|
||||
private async void InitWebView()
|
||||
{
|
||||
// 初始化 WebView2
|
||||
await webView.EnsureCoreWebView2Async();
|
||||
|
||||
// 加载前端页面:可以是本地文件或服务器地址
|
||||
// 示例 1:加载本地 HTML
|
||||
// string htmlPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "frontend", "index.html");
|
||||
// webView.CoreWebView2.Navigate($"file:///{htmlPath.Replace("\\", "/")}");
|
||||
|
||||
// 示例 2:加载远程网页
|
||||
webView.CoreWebView2.Navigate("http://localhost:3000");
|
||||
|
||||
webView.CoreWebView2.WebMessageReceived += (s, e) =>
|
||||
{
|
||||
string message = e.TryGetWebMessageAsString();
|
||||
MessageBox.Show($"收到消息: {message}");
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user