From 693a6135b4762c20c01b5df52ea2da9ae73f237b Mon Sep 17 00:00:00 2001
From: C3204 <zhengyabo@lanpucloud.cn>
Date: 星期三, 28 一月 2026 08:59:49 +0800
Subject: [PATCH] 配方界面整合以及主界面布局。

---
 LB_SmartVision/ProcessRun/ProcessRunBll.cs                                         |    4 
 LB_VisionProcesses/Alogrithms/Halcon/2D/HFindMultiModelTool/HFindMultiModelTool.cs |   24 +++
 LB_SmartVision/VisionForm.cs                                                       |  122 +++++++++++++++++
 LB_VisionProcesses/Alogrithms/Halcon/2D/HFindModelTool/HFindModelTool.cs           |   22 +++
 LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.cs                           |   14 +
 LB_VisionFlowNode/FlowPanel.cs                                                     |    4 
 LB_VisionProcesses/Alogrithms/Halcon/2D/HFindCode2dTool/HFindCode2dTool.cs         |   24 +++
 LB_VisionProcesses/Alogrithms/Halcon/2D/HBlobTool/HBlobTool.cs                     |   11 +
 LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.Designer.cs                  |    4 
 LB_SmartVision/VisionForm.Designer.cs                                              |  140 ++++++++++++-------
 LB_VisionProcesses/Alogrithms/Halcon/2D/HFindLineTool/HFindLineTool.cs             |   28 ++++
 11 files changed, 331 insertions(+), 66 deletions(-)

diff --git a/LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.Designer.cs b/LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.Designer.cs
index 217409e..1fa35ca 100644
--- a/LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.Designer.cs
+++ b/LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.Designer.cs
@@ -71,6 +71,7 @@
             btnRun.Size = new Size(93, 24);
             btnRun.Text = "鍗曟杩愯";
             btnRun.ToolTipText = "鍗曟杩愯";
+            btnRun.Visible = false;
             btnRun.Click += btnRun_Click;
             // 
             // btnCircleRun
@@ -82,6 +83,7 @@
             btnCircleRun.Size = new Size(93, 24);
             btnCircleRun.Text = "杩炵画杩愯";
             btnCircleRun.ToolTipText = "杩炵画";
+            btnCircleRun.Visible = false;
             btnCircleRun.Click += btnCircleRun_Click;
             // 
             // panel1
@@ -156,7 +158,7 @@
             BackColor = Color.FromArgb(32, 41, 50);
             Controls.Add(uiPanel1);
             Controls.Add(toolStrip1);
-            Margin = new Padding(4, 4, 4, 4);
+            Margin = new Padding(4);
             Name = "ProcessControl";
             Size = new Size(450, 287);
             Load += ProcessControl_Load;
diff --git a/LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.cs b/LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.cs
index 41f0e6b..56910c0 100644
--- a/LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.cs
+++ b/LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.cs
@@ -10,6 +10,16 @@
     {
         UserHSmartWindowControl UserHSmartWindowControl = new UserHSmartWindowControl();
 
+        public event ProcessRunBllRun OnProcessRunBllRun;
+
+        private void onProcessRunBllRun()
+        {
+            if (OnProcessRunBllRun != null)
+            {
+                OnProcessRunBllRun();
+            }
+        }
+
         public string Title = string.Empty;
 
         public event Control_MouseDown event_MouseDown;
@@ -130,8 +140,8 @@
             if (isCircleRuning || ProcessRunBll.bRuning)
                 ProcessRunBll.LogInfo($"{ProcessRunBll.Name}姝e湪杩愯", LogInfoType.ERROR);
 
-            ProcessRunBll.Run();
-
+            //ProcessRunBll.Run();
+            onProcessRunBllRun();
             msg = ProcessRunBll.Msg;
             return ProcessRunBll.Result;
         }
