public ChatMessageGroupViewModel(ChatMessageViewModel message)
            : base(false)
        {
            IsNotifying = false;

            _messages = new BindableCollection<ChatMessageViewModel> {message};
            _messages.CollectionChanged += MessagesOnCollectionChanged;
            _user = message.User;
            MessageDateTime = message.MessageDateTime;
            MessageId = message.MessageId;
            LastMessageDateTime = message.MessageDateTime;

            IsNotifying = true;
        }
Esempio n. 2
0
        private void OnMessageProcessed(ChatMessageViewModel messageViewModel, string room)
        {
            RoomViewModel roomViewModel = _roomService.GetRoom(room);

            PostOnUi(() => roomViewModel.ProcessMessage(messageViewModel));
        }
        public bool TryAddMessage(ChatMessageViewModel message)
        {
            if (!ReferenceEquals(message.User, User))
                return false;

            _messages.Add(message);
            LastMessageDateTime = message.MessageDateTime;
            UnreadMessageCount = _messages.Count(x => !x.HasBeenSeen);
            return true;
        }
        public bool TryAddPreviousMessage(ChatMessageViewModel message)
        {
            if (!ReferenceEquals(message.User, User))
                return false;

            _messages.Insert(0, message);
            MessageDateTime = message.MessageDateTime;
            MessageId = message.MessageId;
            return true;
        }
Esempio n. 5
0
 public MessageProcessedEventArgs(ChatMessageViewModel message, string room)
 {
     Room = room;
     MessageViewModel = message;
 }
Esempio n. 6
0
        internal void ProcessMessage(ChatMessageViewModel viewModel, bool suppressUnreadNotifications = false)
        {
            viewModel.HasBeenSeen = IsRoomVisible(suppressUnreadNotifications);

            var lastGroupMessage = _messages.LastOrDefault() as ChatMessageGroupViewModel;
            if (lastGroupMessage == null || !lastGroupMessage.TryAddMessage(viewModel))
            {
                var groupViewModel = new ChatMessageGroupViewModel(viewModel);
                _messages.Add(groupViewModel);
            }

            UpdateUnreadMessageCount();
        }