C3204
2025-12-29 fec341de45f4b3fd1825807f0b3261143fa13caa
LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.cs
@@ -1,7 +1,8 @@
using HalconDotNet;
using LB_SmartVision.Forms.Pages.SettingPage;
using LB_SmartVision.ProcessRun;
using LB_VisionControl;
using Layout = LB_SmartVision.Forms.Pages.SettingPage.Layout;
namespace LB_SmartVision.Forms.Pages.ProcessPage
{
@@ -71,17 +72,19 @@
                }));
            }
            else
            {
                UserHSmartWindowControl.ClearObj();
            }
        }
        /// <summary>
        /// 异步显示图片
        /// </summary>
        /// <param name="ho_image"></param>
        public void ShowHoImage(HObject ho_image)
        public void ShowHoImage(HImage ho_image)
        {
            string str = this.lblTitle.Text;
            UserHSmartWindowControl.hImage = ho_image;
            if (this.InvokeRequired)
            {
                this.BeginInvoke(new Action(() =>
@@ -90,7 +93,9 @@
                }));
            }
            else
            {
                this.label1.Text = $"总数:{ProcessRunBll.total}";
            }
        }
        public bool Run(out string msg)
@@ -101,8 +106,10 @@
                return false;
            }
            if (isCircleRuning || ProcessRunBll.bPruning)
            if (isCircleRuning || ProcessRunBll.bRuning)
            {
                ProcessRunBll.LogInfo($"{ProcessRunBll.Name}正在运行", LogInfoType.ERROR);
            }
            ProcessRunBll.Run();
@@ -119,15 +126,19 @@
                try
                {
                    if (ProcessRunBll == null)
                    {
                        return;
                    }
                    ProcessRunBll.LogInfo(string.Format("流程[{0}]开始运行", this.ProcessRunBll.Name), LogInfoType.INFO);
                    ClearObj();
                    result = Run(out msg);
                    if (ProcessRunBll.GetImage(_Layout, out _, out HObject RecordImage))
                    if (ProcessRunBll.GetImage(_Layout, out _, out HImage RecordImage))
                    {
                        ShowHoImage(RecordImage);
                    }
                }
                catch { msg = "运行出现了异常"; }
@@ -155,7 +166,7 @@
                else
                {
                    isCircleRuning = false;
                    threadCircleRun.Abort();
                    //threadCircleRun.Abort();
                }
            }
            catch { }
@@ -187,13 +198,15 @@
                    ProcessRunBll.LogInfo($"{ProcessRunBll.Name}运行结束,结果为:{msg}"
                        , result ? LogInfoType.PASS : LogInfoType.ERROR);
                    if (ProcessRunBll.GetImage(_Layout, out _, out HObject RecordImage))
                    if (ProcessRunBll.GetImage(_Layout, out _, out HImage RecordImage))
                    {
                        ShowHoImage(RecordImage);
                    }
                }
                catch { }
                //}));
                Thread.Sleep(100);
                Thread.Sleep(33);
            }
        }