/// <summary> /// 添加日志记录2 /// </summary> /// <param name="logType">类型</param> /// <param name="controlText">操作类别</param> /// <param name="Message">结果</param> public static void AddMsg2(LogType logType, EnumStepType fileName, string controlText, string Message, bool bErrorStop = false) { try { lock (mutx) { LogData msg = new LogData(logType, fileName, controlText, Message, bErrorStop); if (!isRun) { return; } //作业指令入列 lock (queue) { queue.Enqueue(msg); } //if (OnMsgAdd != null) OnMsgAdd(msg); UcLogList2.Instance.AddItemToListBox(msg.ToString()); } } catch (Exception ex) { throw new Exception("日志窗体出错,原因:" + ex.Message); } }
public LogData(LogType _logType, EnumStepType _fileName, string _controlText, string _message, bool bErrorStop = false) { timeNow = System.DateTime.Now.ToString("HH:mm:ss");//yyyy-MM-dd logType = _logType; controlText = _controlText; message = _message; stepType = _fileName; ErrorStopAutoRun = bErrorStop; }
public static void Add_ProgramInf(EnumStepType stepType, string Message) { AddMsg(LogType.Normal, stepType, "", Message); }