diff --git a/LB_SmartVision/ProcessRun/ProcessRunBll.cs b/LB_SmartVision/ProcessRun/ProcessRunBll.cs
index e91c741..014464b 100644
--- a/LB_SmartVision/ProcessRun/ProcessRunBll.cs
+++ b/LB_SmartVision/ProcessRun/ProcessRunBll.cs
@@ -17,6 +17,8 @@
 
 namespace LB_SmartVision.ProcessRun
 {
+    public delegate void ProcessRunBllRun();
+
     public class ProcessRunBll
     {
 
@@ -648,7 +650,7 @@
                     {
                         dicOutputsMapping.TryAdd(name, new List<string>());
                         dicOutputsMapping[name].Add(name + ".Outputs.Image");
-                        //dicOutputsMapping[name].Add(name + ".Outputs.Record");
+                        dicOutputsMapping[name].Add(name + ".Outputs.Record");
                         dicOutputsMapping[name].Add(name + ".Outputs.Result");
 
                         foreach (var item in process.Params.Outputs)
diff --git a/LB_SmartVision/VisionForm.Designer.cs b/LB_SmartVision/VisionForm.Designer.cs
index bbb7b57..c38164c 100644
--- a/LB_SmartVision/VisionForm.Designer.cs
+++ b/LB_SmartVision/VisionForm.Designer.cs
@@ -35,9 +35,11 @@
             materialTabControl = new MaterialSkin.Controls.MaterialTabControl();
             tlp_VisionMainOperator = new Sunny.UI.UITableLayoutPanel();
             ckb_AllowRun = new Sunny.UI.UICheckBox();
-            btn_Login = new ReaLTaiizor.Controls.Button();
-            btn_GlobalVar = new ReaLTaiizor.Controls.Button();
             com_ProductName = new ReaLTaiizor.Controls.AloneComboBox();
+            btn_SingleRun = new Sunny.UI.UIButton();
+            btn_Login = new Sunny.UI.UIButton();
+            btn_RunContinuously = new Sunny.UI.UIButton();
+            btn_GlobalVar = new Sunny.UI.UIButton();
             materialTabSelector = new MaterialSkin.Controls.MaterialTabSelector();
             grb_Info = new Sunny.UI.UIGroupBox();
             rich_Info = new Sunny.UI.UIRichTextBox();
@@ -89,7 +91,7 @@
             // 
             sc_VisionForm.Panel2.Controls.Add(grb_Info);
             sc_VisionForm.Size = new Size(1416, 781);
-            sc_VisionForm.SplitterDistance = 593;
+            sc_VisionForm.SplitterDistance = 572;
             sc_VisionForm.SplitterWidth = 5;
             sc_VisionForm.TabIndex = 1;
             // 
@@ -108,7 +110,7 @@
             tlp_MainView.RowStyles.Add(new RowStyle(SizeType.Absolute, 60F));
             tlp_MainView.RowStyles.Add(new RowStyle(SizeType.Absolute, 39F));
             tlp_MainView.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
-            tlp_MainView.Size = new Size(1416, 593);
+            tlp_MainView.Size = new Size(1416, 572);
             tlp_MainView.TabIndex = 1;
             tlp_MainView.TagString = null;
             // 
@@ -122,7 +124,7 @@
             materialTabControl.MouseState = MaterialSkin.MouseState.HOVER;
             materialTabControl.Name = "materialTabControl";
             materialTabControl.SelectedIndex = 0;
-            materialTabControl.Size = new Size(1412, 490);
+            materialTabControl.Size = new Size(1412, 469);
             materialTabControl.TabIndex = 0;
             // 
             // tlp_VisionMainOperator
@@ -139,9 +141,11 @@
             tlp_VisionMainOperator.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 11.1111107F));
             tlp_VisionMainOperator.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 11.1111107F));
             tlp_VisionMainOperator.Controls.Add(ckb_AllowRun, 0, 0);
-            tlp_VisionMainOperator.Controls.Add(btn_Login, 1, 0);
-            tlp_VisionMainOperator.Controls.Add(btn_GlobalVar, 7, 0);
             tlp_VisionMainOperator.Controls.Add(com_ProductName, 8, 0);
+            tlp_VisionMainOperator.Controls.Add(btn_SingleRun, 2, 0);
+            tlp_VisionMainOperator.Controls.Add(btn_Login, 1, 0);
+            tlp_VisionMainOperator.Controls.Add(btn_RunContinuously, 3, 0);
+            tlp_VisionMainOperator.Controls.Add(btn_GlobalVar, 7, 0);
             tlp_VisionMainOperator.Dock = DockStyle.Fill;
             tlp_VisionMainOperator.Location = new Point(4, 64);
             tlp_VisionMainOperator.Margin = new Padding(4);
