예제 #1
0
        public void AppendAlarmLogMsg(string msg)
        {
            try
            {
                int th     = Vehicle.MainFlowConfig.StringBuilderMax;
                int thHalf = th / 2;

                lock (SbAlarmMsg)
                {
                    if (SbAlarmMsg.Length + msg.Length > th)
                    {
                        SbAlarmMsg.Remove(0, thHalf);
                    }
                    SbAlarmMsg.AppendLine($"{DateTime.Now:HH:mm:ss} {msg}");
                }
            }
            catch (Exception ex)
            {
                LogException(GetType().Name + ":" + MethodBase.GetCurrentMethod().Name, ex.Message);
            }
        }
예제 #2
0
        public void ResetAllAlarms()
        {
            try
            {
                lock (dicHappeningAlarms)
                {
                    dicHappeningAlarms = new ConcurrentDictionary <int, Alarm>();
                    LastAlarmMsg       = "";
                }

                string resetMessage = "Reset All Alarms.";
                LogAlarmHistory(resetMessage);
                AppendAlarmHistoryLogMsg(resetMessage);
                SbAlarmMsg.Clear();
                //AlarmLogMsg = string.Concat(DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss.fff"), "\t", resetMessage);
            }
            catch (Exception ex)
            {
                LogException(GetType().Name + ":" + MethodBase.GetCurrentMethod().Name, ex.Message);
            }
        }