Esempio n. 1
0
        void UpdateStatistics(MessageLogEntry messageLogEntry)
        {
            MessageStatistics count;
            var isExisting = Statistics.TryGetValue(messageLogEntry.MessageType, out count);

            if (!isExisting)
            {
                count = new MessageStatistics();
            }

            if (messageLogEntry.LogEntryType == LogEntryType.Send)
            {
                count.MessageCount++;
            }
            else if (messageLogEntry.LogEntryType == LogEntryType.AddListener)
            {
                count.HandlerCount++;
            }
            else if (messageLogEntry.LogEntryType == LogEntryType.RemoveListener)
            {
                count.HandlerCount--;
            }

            if (isExisting)
            {
                Statistics[messageLogEntry.MessageType] = count;
            }
            else
            {
                Statistics.Add(messageLogEntry.MessageType, count);
            }
        }
Esempio n. 2
0
 public void AddLogEntry(MessageLogEntry messageLogEntry)
 {
     LogEntries.Add(messageLogEntry);
     UpdateStatistics(messageLogEntry);
     if (LogEntryAdded != null)
     {
         LogEntryAdded();
     }
 }