Beispiel #1
0
        public void RemoveEicasMessage(EICASMessage iMsg)
        {
            Stack <EICASMessage> TempMsgs = new Stack <EICASMessage>();

            while (EICASMessages.Count > 0)
            {
                if (EICASMessages.Peek().MessageText == iMsg.MessageText && EICASMessages.Peek().Importance == iMsg.Importance)
                {
                    EICASMessages.Pop();
                    break;
                }
                else
                {
                    TempMsgs.Push(EICASMessages.Pop());
                }
            }
            //Push higher messages back into stack
            for (int i = 0; i < TempMsgs.Count; i++)
            {
                EICASMessages.Push(TempMsgs.Pop());
            }
        }
Beispiel #2
0
        public void AddEicasMessage(EICASMessage iMsg)
        {
            Stack <EICASMessage> TempMsgs = new Stack <EICASMessage>();

            //Check for higher priority message
            for (int i = 0; i < EICASMessages.Count; i++)
            {
                if (EICASMessages.Peek().Importance > iMsg.Importance)
                {
                    TempMsgs.Push(EICASMessages.Pop());
                }
                else
                {
                    break;
                }
            }
            //Push into position (top of the messages with the same priority)
            EICASMessages.Push(iMsg);
            //Push Higher Priority back on top
            for (int i = 0; i < TempMsgs.Count; i++)
            {
                EICASMessages.Push(TempMsgs.Pop());
            }
        }