コード例 #1
0
        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);
            }
        }
コード例 #2
0
        private void OnFriendDeleted(int friendId)
        {
            IFriendEditViewModel friendEditVmToClose =
                FriendEditViewModels.SingleOrDefault(f => f.Friend.Id == friendId);

            if (friendEditVmToClose != null)
            {
                FriendEditViewModels.Remove(friendEditVmToClose);
            }
        }
コード例 #3
0
        private void OnFriendDeleted(int friendId)
        {
            var viewModel = FriendEditViewModels
                            .SingleOrDefault(f => f.Friend.Id == friendId);

            if (viewModel != null)
            {
                FriendEditViewModels.Remove(viewModel);
            }
        }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
ファイル: MainViewModel.cs プロジェクト: laskalexjob/WPF.TDD
        private void OnCloseFriendTabExecute(object obj)
        {
            var friendEditVm = (IFriendEditViewModel)obj;

            FriendEditViewModels.Remove(friendEditVm);
        }
コード例 #7
0
        private void OnFriendDeleted(int friendId)
        {
            var friendEditVm = FriendEditViewModels.Single(vm => vm.Friend.Id == friendId);

            FriendEditViewModels.Remove(friendEditVm);
        }
コード例 #8
0
 private void OnCloseTabExecute(object friendEditViewModel)
 {
     FriendEditViewModels.Remove((IFriendEditViewModel)friendEditViewModel);
 }
コード例 #9
0
 private void OnDeleteFriend(int friendId)
 {
     FriendEditViewModels.Remove(
         FriendEditViewModels.SingleOrDefault <IFriendEditViewModel>(model => model.Friend.Id == friendId));
 }