private string EscapedMessage(AVIMMessage message) { if (message is AVIMTextMessage) { return(((AVIMTextMessage)message).TextContent); } return(message.MessageBody); }
public DemoMessage(AVIMMessage avMessage) { var user = App.ViewModel.AllContacts.Where(t => t.UserId == avMessage.FromClientId).FirstOrDefault(); this.From = user.Nickname; TextContent = avMessage.MessageBody; this.avMessage = avMessage; }
private void AVConversation_OnMessageRecieved(object sender, AVIMMessage e) { DispatcherHelper.CheckBeginInvokeOnUI(() => { messages.Add(new DemoMessage(e) { DisplayTime = DateTime.Now }); }); }
private void CacheMessage(AVIMConversation conversation, AVIMMessage message) { if (historyDictionary == null) { historyDictionary = new Dictionary <string, BindingList <string> >(); } var record = message.FromClientId + ": " + EscapedMessage(message); if (historyDictionary.ContainsKey(conversation.ConversationId)) { historyDictionary[conversation.ConversationId].Add(record); } else { var history = new BindingList <string>(); history.Add(record); historyDictionary.Add(conversation.ConversationId, history); } RefreshUI(() => { Log("收到 " + message.FromClientId + " 发送的消息;"); }); }
public NikkiMessage(AVIMMessage message) { NikkiType = 1; NikkiContent = "hahaha"; }
public void Broadcast(AVIMMessage message) { _client.SendMessageAsync(_lobbyConversation, message); }