private void OnFriendDeleted(int friendId) { IFriendEditViewModel friendEditVmToClose = FriendEditViewModels.SingleOrDefault(f => f.Friend.Id == friendId); if (friendEditVmToClose != null) { FriendEditViewModels.Remove(friendEditVmToClose); } }
private void OnFriendDeleted(int friendId) { var viewModel = FriendEditViewModels .SingleOrDefault(f => f.Friend.Id == friendId); if (viewModel != null) { FriendEditViewModels.Remove(viewModel); } }
private void OnOpenFriendEditView(int friendId) { var friendEditVm = FriendEditViewModels.SingleOrDefault(vm => vm.Friend.Id == friendId); if (friendEditVm == null) { friendEditVm = CreateAndLoadFriendEditViewModel(friendId); } SelectedFriendEditViewModel = friendEditVm; }
private void OnOpenFriendEditView(int friendId) { var friendEditVm = FriendEditViewModels.SingleOrDefault(vm => vm.Friend.Id == friendId); // ad 2 / 3 if (friendEditVm == null) //if not found { friendEditVm = _friendEditVmCreator(); //ad 2 FriendEditViewModels.Add(friendEditVm); // ad 2 friendEditVm.Load(friendId); //ad 2 } SelectedFriendEditViewModel = friendEditVm; }
private void OnOpenFriendEditView(int friendId) { IFriendEditViewModel selectedFriendViewModel = FriendEditViewModels.SingleOrDefault(model => model.Friend.Id == friendId); if (selectedFriendViewModel == null) { selectedFriendViewModel = CreateAndLoadFriendEditViewModel(friendId); } SelectedFriendEditViewModel = selectedFriendViewModel; }
private void OnOpenFriendEditView(int friendId) { var friendEditVm = FriendEditViewModels.SingleOrDefault(vm => vm.Friend.Id == friendId); if (friendEditVm == null) { friendEditVm = _friendEditVmCreator(); FriendEditViewModels.Add(friendEditVm); friendEditVm.Load(friendId); } SelectedFriendEditViewModel = friendEditVm; }
private void OnOpenFriendTab(int friendId) { var viewModel = FriendEditViewModels .SingleOrDefault(vm => vm.Friend.Id == friendId); if (viewModel == null) { viewModel = _friendEditViewModelCreator(); FriendEditViewModels.Add(viewModel); viewModel.Load(friendId); } SelectedFriendEditViewModel = viewModel; }
private void OnDeleteFriend(int friendId) { FriendEditViewModels.Remove( FriendEditViewModels.SingleOrDefault <IFriendEditViewModel>(model => model.Friend.Id == friendId)); }