From eb503eb0b578fb7e4219cb7e913d7c268b641d31 Mon Sep 17 00:00:00 2001
From: C3204 <zhengyabo@lanpucloud.cn>
Date: 星期三, 31 十二月 2025 13:29:33 +0800
Subject: [PATCH] 优化相机运动控制界面设计显示
---
LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.cs | 52 +++++++++++++++++++++-------------------------------
1 files changed, 21 insertions(+), 31 deletions(-)
diff --git a/LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.cs b/LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.cs
index a3e21fd..1642a11 100644
--- a/LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.cs
+++ b/LB_SmartVision/Forms/Pages/ProcessPage/ProcessControl.cs
@@ -43,6 +43,11 @@
if (ProcessRunBll != null)
this.label1.Text = $"鎬绘暟锛歿ProcessRunBll.total}";
+ this.isClosed = false ;
+ var TaskPhotoContinue = Task.Factory.StartNew(() =>
+ {
+ ThreadCircleRun();
+ });
}
public void SetTitle(string title)
@@ -72,9 +77,7 @@
}));
}
else
- {
UserHSmartWindowControl.ClearObj();
- }
}
/// <summary>
@@ -93,9 +96,7 @@
}));
}
else
- {
this.label1.Text = $"鎬绘暟锛歿ProcessRunBll.total}";
- }
}
public bool Run(out string msg)
@@ -107,9 +108,7 @@
}
if (isCircleRuning || ProcessRunBll.bRuning)
- {
ProcessRunBll.LogInfo($"{ProcessRunBll.Name}姝e湪杩愯", LogInfoType.ERROR);
- }
ProcessRunBll.Run();
@@ -126,9 +125,7 @@
try
{
if (ProcessRunBll == null)
- {
return;
- }
ProcessRunBll.LogInfo(string.Format("娴佺▼[{0}]寮�濮嬭繍琛�", this.ProcessRunBll.Name), LogInfoType.INFO);
@@ -136,9 +133,7 @@
result = Run(out msg);
if (ProcessRunBll.GetImage(_Layout, out _, out HObject RecordImage))
- {
ShowHoImage(RecordImage);
- }
}
catch { msg = "杩愯鍑虹幇浜嗗紓甯�"; }
@@ -159,37 +154,36 @@
if (isCircleRuning)
{
- threadCircleRun = new Thread(ThreadCircleRun);
- threadCircleRun.IsBackground = true;
- threadCircleRun.Start();
+ this.mAutoResetEvent.Set();
}
else
{
isCircleRuning = false;
- //threadCircleRun.Abort();
}
+ if (!isCircleRuning)
+ {
+ ProcessRunBll.LogInfo($"{ProcessRunBll.Name}鍏抽棴杩炵画杩愯", LogInfoType.PASS);
+ return;
+ }
+
+ ProcessRunBll.LogInfo($"{ProcessRunBll.Name}寮�鍚繛缁繍琛�", LogInfoType.WARN);
}
catch { }
}
-
- Thread threadCircleRun = null;
+ private AutoResetEvent mAutoResetEvent = new AutoResetEvent(false);
+ bool isClosed = false;
void ThreadCircleRun()
{
- if (!isCircleRuning)
+ while (!isClosed)
{
- ProcessRunBll.LogInfo($"{ProcessRunBll.Name}鍏抽棴杩炵画杩愯", LogInfoType.PASS);
- return;
- }
-
- ProcessRunBll.LogInfo($"{ProcessRunBll.Name}寮�鍚繛缁繍琛�", LogInfoType.WARN);
-
- while (isCircleRuning)
- {
- //this.BeginInvoke(new Action(() =>
- //{
try
{
+ if (isCircleRuning == false)
+ {
+ this.mAutoResetEvent.WaitOne();
+ }
+
ProcessRunBll.LogInfo($"{ProcessRunBll.Name}寮�濮嬭繍琛�", LogInfoType.WARN);
ClearObj();
bool result = ProcessRunBll.Run();
@@ -199,13 +193,9 @@
, result ? LogInfoType.PASS : LogInfoType.ERROR);
if (ProcessRunBll.GetImage(_Layout, out _, out HObject RecordImage))
- {
ShowHoImage(RecordImage);
- }
}
catch { }
- //}));
-
Thread.Sleep(33);
}
}
--
Gitblit v1.9.3