Пример #1
0
 public void AddMessage(Message msg)
 {
     foreach (IMessageListener handler in listeners)
     {
         handler.HandleMessage(msg);
     }
 }
Пример #2
0
 /// <summary>
 /// Append message to message buffer.  Overwrites old messages if buffer is full.
 /// </summary>
 /// <param name="message">Message to add to log</param>
 void IMessageListener.HandleMessage(Message message)
 {
     buffer.Enqueue(String.Format("{0}: {1}", DateTime.Now.TimeOfDay, message.Text));
     if (buffer.Count > bufferSize)
     {
         buffer.Dequeue();
     }
 }