Exemplo n.º 1
0
        /// <summary>
        /// Creates a conversation for a contact.
        /// </summary>
        /// <param name="contact">The contact.</param>
        /// <param name="message">The message.</param>
        public void CreateConversation(UserViewModel contact, Message message)
        {
            var conversation = new Conversation(contact);

            conversation.Messages.Add(message);
            AllConversations.Add(conversation);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Selects the conversation using the list of contact if it was not instanciated yet.
        /// Modification of the selected conversation must use this fonction
        /// </summary>
        /// <param name="contact">The contact to chat with.</param>
        public void SelectConversation(UserViewModel contact)
        {
            if (contact != null)
            {
                var conversation = FindByJid(contact.Jid);

                if (conversation != null)
                {
                    SelectedConversation = conversation;
                }

                else
                {
                    conversation = new Conversation(contact);
                    AllConversations.Add(conversation);
                    SelectedConversation = conversation;
                }
            }
        }
Exemplo n.º 3
0
 private Conversation FindByJid(Jid jid)
 {
     return(AllConversations.Where(
                t => t.CurrentContact.Jid.Node.Equals(jid.Node)).FirstOrDefault());
 }