@@ -165,50 +169,6 @@
             ckb_AllowRun.TabIndex = 2;
             ckb_AllowRun.Text = "杩愯妯″紡";
             // 
-            // btn_Login
-            // 
-            btn_Login.BackColor = Color.Transparent;
-            btn_Login.BorderColor = Color.FromArgb(32, 34, 37);
-            btn_Login.Dock = DockStyle.Fill;
-            btn_Login.EnteredBorderColor = Color.FromArgb(165, 37, 37);
-            btn_Login.EnteredColor = Color.FromArgb(32, 34, 37);
-            btn_Login.Font = new Font("瀹嬩綋", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134);
-            btn_Login.Image = null;
-            btn_Login.ImageAlign = ContentAlignment.MiddleLeft;
-            btn_Login.InactiveColor = Color.FromArgb(32, 34, 37);
-            btn_Login.Location = new Point(160, 4);
-            btn_Login.Margin = new Padding(4);
-            btn_Login.Name = "btn_Login";
-            btn_Login.PressedBorderColor = Color.FromArgb(165, 37, 37);
-            btn_Login.PressedColor = Color.FromArgb(165, 37, 37);
-            btn_Login.Size = new Size(148, 23);
-            btn_Login.TabIndex = 3;
-            btn_Login.Text = "鐢ㄦ埛鐧诲綍";
-            btn_Login.TextAlignment = StringAlignment.Center;
-            btn_Login.Click += btn_Login_Click;
-            // 
-            // btn_GlobalVar
-            // 
-            btn_GlobalVar.BackColor = Color.Gray;
-            btn_GlobalVar.BorderColor = Color.FromArgb(32, 34, 37);
-            btn_GlobalVar.Dock = DockStyle.Fill;
-            btn_GlobalVar.EnteredBorderColor = Color.FromArgb(165, 37, 37);
-            btn_GlobalVar.EnteredColor = Color.FromArgb(32, 34, 37);
-            btn_GlobalVar.Font = new Font("瀹嬩綋", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 0);
-            btn_GlobalVar.Image = null;
-            btn_GlobalVar.ImageAlign = ContentAlignment.MiddleLeft;
-            btn_GlobalVar.InactiveColor = Color.FromArgb(32, 34, 37);
-            btn_GlobalVar.Location = new Point(1096, 4);
-            btn_GlobalVar.Margin = new Padding(4);
-            btn_GlobalVar.Name = "btn_GlobalVar";
-            btn_GlobalVar.PressedBorderColor = Color.FromArgb(165, 37, 37);
-            btn_GlobalVar.PressedColor = Color.FromArgb(165, 37, 37);
-            btn_GlobalVar.Size = new Size(148, 23);
-            btn_GlobalVar.TabIndex = 4;
-            btn_GlobalVar.Text = "鍏ㄥ眬鍙橀噺";
-            btn_GlobalVar.TextAlignment = StringAlignment.Center;
-            btn_GlobalVar.Click += btn_GlobalVar_Click;
-            // 
             // com_ProductName
             // 
             com_ProductName.Dock = DockStyle.Fill;
@@ -224,6 +184,74 @@
             com_ProductName.Size = new Size(152, 26);
             com_ProductName.TabIndex = 5;
             com_ProductName.SelectedValueChanged += com_ProductName_SelectedValueChanged;
