Ejemplo n.º 1
0
        public bool HandleMessage(string id, string nickname, string message)
        {
            Node peer = model.Network.Nodes.Where(p => p.ID == id).FirstOrDefault();

            if (null != peer)
            {
                Conversation conv = conversations.Where(c => c.OtherParty == peer).FirstOrDefault();
                if (null == conv)
                {
                    conv = new Conversation();
                    conv.OtherParty = peer;
                    conv.Messages.Add(peer.Nickname + ": " + message);
                    conversations.Add(conv);
                }
                else
                {
                    conv.Messages.Add(peer.Nickname + ": " + message);
                }
                return true;
            }
            return false;
        }
Ejemplo n.º 2
0
 public void CreateConversation(Node n)
 {
     ConversationViewModel search = viewModels.Where(c => c.Conversation.OtherParty == n).FirstOrDefault();
     if (null == search)
     {
         //New conversation
         var c = new Conversation();
         c.OtherParty = n;
         conversations.Add(c);
     }
     else
     {
         //Converstation already open for this person so just switch to it
         windowController.SwitchToTab(search);
     }
 }