private void ClientRoomRefreshed(object sender, RoomEventArgs e) { if (e.Room.Name != Name) return; MainViewModel.Dispatcher.BeginInvoke(new Action<RoomEventArgs>(args => { Description = args.Room; foreach (var user in Users) user.Dispose(); Users.Clear(); foreach (string user in Description.Users) Users.Add(new UserViewModel(args.Users.Find(u => string.Equals(u.Nick, user)), this)); OnPropertyChanged("Name"); OnPropertyChanged("Admin"); OnPropertyChanged("Users"); }), e); }
private void ClientRoomOpened(RoomEventArgs e) { using (var client = ClientModel.Get()) { RefreshUsers(client); RefreshReceivers(client); FillMessages(client); } }
private void ClientRoomRefreshed(RoomEventArgs e) { using (var client = ClientModel.Get()) { if (e.RoomName == Name) RefreshUsers(client); if (e.RoomName == ServerModel.MainRoomName) RefreshReceivers(client); } }
private void ClientRoomOpened(RoomEventArgs e) { // If room view model already exist then event will be processed by it self if (Rooms.Any(vm => vm.Name == e.RoomName)) return; // Else create new view model var roomViewModel = new RoomViewModel(this, e.RoomName, e.Users); roomViewModel.Updated = true; Rooms.Add(roomViewModel); window.Alert(); }
private void ClientRoomClosed(RoomEventArgs e) { var roomViewModel = Rooms.FirstOrDefault(vm => vm.Name == e.RoomName); if (roomViewModel == null) return; Rooms.Remove(roomViewModel); roomViewModel.Dispose(); window.Alert(); }
private void ClientRoomClosed(object sender, RoomEventArgs e) { Dispatcher.BeginInvoke(new Action<RoomEventArgs>(args => { RoomViewModel roomViewModel = Rooms.FirstOrDefault(roomVM => roomVM.Name == args.Room.Name); if (roomViewModel == null) return; Rooms.Remove(roomViewModel); roomViewModel.Dispose(); window.Alert(); }), e); }
private void ClientRoomOpened(object sender, RoomEventArgs e) { Dispatcher.BeginInvoke(new Action<RoomEventArgs>(args => { if (Rooms.FirstOrDefault(roomVM => roomVM.Name == args.Room.Name) != null) return; RoomViewModel roomViewModel = new RoomViewModel(this, args.Room, args.Users); roomViewModel.Updated = true; Rooms.Add(roomViewModel); window.Alert(); }), e); }
private void ClientRoomRefreshed(object sender, RoomEventArgs e) { Dispatcher.BeginInvoke(new Action<RoomEventArgs>(args => { if (args.Room.Name == ServerModel.MainRoomName) { AllUsers.Clear(); using (var client = ClientModel.Get()) { foreach (string nick in args.Room.Users) { var user = args.Users.Single(u => u.Equals(nick)); AllUsers.Add(new UserViewModel(user, null) { IsClient = user.Equals(client.User) }); } } } }), e); }