+            // 
+            // btn_SingleRun
+            // 
+            btn_SingleRun.BackColor = Color.FromArgb(39, 51, 63);
+            btn_SingleRun.Dock = DockStyle.Fill;
+            btn_SingleRun.FillColor = Color.FromArgb(39, 51, 63);
+            btn_SingleRun.FillColor2 = Color.FromArgb(39, 51, 63);
+            btn_SingleRun.FillSelectedColor = Color.FromArgb(128, 255, 128);
+            btn_SingleRun.Font = new Font("瀹嬩綋", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
+            btn_SingleRun.Location = new Point(315, 3);
+            btn_SingleRun.MinimumSize = new Size(1, 1);
+            btn_SingleRun.Name = "btn_SingleRun";
+            btn_SingleRun.Size = new Size(150, 25);
+            btn_SingleRun.TabIndex = 6;
+            btn_SingleRun.Text = "鍗曟杩愯";
+            btn_SingleRun.TipsFont = new Font("瀹嬩綋", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
+            btn_SingleRun.Click += btn_Run_Click;
+            // 
+            // btn_Login
+            // 
+            btn_Login.BackColor = Color.FromArgb(39, 51, 63);
+            btn_Login.Dock = DockStyle.Fill;
+            btn_Login.FillColor = Color.FromArgb(39, 51, 63);
+            btn_Login.FillColor2 = Color.FromArgb(39, 51, 63);
+            btn_Login.FillSelectedColor = Color.FromArgb(128, 255, 128);
+            btn_Login.Font = new Font("瀹嬩綋", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
+            btn_Login.Location = new Point(159, 3);
+            btn_Login.MinimumSize = new Size(1, 1);
+            btn_Login.Name = "btn_Login";
+            btn_Login.Size = new Size(150, 25);
+            btn_Login.TabIndex = 6;
+            btn_Login.Text = "鐢ㄦ埛鐧诲綍";
+            btn_Login.TipsFont = new Font("瀹嬩綋", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
+            btn_Login.Click += btn_Login_Click;
+            // 
+            // btn_RunContinuously
+            // 
+            btn_RunContinuously.BackColor = Color.FromArgb(39, 51, 63);
+            btn_RunContinuously.Dock = DockStyle.Fill;
+            btn_RunContinuously.FillColor = Color.FromArgb(39, 51, 63);
+            btn_RunContinuously.FillColor2 = Color.FromArgb(39, 51, 63);
+            btn_RunContinuously.FillSelectedColor = Color.FromArgb(128, 255, 128);
+            btn_RunContinuously.Font = new Font("瀹嬩綋", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
+            btn_RunContinuously.Location = new Point(471, 3);
+            btn_RunContinuously.MinimumSize = new Size(1, 1);
+            btn_RunContinuously.Name = "btn_RunContinuously";
+            btn_RunContinuously.Size = new Size(150, 25);
+            btn_RunContinuously.TabIndex = 6;
+            btn_RunContinuously.Text = "杩炵画杩愯";
+            btn_RunContinuously.TipsFont = new Font("瀹嬩綋", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
+            btn_RunContinuously.Click += btn_RunContinuously_Click;
+            // 
+            // btn_GlobalVar
+            // 
+            btn_GlobalVar.BackColor = Color.FromArgb(39, 51, 63);
+            btn_GlobalVar.Dock = DockStyle.Fill;
+            btn_GlobalVar.FillColor = Color.FromArgb(39, 51, 63);
+            btn_GlobalVar.FillColor2 = Color.FromArgb(39, 51, 63);
+            btn_GlobalVar.FillSelectedColor = Color.FromArgb(128, 255, 128);
+            btn_GlobalVar.Font = new Font("瀹嬩綋", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
+            btn_GlobalVar.Location = new Point(1095, 3);
+            btn_GlobalVar.MinimumSize = new Size(1, 1);
+            btn_GlobalVar.Name = "btn_GlobalVar";
+            btn_GlobalVar.Size = new Size(150, 25);
+            btn_GlobalVar.TabIndex = 6;
+            btn_GlobalVar.Text = "鍏ㄥ眬鍙橀噺";
+            btn_GlobalVar.TipsFont = new Font("瀹嬩綋", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
+            btn_GlobalVar.Click += btn_GlobalVar_Click;
             // 
             // materialTabSelector
             // 
@@ -249,7 +277,7 @@
             grb_Info.MinimumSize = new Size(1, 1);
             grb_Info.Name = "grb_Info";
             grb_Info.Padding = new Padding(0, 40, 0, 0);
-            grb_Info.Size = new Size(1416, 183);
+            grb_Info.Size = new Size(1416, 204);
             grb_Info.TabIndex = 1;
             grb_Info.Text = "鏃ュ織鏄剧ず鍖猴細";
             grb_Info.TextAlignment = ContentAlignment.MiddleLeft;
@@ -265,7 +293,7 @@
             rich_Info.Name = "rich_Info";
             rich_Info.Padding = new Padding(2);
             rich_Info.ShowText = false;
-            rich_Info.Size = new Size(1416, 143);
+            rich_Info.Size = new Size(1416, 164);
             rich_Info.TabIndex = 0;
             rich_Info.TextAlignment = ContentAlignment.MiddleLeft;
             // 
@@ -321,13 +349,15 @@
         private SplitContainer sc_VisionForm;
         private Sunny.UI.UITableLayoutPanel tlp_VisionMainOperator;
         private Sunny.UI.UICheckBox ckb_AllowRun;
-        private ReaLTaiizor.Controls.Button btn_Login;
-        private ReaLTaiizor.Controls.Button btn_GlobalVar;
         private Sunny.UI.UIGroupBox grb_Info;
         private Sunny.UI.UIRichTextBox rich_Info;
         private MaterialSkin.Controls.MaterialTabControl materialTabControl;
         private ReaLTaiizor.Controls.AloneComboBox com_ProductName;
         private MaterialSkin.Controls.MaterialTabSelector materialTabSelector;
         private Sunny.UI.UITableLayoutPanel tlp_MainView;
+        private Sunny.UI.UIButton btn_SingleRun;
+        private Sunny.UI.UIButton btn_Login;
+        private Sunny.UI.UIButton btn_RunContinuously;
+        private Sunny.UI.UIButton btn_GlobalVar;
     }
 }
\ No newline at end of file
diff --git a/LB_SmartVision/VisionForm.cs b/LB_SmartVision/VisionForm.cs
index 14f66c7..8a041a1 100644
--- a/LB_SmartVision/VisionForm.cs
+++ b/LB_SmartVision/VisionForm.cs
@@ -1716,6 +1716,128 @@
                 communicator.Disconnect();
             }
             FormClosing -= VisionForm_FormClosing;
+
+            //try
+            //{
+            //    Process[] processes = System.Diagnostics.Process.GetProcesses(); //鑾峰緱鎵�鏈夎繘绋�
+            //    foreach (Process p in processes)
+            //    {
+            //        if (p.ProcessName == "LB_SmartVision" && p.StartTime < DateTime.Now.AddMilliseconds(-300))
+            //        {
+            //            p.Kill();
+            //        }
+            //    }
+            //}
+            //catch { }
+
+            KillAllTargetProcesses();
+        }
+
+        /// <summary>
+        /// 鏉�杩涚▼閫昏緫
+        /// </summary>
+        private void KillAllTargetProcesses()
+        {
+            try
+            {
+                // 1. 鑾峰彇褰撳墠杩涚▼ID锛岄伩鍏嶆潃姝昏嚜宸�
+                int currentProcessId = Process.GetCurrentProcess().Id;
+                // 2. 妯$硦鍖归厤杩涚▼鍚嶏紙蹇界暐澶у皬鍐欙級锛岃鐩杤shost/鍚庣紑绛夋儏鍐�
+                var targetProcesses = Process.GetProcesses()
+                    .Where(p =>
+                        p.ProcessName.IndexOf("LB_SmartVision", StringComparison.OrdinalIgnoreCase) >= 0
+                        && p.Id == currentProcessId);
+
+                foreach (var p in targetProcesses)
+                {
+                    try
+                    {
+                        if (!p.HasExited)
+                        {
+                            // 鍏堝皾璇曚紭闆呭叧闂璚inForm绋嬪簭锛堟瘮鐩存帴Kill鏇村弸濂斤級
+                            p.CloseMainWindow();
+                            // 绛夊緟500ms锛岀湅鏄惁姝e父閫�鍑�
+                            if (!p.WaitForExit(500))
+                            {
+                                p.Kill(); // 寮哄埗鏉�姝�
+                                p.WaitForExit(1000); // 绛夊緟杩涚▼瀹屽叏缁堟
+                            }
+                        }
+                        p.Dispose(); // 閲婃斁杩涚▼璧勬簮锛岄伩鍏嶅彞鏌勬硠婕�
+                    }
+                    catch (Exception ex)
+                    {
+                        // 璁板綍寮傚父浣嗕笉涓柇锛屾瘮濡傛潈闄愪笉瓒崇殑鎯呭喌
+                        System.IO.File.AppendAllText("kill_process_log.txt", $"[{DateTime.Now}] 鏉�姝昏繘绋嬪け璐�: {ex.Message}\r\n");
+                    }
+                }
+
+                // 棰濆寤惰繜锛岀‘淇濇枃浠跺彞鏌勫畬鍏ㄩ噴鏀�
+                Thread.Sleep(1000);
+            }
+            catch (Exception)
+            {
+                // 闈欓粯澶辫触锛屼笉褰卞搷绋嬪簭閫�鍑�
+            }
+        }
+
+        private void btn_Run_Click(object sender, EventArgs e)
+        {
+            var matchedItems = GlobalVar.dicProcessSetting
+                                        .Where(item =>
+                                        {
+                                            var value = item.Value;
+                                            var triggerComm = value["瑙﹀彂閫氳"];
+                                            var triggerChar = value["瑙﹀彂瀛楃"];
+                                            return triggerComm != null;
+                                            //return triggerComm != null && triggerComm.Equals(name) &&
+                                            //       (string.IsNullOrEmpty(triggerChar?.ToString()) ||
+                                            //        msg.StartsWith(triggerChar.ToString()));
+                                        })
+                                        .ToList(); // 閬垮厤閲嶅瀛楀吀璁块棶鍜岃绠辨搷浣�
+            if (matchedItems.Count <= 0)
+            {
+                return;
+            }
+            TriggerRunMessageReceived(matchedItems[0].Value["瑙﹀彂閫氳"], matchedItems[0].Value["瑙﹀彂瀛楃"]);
+        }
+
+        private void btn_RunContinuously_Click(object sender, EventArgs e)
+        {
+            if (btn_RunContinuously.Text.Equals("杩炵画杩愯"))
+            {
+                btn_RunContinuously.Text = "鏆傚仠杩愯";
+                Task.Factory.StartNew(() =>
+                {
+                    var matchedItems = GlobalVar.dicProcessSetting
+                                                .Where(item =>
+                                                {
+                                                    var value = item.Value;
+                                                    var triggerComm = value["瑙﹀彂閫氳"];
+                                                    var triggerChar = value["瑙﹀彂瀛楃"];
+                                                    return triggerComm != null;
+                                                    //return triggerComm != null && triggerComm.Equals(name) &&
+                                                    //       (string.IsNullOrEmpty(triggerChar?.ToString()) ||
+                                                    //        msg.StartsWith(triggerChar.ToString()));
+                                                })
+                                                .ToList(); // 閬垮厤閲嶅瀛楀吀璁块棶鍜岃绠辨搷浣�
+                    while (btn_RunContinuously.Text.Equals("鏆傚仠杩愯"))
+                    {
+
+                        TriggerRunMessageReceived(matchedItems[0].Value["瑙﹀彂閫氳"], matchedItems[0].Value["瑙﹀彂瀛楃"]);
+                        Thread.Sleep(500);
+                    }
+                    //this.Invoke(() =>
+                    //{
+                    //});
+                });
+            }
+            else if (btn_RunContinuously.Text.Equals("鏆傚仠杩愯"))
+            {
+                btn_RunContinuously.Text = "杩炵画杩愯";
+                Thread.Sleep(100);
+            }
+
         }
     }
 }
diff --git a/LB_VisionFlowNode/FlowPanel.cs b/LB_VisionFlowNode/FlowPanel.cs
index fd08c76..aa633bd 100644
--- a/LB_VisionFlowNode/FlowPanel.cs
+++ b/LB_VisionFlowNode/FlowPanel.cs
@@ -1,4 +1,5 @@
-锘縰sing System.Collections.Concurrent;
+锘縰sing LB_SmartVisionCommon;
+using System.Collections.Concurrent;
 using System.Diagnostics;
 using System.Xml.Linq;
 
@@ -305,6 +306,7 @@
             bool result = Context.ExecuteNode(currentNode);
 #if DEBUG
             Debug.WriteLine(DateTime.Now.ToString("[yyyy:MM:dd:HH:mm:ss:fff] ") + $"鎵ц鑺傜偣[{currentNode.Text}],缁撴灉涓簕result}");
+            AsyncLogHelper.Debug(DateTime.Now.ToString("[yyyy:MM:dd:HH:mm:ss:fff] ") + $"鎵ц鑺傜偣[{currentNode.Text}],缁撴灉涓簕result}");
 #endif
             context.BranchResults.TryAdd(context.CurrentBranchName, currentNode.Result);
             currentNode.Result = result;
diff --git a/LB_VisionProcesses/Alogrithms/Halcon/2D/HBlobTool/HBlobTool.cs b/LB_VisionProcesses/Alogrithms/Halcon/2D/HBlobTool/HBlobTool.cs
index 4999754..0717de1 100644
--- a/LB_VisionProcesses/Alogrithms/Halcon/2D/HBlobTool/HBlobTool.cs
+++ b/LB_VisionProcesses/Alogrithms/Halcon/2D/HBlobTool/HBlobTool.cs
@@ -85,10 +85,13 @@
                     {
                         using (HImage hImage = new HImage())
                         {
-                            Rectangle rect = new Rectangle(0, 0, ((Bitmap)InputImage).Width, ((Bitmap)InputImage).Height);
-                            BitmapData srcBmpData = ((Bitmap)InputImage).LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format32bppRgb);
-                            hImage.GenImageInterleaved(srcBmpData.Scan0, "rgbx", ((Bitmap)InputImage).Width, ((Bitmap)InputImage).Height, 0, "byte", ((Bitmap)InputImage).Width, ((Bitmap)InputImage).Height, 0, 0, -1, 0);
-                            ((Bitmap)InputImage).UnlockBits(srcBmpData);
+                            Bitmap bitmap = (Bitmap)InputImage;
+                            Rectangle rect = new Rectangle(0, 0, ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height);
+                            BitmapData srcBmpData = ((Bitmap)bitmap).LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format32bppRgb);
+                            hImage.GenImageInterleaved(srcBmpData.Scan0, "rgbx", ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height, 0, "byte", ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height, 0, 0, -1, 0);
+                            ((Bitmap)bitmap).UnlockBits(srcBmpData);
+                            bitmap.Dispose();
+                            bitmap = null;
                             InputImage = null;
                             InputImage = hImage.Clone();
                         }
diff --git a/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindCode2dTool/HFindCode2dTool.cs b/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindCode2dTool/HFindCode2dTool.cs
index fcf47ec..ed5938c 100644
--- a/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindCode2dTool/HFindCode2dTool.cs
+++ b/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindCode2dTool/HFindCode2dTool.cs
@@ -2,6 +2,7 @@
 using System;
 using System.Collections.Generic;
 using System.Drawing;
+using System.Drawing.Imaging;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -64,9 +65,30 @@
                         Result = false;
                         return;
                     }
