public void ReceiveMessage(Message message) { if (_recentIsSelf == true || _recentIsSelf == null) { _recentIsSelf = false; message.IsDisplayUser = true; } else { message.IsDisplayUser = false; } message.ReceivedTimeType = (ReceivedTimeType)_timeType; _messagesAppended.Add(message); MessageView.Document.Blocks.AddRange(message); MessageView.ScrollToEnd(); }
private void Submit_Click(object sender, RoutedEventArgs e) { if (MessageInput.Document.Blocks.Count > 0 && ((Paragraph)MessageInput.Document.Blocks.FirstBlock).Inlines.Count > 0) { _messageSended.Add(XamlWriter.Save(MessageInput.Document)); _messageSendedIndex = 0; string content = XamlWriter.Save(MessageInput.Document); int chatID = 0; this.Get <UserServiceClient>().SaveConversation(this.Get <Client>().ID, _TargetID, content, DateTime.Now, ref chatID); OnSendMessage(chatID, content); Message message = new Message(); message.Init(this.Get <Client>().Name, true, MessageInput.Document); message.ReceivedTimeType = (ReceivedTimeType)_timeType; if (_recentIsSelf == false || _recentIsSelf == null) { _recentIsSelf = true; message.IsDisplayUser = true; } _messagesAppended.Add(message); MessageView.Document.Blocks.AddRange(message); MessageView.ScrollToEnd(); } }