internal void AddNewMessage(Event e) { if (messagesIds.ContainsKey(e.event_id)) { return; } messagesIds.Add(e.event_id, e.timestamp); if (_lastMessage.SenderId == e.sender_id.chat_id) { _lastMessage.AddContent(e); } else { _lastMessage = new Message(e); _synchronizationContext.Post((obj) => { MessagesHistory.Add(obj as Message); }, _lastMessage); } OnPropertyChanged("MessagesHistory"); OnPropertyChanged("LastMessage"); if (NewMessageReceived != null) { NewMessageReceived(this, _lastMessage); } }
internal void NewEventReceived(Client client, Event e) { if (_lastMessage.SenderId == e.sender_id.chat_id) { _lastMessage.AppendContent(e.chat_message); } else { _lastMessage = new Message(e); MessagesHistory.Add(_lastMessage); } if (NewMessageReceived != null) { NewMessageReceived(this, _lastMessage); } LastMessage = e.chat_message.message_content.segment.Last().text; }
internal void HandleNewMessage(Event e) { if (_lastMessage.SenderId == e.sender_id.chat_id) { _lastMessage.AppendContent(e); } else { _lastMessage = new Message(e); _synchronizationContext.Post((obj) => { MessagesHistory.Add(obj as Message); }, _lastMessage); } OnPropertyChanged("MessagesHistory"); OnPropertyChanged("LastMessage"); if (NewMessageReceived != null) { NewMessageReceived(this, _lastMessage); } }