Beispiel #1
0
        public List <SAlarmMsg> ListAlarmMsg3 = new List <SAlarmMsg>(); //三级报警,保存

        // 可以供继承自 Heater 的类重写,以便继承类拒绝其他对象对它的监视
        protected virtual void OnBoiled(SAlarmMsg e)
        {
            if (Boiled != null)
            {                    // 如果有对象注册
                Boiled(this, e); // 调用所有注册对象的方法
            }
        }
Beispiel #2
0
        public void AddMsg(string StaName, string Recorder, EAlarmType eAlarmType, EAlarmPriority priority)
        {
            SAlarmMsg newMsg = new SAlarmMsg();

            newMsg.StaName    = StaName;
            newMsg.Recorder   = Recorder;
            newMsg.priority   = priority;
            newMsg.eAlarmType = eAlarmType;
            ListAlarmMsg.Add(newMsg);
            bUpdate = true;
            switch (priority)
            {
            case EAlarmPriority.PRIORITY_1:
                ListAlarmMsg1.Add(newMsg);
                while (ListAlarmMsg1.Count > CCONST.ListMax)
                {
                    ListAlarmMsg1.RemoveAt(0);
                }
                OnBoiled(newMsg);
                break;

            case EAlarmPriority.PRIORITY_2:
                ListAlarmMsg2.Add(newMsg);
                while (ListAlarmMsg2.Count > CCONST.ListMax)
                {
                    ListAlarmMsg2.RemoveAt(0);
                }
                OnBoiled(newMsg);
                break;

            case EAlarmPriority.PRIORITY_3:
                ListAlarmMsg3.Add(newMsg);
                while (ListAlarmMsg3.Count > CCONST.ListMax)
                {
                    ListAlarmMsg3.RemoveAt(0);
                }
                break;
            }
        }