public void WriteMessage(ChatMessageEventArgs e) { StringBuilder sb = new StringBuilder(); sb.Append("(").Append(DateTime.Now.ToString(patronFecha)).Append(") "); sb.Append(e.ClientFrom).Append(": "); sb.Append(e.Message).Append("\r\n"); txtBoxChat.AppendText(sb.ToString()); }
void EventChatMessageReceived(object sender, ChatMessageEventArgs e) { this.BeginInvoke((Action)(delegate { if (this.chatWindows.ContainsKey(e.ClientFrom)) { //ya estaba chateando con ese cliente chatWindows[e.ClientFrom].WriteMessage(e); } else { //una nueva ventana de chat VentanaDeChat vt = CreateChatWindow(e.ClientFrom); vt.WriteMessage(e); vt.Show(); } })); }