public void AddMessage(Message message, User initiator)
 {
     ChatSessionViewModel chatSession;
     if (!_chatSessions.TryGetValue(message.From.Name, out chatSession))
     {
         chatSession = StartNewSession(message.From, initiator);
         chatSession.OpenChat();
     }
     chatSession.MessageReceived(message);
 }
 public void MessageReceived(Message message)
 {
     message.DateReceived = DateTime.Now;
     Conversation.Add(message);
 }
Example #3
0
 private void OnMessage(Message message)
 {
     // Starts a new conversation with message.From if not started,
     // otherwise, it will add a message to the conversation window with message.From.
     _chatSessions.AddMessage(message, Me.User);
 }
 public void Send()
 {
     SendMessage(this, new ChatSessionEventArgs(this.Contact, this.Message));
     var message = new Message { From = Initiator, Value = Message, IsMine = true, DateReceived = DateTime.Now };
     Conversation.Add(message);
     Message = String.Empty;
 }