private void OnCloseFriendTabExecute(object parameter) { var friendEditVmToClose = parameter as IFriendEditViewModel; if (friendEditVmToClose != null) { // TODO: Check if the Friend has changes and ask user to cancel FriendEditViewModels.Remove(friendEditVmToClose); } }
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 OnCloseFriendTabExecute(object parameter) { var friendEditVmToClose = parameter as IFriendEditViewModel; if (friendEditVmToClose != null) { if (friendEditVmToClose.Friend.IsChanged) { var result = _messageDialogService.ShowYesNoDialog("Close tab?", "You'll lose your changes if you close this tab. Close it?", MessageDialogResult.No); if (result == MessageDialogResult.No) { return; } } FriendEditViewModels.Remove(friendEditVmToClose); } }
private void OnCloseFriendTabExecute(object obj) { var friendEditVmToClose = obj as IFriendEditViewModel; if (friendEditVmToClose != null) { // TODO: Check if the Friend has changes and ask user to cancel if (friendEditVmToClose.Friend.IsChanged) { var result = _messageDialogService.ShowYesNoDialog("Close Tab?", $"There are unsaved changes, do you really want to close this tab?", MessageDialogResult.No); if (result == MessageDialogResult.No) { SelectedFriendEditViewModel = friendEditVmToClose; return; } } FriendEditViewModels.Remove(friendEditVmToClose); } }
private void OnCloseFriendTabExecute(object obj) { var friendEditVm = (IFriendEditViewModel)obj; FriendEditViewModels.Remove(friendEditVm); }
private void OnFriendDeleted(int friendId) { var friendEditVm = FriendEditViewModels.Single(vm => vm.Friend.Id == friendId); FriendEditViewModels.Remove(friendEditVm); }
private void OnCloseTabExecute(object friendEditViewModel) { FriendEditViewModels.Remove((IFriendEditViewModel)friendEditViewModel); }
private void OnDeleteFriend(int friendId) { FriendEditViewModels.Remove( FriendEditViewModels.SingleOrDefault <IFriendEditViewModel>(model => model.Friend.Id == friendId)); }