internal void OnChatMessageReceived(ChatMessage message)
 {
     var call = ChatMessageReceived;
     if (call != null)
         call(message);
 }
        private void OnPrivateMessageSent(IMessage message)
        {
            var received = message.Json.GetFirstArgAs<PrivateMessageSent>();
            var toUser = _userData.GetPgUser(received.toUser);

            ChatSessionBase chatSession = GetOrCreatePrivateChatSession(toUser);
            var cm = new ChatMessage(_userData.User, received.message);
            chatSession.OnChatMessageReceived(cm);
        }
        private void OnChatroomMessageNew(IMessage message)
        {
            var received = message.Json.GetFirstArgAs<ChatroomMessageNew>();
            var id = received._id;
            ChatroomSessionBase session;
            if (!_chatroomUsage.TryGetValue(id, out session))
                return;
            if (session.State != ChatroomState.Connected)
                return;

            var chatMessage = new ChatMessage(_userData.GetPgUser(received.fromUser), received.message);
            session.OnChatMessageReceived(chatMessage);
        }
 void ChatMessages_CollectionChanged(ChatMessage item)
 {
     AppendUserMessage(item.Author.Username, item.Message);
 }
        void ChatMessages_CollectionChanged(ChatMessage item)
        {
            bool allFromSelf = true;

            AppendUserMessage(item.Author.Username, item.Message);
            if (item.Author != _userData.User)
                allFromSelf = false;

            if (!allFromSelf)
                this.FlashWindowSmartly();
        }
 private void ChatMessages_CollectionChanged(ChatMessage item)
 {
     AddChatMessage(item.Author.Username, item.Message);
 }