+                    if (InputImage is Bitmap)
+                    {
+                        try
+                        {
+                            using (HImage hImage = new HImage())
+                            {
+                                Bitmap bitmap = (Bitmap)InputImage;
+                                Rectangle rect = new Rectangle(0, 0, ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height);
+                                BitmapData srcBmpData = ((Bitmap)bitmap).LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format32bppRgb);
+                                hImage.GenImageInterleaved(srcBmpData.Scan0, "rgbx", ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height, 0, "byte", ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height, 0, 0, -1, 0);
+                                ((Bitmap)bitmap).UnlockBits(srcBmpData);
+                                bitmap.Dispose();
+                                bitmap = null;
+                                InputImage = null;
+                                InputImage = hImage.Clone();
+                            }
+                        }
+                        catch (Exception ex)
+                        {
+                        }
+                    }
                     if (!(InputImage is HObject))
                     {
-                        Msg = "杈撳叆鍥剧墖鏍煎紡涓嶄负Mat";
+                        Msg = "杈撳叆鍥剧墖鏍煎紡涓嶄负HObject";
                         Result = false;
                         return;
                     }
diff --git a/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindLineTool/HFindLineTool.cs b/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindLineTool/HFindLineTool.cs
index 533a89c..2b7ce05 100644
--- a/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindLineTool/HFindLineTool.cs
+++ b/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindLineTool/HFindLineTool.cs
@@ -3,6 +3,7 @@
 using LB_VisionProcesses.Alogrithms.Halcon;
 using System;
 using System.Collections.Generic;
