From 559890c482f5973f06aafdfec9550fee5ba3c7f2 Mon Sep 17 00:00:00 2001
From: wenxiangchao <wenxiangchao@ihengxin.com.cn>
Date: 星期一, 09 十一月 2026 17:02:15 +0800
Subject: [PATCH] feat: CAN 模拟器 TCP 化 + 多设备并发调试 + 后台生命周期管理

---
 Plugin.DeviceConfig/DeviceConfig.xaml.cs |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/Plugin.DeviceConfig/DeviceConfig.xaml.cs b/Plugin.DeviceConfig/DeviceConfig.xaml.cs
index e4d3357..b03763c 100644
--- a/Plugin.DeviceConfig/DeviceConfig.xaml.cs
+++ b/Plugin.DeviceConfig/DeviceConfig.xaml.cs
@@ -221,6 +221,13 @@
 
                 var chList = _model.GetChannelsByDevice(dev.DeviceId);
                 Channels = new ObservableCollection<DeviceChannel>(chList);
+
+                // V3.0 鎵ц浣嶇疆灞曠ず
+                tbExecutionMode.Text = dev.ExecutionMode == ExecutionModeKind.Broker
+                    ? "Broker 鍏变韩" : "Local 鐩磋繛";
+                tbAuthorityInfo.Text = dev.ExecutionMode == ExecutionModeKind.Broker
+                    ? $"{dev.AuthorityId} 路 {dev.PhysicalSessionKey}"
+                    : (string.IsNullOrWhiteSpace(dev.AuthorityId) ? V3AuthorityCatalog.LocalAuthorityId : dev.AuthorityId);
             }
             catch (Exception ex)
             {
@@ -326,6 +333,11 @@
                     DriverType = SelectedDevice.DriverType,
                     Transport = SelectedDevice.Transport,
                     Endpoint = SelectedDevice.Endpoint,
+                    ExecutionMode = SelectedDevice.ExecutionMode,
+                    AuthorityId = SelectedDevice.AuthorityId,
+                    BrokerId = SelectedDevice.BrokerId,
+                    OwnerProcessId = SelectedDevice.OwnerProcessId,
+                    PhysicalSessionKey = SelectedDevice.PhysicalSessionKey,
                     EffectiveVersion = SelectedDevice.EffectiveVersion,
                     CreatedAt = SelectedDevice.CreatedAt,
                     UpdatedAt = SelectedDevice.UpdatedAt
@@ -408,6 +420,8 @@
             tbTransport.Text = string.Empty;
             tbEndpoint.Text = string.Empty;
             tbEffectiveVersion.Text = string.Empty;
+            tbExecutionMode.Text = string.Empty;
+            tbAuthorityInfo.Text = string.Empty;
             Channels = new ObservableCollection<DeviceChannel>();
         }
 
@@ -494,6 +508,21 @@
                     ToastHelper.Warning("娌℃湁鍙彂甯冪殑鑽夌鐗堟湰");
                     return;
                 }
+
+                // V3.0 搂05 鍙戝竷闂ㄧ锛氭墽琛屼綅缃粦瀹氭牎楠屼笉閫氳繃鍒欓樆姝㈠彂甯�
+                var gateErrors = _model.ValidatePublishGate();
+                if (gateErrors.Count > 0)
+                {
+                    var detail = string.Join("\n", gateErrors.Take(8));
+                    if (gateErrors.Count > 8)
+                    {
+                        detail += $"\n鈥� 鍏� {gateErrors.Count} 椤归敊璇�";
+                    }
+                    log.Warn($"鍙戝竷闂ㄧ鎷︽埅: {string.Join("; ", gateErrors)}");
+                    MsgBoxHelper.Error(Window.GetWindow(this), $"鍙戝竷闂ㄧ鏍¢獙鏈�氳繃锛歕n{detail}");
+                    return;
+                }
+
                 var hash = _model.ComputeConfigHash();
                 draft.Hash = hash;
                 draft.Status = VersionStatus.Published;

--
Gitblit v1.9.1