| | |
| | | { |
| | | UserHSmartWindowControl UserHSmartWindowControl = new UserHSmartWindowControl(); |
| | | |
| | | public string Title = string.Empty; |
| | | |
| | | public event Control_MouseDown event_MouseDown; |
| | | public event Control_MouseDoubleClick event_MouseDoubleClick; |
| | | private void event_mouseDown(object sender, MouseEventArgs e) |
| | | { |
| | | if (event_MouseDown != null) |
| | | { |
| | | event_MouseDown(sender, e); |
| | | } |
| | | } |
| | | private void event_mouseDoubleClick(object sender, MouseEventArgs e) |
| | | { |
| | | if (event_MouseDoubleClick != null) |
| | | { |
| | | event_MouseDoubleClick(this, e); |
| | | } |
| | | } |
| | | |
| | | ProcessRunBll ProcessRunBll |
| | | { |
| | | get |
| | |
| | | { |
| | | this.panel1.Controls.Add(this.UserHSmartWindowControl); |
| | | this.UserHSmartWindowControl.Dock = DockStyle.Fill; |
| | | |
| | | this.UserHSmartWindowControl.event_MouseDoubleClick += event_mouseDoubleClick; |
| | | this.UserHSmartWindowControl.event_MouseDown += event_mouseDown; |
| | | SetTitle(_Layout.ProcessName); |
| | | |
| | | Title = _Layout.Title; |
| | | if (ProcessRunBll != null) |
| | | this.label1.Text = $"总数:{ProcessRunBll.total}"; |
| | | this.isClosed = false; |
| | | var TaskPhotoContinue = Task.Factory.StartNew(() => |
| | | { |
| | | ThreadCircleRun(); |
| | | }); |
| | | } |
| | | |
| | | public void SetTitle(string title) |
| | |
| | | })); |
| | | } |
| | | else |
| | | { |
| | | UserHSmartWindowControl.ClearObj(); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | })); |
| | | } |
| | | else |
| | | { |
| | | this.label1.Text = $"总数:{ProcessRunBll.total}"; |
| | | } |
| | | } |
| | | |
| | | public bool Run(out string msg) |
| | |
| | | } |
| | | |
| | | if (isCircleRuning || ProcessRunBll.bRuning) |
| | | { |
| | | ProcessRunBll.LogInfo($"{ProcessRunBll.Name}正在运行", LogInfoType.ERROR); |
| | | } |
| | | |
| | | ProcessRunBll.Run(); |
| | | |
| | |
| | | try |
| | | { |
| | | if (ProcessRunBll == null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | ProcessRunBll.LogInfo(string.Format("流程[{0}]开始运行", this.ProcessRunBll.Name), LogInfoType.INFO); |
| | | |
| | |
| | | result = Run(out msg); |
| | | |
| | | if (ProcessRunBll.GetImage(_Layout, out _, out HObject RecordImage)) |
| | | { |
| | | ShowHoImage(RecordImage); |
| | | } |
| | | } |
| | | catch { msg = "运行出现了异常"; } |
| | | |
| | |
| | | |
| | | 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(); |
| | |
| | | , result ? LogInfoType.PASS : LogInfoType.ERROR); |
| | | |
| | | if (ProcessRunBll.GetImage(_Layout, out _, out HObject RecordImage)) |
| | | { |
| | | ShowHoImage(RecordImage); |
| | | } |
| | | } |
| | | catch { } |
| | | //})); |
| | | |
| | | Thread.Sleep(33); |
| | | } |
| | | } |