private void SetMessageContents(ChatMessageContentsModel chatMessageContents) { foreach (ChatMessageDataModel message in chatMessageContents.message) { this.MessageComponents.Add(message); switch (message.type) { case "emoticon": // Special code here to process emoticons ChannelSession.EnsureEmoticonForMessage(message); this.Message += message.text; break; case "link": this.ContainsLink = true; this.Message += message.text; break; case "image": this.Images[message.text] = message.url; break; case "text": case "tag": default: this.Message += message.text; break; } } this.Message = this.Message.Trim().Replace(Environment.NewLine, string.Empty).Replace("\n", string.Empty); }
public static ChatMessageViewModel CreateChatMessageViewModel(ChatMessageEventModel chatMessageEvent, UserViewModel user = null) { ChatMessageViewModel newChatMessageViewModel = new ChatMessageViewModel(chatMessageEvent, user); foreach (ChatMessageDataModel message in newChatMessageViewModel.ChatMessageEvent.message.message) { newChatMessageViewModel.MessageComponents.Add(message); switch (message.type) { case "emoticon": // Special code here to process emoticons ChannelSession.EnsureEmoticonForMessage(message); newChatMessageViewModel.Message += message.text; break; case "link": newChatMessageViewModel.ContainsLink = true; newChatMessageViewModel.Message += message.text; break; case "image": newChatMessageViewModel.Images[message.text] = message.url; newChatMessageViewModel.Message += string.Format(" *{0}* ", message.text); break; case "text": case "tag": default: newChatMessageViewModel.Message += message.text; break; } } if (newChatMessageViewModel.ChatMessageEvent.message.ContainsSkill) { newChatMessageViewModel.ChatSkill = newChatMessageViewModel.ChatMessageEvent.message.Skill; } return(newChatMessageViewModel); }