public void CreateContact(ChatContact contact) { Debug.WriteLine($"AddContact({contact.ID}, {contact.Name}"); ContactsMap.Add(contact.ID, contact); DatabaseController.Insert(contact); SortContacts(); }
public void AddMessage(ChatMessage msg) { var other = (Me == msg.RecipientID ? msg.SenderID : msg.RecipientID); ChatConversation conversation; if (!ConversationsMap.TryGetValue(other, out conversation)) { ChatContact contact; if (!ContactsMap.TryGetValue(other, out contact)) { contact = new ChatContact(other, "no name"); ContactsMap.Add(other, contact); } conversation = new ChatConversation(contact); ConversationsMap.Add(other, conversation); } conversation.Messages.Add(msg); }