Example #1
0
        internal Message(WTalk.Core.ProtoJson.Schema.Event chatEvent)
        {
            _event = chatEvent;


            OnPropertyChanged(nameof(Content));
        }
Example #2
0
 internal void AddContent(WTalk.Core.ProtoJson.Schema.Event chatEvent, bool prepend = false)
 {
     if (prepend)
     {
         _content.InsertRange(0, chatEvent.chat_message.message_content.segment.Select(c => c.text));
     }
     else
     {
         _content.AddRange(chatEvent.chat_message.message_content.segment.Select(c => c.text));
     }
     MessageDate = chatEvent.timestamp.FromUnixTime();
     OnPropertyChanged("Content");
 }
        void _client_NewConversationEventReceived(object sender, Event e)
        {
            if (e.conversation_id.id == this._conversationCache.Id)
            {
                if (_lastMessage.SenderId == e.sender_id.chat_id)
                    _lastMessage.AppendContent(e.chat_message);
                else
                {
                    _lastMessage = new Message(_conversationCache.Participants[e.sender_id.chat_id], e.chat_message);
                    App.Current.Dispatcher.Invoke(() =>
                    {
                        Messages.Add(_lastMessage);
                    });
                }

                App.Current.Dispatcher.Invoke(() =>
                     {
                         if (AttentionRequired != null)
                             AttentionRequired(this, null);
                     });
            }
        }
Example #4
0
        internal void AddNewMessage(Event e)
        {
            messagesIds.Add(e.event_id, e.timestamp);
            if (_lastMessage.SenderId == e.sender_id.chat_id)
                _lastMessage.AddContent(e);
            else
            {
                _lastMessage = new Message(e);
                _synchronizationContext.Post((obj) =>
                {
                    MessagesHistory.Add(obj as Message);
                }, _lastMessage);

            }

            OnPropertyChanged("MessagesHistory");
            OnPropertyChanged("LastMessage");

            if (NewMessageReceived != null)
                NewMessageReceived(this, _lastMessage);
        }
Example #5
0
 internal Message(WTalk.Core.ProtoJson.Schema.Event chatEvent)
 {
     _event = chatEvent;
     AddContent(chatEvent);
     MessageDate = chatEvent.timestamp.FromUnixTime();
 }
Example #6
0
 internal Message(WTalk.Core.ProtoJson.Schema.Event chatEvent)
 {
     _event = chatEvent;
     AddContent(chatEvent);
     MessageDate = chatEvent.timestamp.FromUnixTime();
 }