public void HandleMessage(MessageContent message) { if (message.DisplayType == MessageDisplayType.Debug) return; if (InvokeRequired) { Invoke((Action) (() => AddText(message.Message))); } else { AddText(message.Message); } }
public void HandleMessage(MessageContent message) { lock (_rolloverLock) { if (new FileInfo(_fileName).Length >= _maximumFileSize) { CreateLogFile(); } } var sb = new StringBuilder(); sb.AppendFormat("{0} - {1} - {2} - {3} - {4}", message.DateTime.ToString(_dateTimeFormat), message.MessageSeverity, message.Source == "" ? "(null)" : message.Source, message.Message, message.Caption); if (message.Exception != null) { sb.AppendLine().Append(message.Exception.ToString()); } Trace.WriteLine(sb.ToString()); }
private static void HandleMessage(MessageContent message) { Form messageBoxParent = GetMessageBoxParent(); if (messageBoxParent != null && (message.DisplayType & MessageDisplayType.MessageBox) != 0) { ShowMessageBox(messageBoxParent, message); message.MessageBoxShown(); } if (_messageConsumersCount > 0) { lock (_messageConsuersLock) { foreach (IMessageConsumer consumer in _messageConsumers) { consumer.HandleMessage(message); } } } }
private static string Caption(MessageContent message) { return(string.IsNullOrWhiteSpace(message.Caption) ? _caption : message.Caption); }