+using System.Drawing.Imaging;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -61,6 +62,33 @@
                     Result = false;
                     return;
                 }
+                if (InputImage is Bitmap)
+                {
+                    try
+                    {
+                        using (HImage hImage = new HImage())
+                        {
+                            Bitmap bitmap = (Bitmap)InputImage;
+                            Rectangle rect = new Rectangle(0, 0, ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height);
+                            BitmapData srcBmpData = ((Bitmap)bitmap).LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format32bppRgb);
+                            hImage.GenImageInterleaved(srcBmpData.Scan0, "rgbx", ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height, 0, "byte", ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height, 0, 0, -1, 0);
+                            ((Bitmap)bitmap).UnlockBits(srcBmpData);
+                            bitmap.Dispose();
+                            bitmap = null;
+                            InputImage = null;
+                            InputImage = hImage.Clone();
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                    }
+                }
+                if (!(InputImage is HObject))
+                {
+                    Msg = "杈撳叆鍥剧墖鏍煎紡涓嶄负HObject";
+                    Result = false;
+                    return;
+                }
 
                 #region 瑁佸壀鍖哄煙
                 if (!(Params.ROI is HSegment))
diff --git a/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindModelTool/HFindModelTool.cs b/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindModelTool/HFindModelTool.cs
index 4ca9695..b5bd930 100644
--- a/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindModelTool/HFindModelTool.cs
+++ b/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindModelTool/HFindModelTool.cs
@@ -5,6 +5,7 @@
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
+using System.Drawing.Imaging;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -93,6 +94,27 @@
                         Result = false;
                         return;
                     }
