protected virtual void OnMessageEvent(CaoMessage msg) { var handler = MessageEvent; if (handler != null) { handler(msg); } }
private void ShowMessage(CaoMessage message) { string errorInfo = message.DateTime.ToString(); errorInfo += " Number:" + message.Number.ToString(); errorInfo += " Value:" + message.Value.ToString(); errorInfo += " Destination:" + message.Destination.ToString(); errorInfo += " Decription:" + message.Description.ToString(); errorInfo += " Description2:" + CurrentErrorDescription.Value.ToString(); // Use the Invoke command to update the user interface since this function is not called from the User Interface (UI) thread this.Invoke((MethodInvoker) delegate { label_ErrorInfo.Text = errorInfo; }); }