public RoomUserViewModel(UserViewModel userViewModel)
        {
            _userViewModel = userViewModel;
            _userViewModel.PropertyChanged += OnUserPropertyChanged;

// ReSharper disable UseObjectOrCollectionInitializer
            _typingTimer = new DispatcherTimer();
// ReSharper restore UseObjectOrCollectionInitializer
            _typingTimer.Interval = TimeSpan.FromSeconds(3);
            _typingTimer.Tick += OnTypingExpiration;

            SetGroup();
        }
        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;
        }
        private void CompleteSignin(LogOnInfo logOnInfo, TaskCompletionSource<UserViewModel> taskCompletionSource)
        {
            _logOnInfo = logOnInfo;

            User userinfo = _client.GetUserInfo().Result;
            UserViewModel userviewModel = _userService.GetUserViewModel(userinfo);
            userviewModel.IsCurrentUser = true;

            _roomService.JoinRooms(logOnInfo.Rooms);
            _roomService.GetRooms();

            CurrentUser = userviewModel;

            taskCompletionSource.TrySetResult(userviewModel);
        }
 private void OnSigninComplete(UserViewModel user, bool hasJoinedRooms)
 {
     EventHandler<LoginCompleteEventArgs> handler = SignInComplete;
     if (handler != null)
         PostOnUi(() => handler(this, new LoginCompleteEventArgs(user, hasJoinedRooms)));
 }
Beispiel #5
0
 public LoginCompleteEventArgs(UserViewModel user, bool hasJoinedRooms)
 {
     User = user;
     HasJoinedRooms = hasJoinedRooms;
 }
Beispiel #6
0
 public UserJoinedEventArgs(UserViewModel userViewModel, string room)
 {
     Room = room;
     UserViewModel = userViewModel;
 }
Beispiel #7
0
 internal void SetUserTyping(UserViewModel user)
 {
     RoomUserViewModel userVm = _users.FirstOrDefault(x => x.User.Equals(user));
     if (userVm != null)
         userVm.IsTyping = true;
 }
Beispiel #8
0
        internal void UserLeft(UserViewModel user)
        {
            RoomUserViewModel leftUser = _users.FirstOrDefault(x => x.User.Equals(user));
            if (leftUser != null)
                _users.Remove(leftUser);

            // TODO: Implement notification to the room of left user.
        }
Beispiel #9
0
        internal void AddUser(UserViewModel userViewModel)
        {
            if (_users.Any(x => x.User.Equals(userViewModel)))
                return;

            var userVm = new RoomUserViewModel(userViewModel);
            userVm.IsOwner = _owners.Any(x => x.Equals(userVm.User.Name));

            _users.Add(userVm);

            // TODO: Implement notification to the room of the joined user
        }