public ReceivedMessageForm(TextMessageData textMessageData, UserInfo userInfo) { if (textMessageData == null) { throw new ArgumentNullException("textMessageData", "Something is wrong. TextMessageData should not be null."); } ReceivedTextMessageData = textMessageData; if (userInfo == null) { throw new Exception("Text message received from unknown user"); } ReceivedUserInfo = userInfo; InitializeComponent(); StringBuilder stringBuilder = new StringBuilder("Received message from "); stringBuilder.Append(ReceivedUserInfo.UserName); if (userInfo.LogOnName != ReceivedUserInfo.UserName) { stringBuilder.AppendFormat(" [{0}]", ReceivedUserInfo.LogOnName); } stringBuilder.AppendFormat(" ({0})", ReceivedUserInfo.MachineName); stringBuilder.AppendFormat("{0}at {1}", Environment.NewLine, ReceivedTextMessageData.ReceiptTime); MessegeInfoLabel.Text = stringBuilder.ToString(); MessegeTextBox.Text = ReceivedTextMessageData.Text; }
private void ProcessTextMessage(TextMessageData textMessageData) { lock (TextMessageObservers) { if (TextMessageObservers == null || TextMessageObservers.Count <= 0) { return; } foreach (IObserver observer in TextMessageObservers) { observer.Notify(textMessageData); } } }
private void ProcessTextMessage(TextMessageData textMessageData) { lock (TextMessageObservers) { if (TextMessageObservers == null || TextMessageObservers.Count <= 0) { return; } foreach (IObserver observer in TextMessageObservers) { observer.Notify(textMessageData); } } }