Beispiel #1
0
        public static void AddEvent(ChatMessage chatRoomMessage)
        {
            lock (dChatRooms)
            {
                if (!dChatRooms.ContainsKey(chatRoomMessage.ChatRoomId.Value))
                {
                    dChatRooms.Add(chatRoomMessage.ChatRoomId.Value, new List<ChatMessage>());
                }
            }

            List<ChatMessage> lMessages = dChatRooms[chatRoomMessage.ChatRoomId.Value];
            lock (lMessages)
            {
                lMessages.Add(chatRoomMessage);
            }
        }
Beispiel #2
0
 public static ChatMessage Create(string senderDisplayName, string text)
 {
     ChatMessage message = new ChatMessage();
     message.messageTime = DateTime.Now;
     message.senderDisplayName = senderDisplayName;
     message.text = text;
     message.textHtml = ParseMessageText(text);
     return message;
 }