Exemplo n.º 1
0
        public void SelectConversation(ChatContact contact)
        {
            ChatConversation conversation;

            if (!ConversationsMap.TryGetValue(contact.ID, out conversation))
            {
                conversation = new ChatConversation(contact);
                ConversationsMap.Add(contact.ID, conversation);
            }
            SelectConversation(conversation);
        }
Exemplo n.º 2
0
        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);
        }