using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace LB_VisionProcesses.Processes { [Process("延时工具", Category = "其他工具", Description = "创建延时工具")] public class DelayTime : BaseProcess { public DelayTime() { strProcessClass = "LB_VisionProcesses.Processes.DelayTime"; strProcessName = "延时工具"; Params.Inputs.Add("延时时间", 1000.0); } public override bool Run() { try { InitRunParams(); int DelayMilliseconds = 0; if (!int.TryParse(this.Params.Inputs["延时时间"].ToString(), out DelayMilliseconds)) { Msg = string.Format("延时时间未设置"); return false; } Thread.Sleep(DelayMilliseconds); return true; } catch { Msg = string.Format("运行出现异常"); return false; } } } }