private void ProcessMessage(object sender, MessageReceivedEventArgs e) { if (InvokeRequired) { Invoke(new Action <object, MessageReceivedEventArgs>(ProcessMessage), sender, e); return; } var messageType = (MessageType)Convert.ToInt32(e.Message.First().ToString()); _logger.Log(LogType.Debug, $"Converted type: {messageType}. integer value: {Convert.ToInt32(e.Message.First().ToString())}"); switch (messageType) { case MessageType.Message: MessageLogTextBox.AppendText(Environment.NewLine + Helper.FormatMessage(e)); break; case MessageType.Command: Helper.ExecuteCommand(e, _logger); break; default: _logger.Log(LogType.Error, $"Could not determine message type: {e.Message}"); break; } }
private void AppendLog(object sender, LogEventArgs e) { if (InvokeRequired) { Invoke(new Action <object, LogEventArgs>(AppendLog), sender, e); return; } MessageLogTextBox.AppendText(Environment.NewLine + Helper.FormatLogEntry(e)); }