//属于命令SendMessageCommand private void SendMessage(object obj) { selectedChat.ChatLogs.Add(new ChatLog(DateTime.Now, dataService.UserName, textEntered)); if (selectedChat is PrivateChat) { string receiver = (selectedChat as PrivateChat).RemoteUser.UserName; Message msg = new Message(MessageType.PRIV, dataService.UserName, receiver, textEntered); dataService.SendChatMessage(msg); } else { string groupNumber = (selectedChat as GroupChat).ChatNumber.ToString(); Message msg = new Message(MessageType.GROUP, dataService.UserName, groupNumber, textEntered); dataService.SendChatMessage(msg); } TextEntered = string.Empty; }