+                    if (InputImage is Bitmap)
+                    {
+                        try
+                        {
+                            using (HImage hImage = new HImage())
+                            {
+                                Bitmap bitmap = (Bitmap)InputImage;
+                                Rectangle rect = new Rectangle(0, 0, ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height);
+                                BitmapData srcBmpData = ((Bitmap)bitmap).LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format32bppRgb);
+                                hImage.GenImageInterleaved(srcBmpData.Scan0, "rgbx", ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height, 0, "byte", ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height, 0, 0, -1, 0);
+                                ((Bitmap)bitmap).UnlockBits(srcBmpData);
+                                bitmap.Dispose();
+                                bitmap = null;
+                                InputImage = null;
+                                InputImage = hImage.Clone();
+                            }
+                        }
+                        catch (Exception ex)
+                        {
+                        }
+                    }
                     if (!(InputImage is HObject))
                     {
                         Msg = "杈撳叆鍥剧墖鏍煎紡涓嶄负HObject";
diff --git a/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindMultiModelTool/HFindMultiModelTool.cs b/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindMultiModelTool/HFindMultiModelTool.cs
index ee6b699..2757ab0 100644
--- a/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindMultiModelTool/HFindMultiModelTool.cs
+++ b/LB_VisionProcesses/Alogrithms/Halcon/2D/HFindMultiModelTool/HFindMultiModelTool.cs
@@ -5,6 +5,7 @@
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
+using System.Drawing.Imaging;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -88,9 +89,30 @@
                         Result = false;
                         return;
                     }
+                    if (InputImage is Bitmap)
+                    {
+                        try
+                        {
+                            using (HImage hImage = new HImage())
+                            {
+                                Bitmap bitmap = (Bitmap)InputImage;
+                                Rectangle rect = new Rectangle(0, 0, ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height);
+                                BitmapData srcBmpData = ((Bitmap)bitmap).LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format32bppRgb);
+                                hImage.GenImageInterleaved(srcBmpData.Scan0, "rgbx", ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height, 0, "byte", ((Bitmap)bitmap).Width, ((Bitmap)bitmap).Height, 0, 0, -1, 0);
+                                ((Bitmap)bitmap).UnlockBits(srcBmpData);
+                                bitmap.Dispose();
+                                bitmap = null;
+                                InputImage = null;
+                                InputImage = hImage.Clone();
+                            }
+                        }
+                        catch (Exception ex)
+                        {
+                        }
+                    }
                     if (!(InputImage is HObject))
                     {
-                        Msg = "杈撳叆鍥剧墖鏍煎紡涓嶄负Mat";
+                        Msg = "杈撳叆鍥剧墖鏍煎紡涓嶄负HObject";
                         Result = false;
                         return;
                     }

--
Gitblit v1.9.3