From b544d5cccd76735e034c8055918a50927b437474 Mon Sep 17 00:00:00 2001
From: wenxiangchao <wenxiangchao@ihengxin.com.cn>
Date: 星期二, 10 十一月 2026 08:29:04 +0800
Subject: [PATCH] fix: 维护模式重复进入失败与按钮灰死 + Broker 并发验证用例

---
 Plugin.TsExecution/SingleControl.xaml.cs |   68 +++++++++++++++++++++++++++++++---
 1 files changed, 62 insertions(+), 6 deletions(-)

diff --git a/Plugin.TsExecution/SingleControl.xaml.cs b/Plugin.TsExecution/SingleControl.xaml.cs
index 35ceb3b..0c3ecb0 100644
--- a/Plugin.TsExecution/SingleControl.xaml.cs
+++ b/Plugin.TsExecution/SingleControl.xaml.cs
@@ -2,11 +2,9 @@
 using HMI.Core.Manager;
 using HMI.Core.Setting;
 using HMI.Core.Util;
+using HMI.UI.Util;
 using HMI.Util;
 using NationalInstruments.TestStand.Interop.API;
-using NPOI.HSSF.UserModel;
-using NPOI.SS.Formula.Functions;
-using NPOI.SS.UserModel;
 using Plugin.TsExecution.Entity;
 using System;
 using System.Collections.Generic;
@@ -17,6 +15,7 @@
 using System.Timers;
 using System.Windows;
 using System.Windows.Controls;
+using Util.ManualDebug;
 
 namespace Plugin.TsExecution
 {
@@ -65,6 +64,8 @@
                 Set(ref totalNum, value);
             }
         }
+
+        public TsExecution parent { get; set; }
 
         private int passNum;
         public int PassNum
@@ -271,7 +272,7 @@
             try
             {
                 var value = ParameterManager.GetCommonParameterByName("AutoTestMode");
-                IsAutoMode = bool.Parse(value.Value);
+                IsAutoMode = value == null ? true : bool.Parse(value.Value);
             }
             catch
             {
@@ -373,7 +374,10 @@
 
         public void IniTestData()
         {
-            Datasource.Clear();
+            Dispatcher.Invoke(() =>
+            {
+                Datasource.Clear();
+            });
         }
 
         /// <summary>
@@ -564,7 +568,7 @@
 
         private void SendSnr2Ts()
         {
-           
+
         }
 
         private void pausePanel_Loaded(object sender, RoutedEventArgs e)
@@ -735,5 +739,57 @@
                 }.ShowDialog();
             }
         }
+
+        private void control_PreviewMouseRightButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
+        {
+            if (parent.EnableManualDebug)
+            {
+                ContextMenu contextMenu = new ContextMenu();
+                contextMenu.Closed += ContextMenu_Closed;
+                var item = new MenuItem
+                {
+                    IsCheckable = false,
+                    Name = "manualDebugItem",
+                    Header = this.lang("鎵嬪姩璋冭瘯"),
+                };
+                item.Click += Item_Click; ;
+                contextMenu.Items.Add(item);
+                this.ContextMenu = contextMenu;
+            }
+            else
+            {
+
+                this.ContextMenu = null;
+            }
+        }
+
+        private void Item_Click(object sender, RoutedEventArgs e)
+        {
+            string manualDebugSeq = ParameterManager.GetCommonParameterByName("ManualDebugSeqPath")?.Value;
+            if (string.IsNullOrEmpty(manualDebugSeq))
+            {
+                MsgBoxHelper2.Error("璇峰厛璁剧疆鎵嬪姩璋冭瘯搴忓垪璺緞[ManualDebugSeqPath]!");
+                return;
+            }
+            string modelPath = parent.tsModelPath;
+            var win = new ManualDebugWindow(manualDebugSeq, modelPath, false)
+            {
+                Title = $"宸ヤ綅{this.index}鎵嬪姩璋冭瘯",
+
+                Owner = Window.GetWindow(this),
+                OvenIndex = 0,
+                OvenName = "",
+                CellCount = parent.tsSockets.Count,
+
+                CellIndex = this.index,
+                CellName = "",
+            };
+            win.ShowDialog();
+        }
+
+        private void ContextMenu_Closed(object sender, RoutedEventArgs e)
+        {
+            this.ContextMenu = null;
+        }
     }
 }

--
Gitblit v1.9.1