private void editPersonViewModel_EditCanceled(object sender, EventArgs e)
        {
            EditPersonViewModel senderVM = (EditPersonViewModel)sender;

            SelectedPersonViewModel = new PersonViewModel(senderVM.Model);
            _eventAggregator.GetEvent <UserActionHappenedEvent>().Publish("Person edit canceled");
        }
        private void EditPersonExecute()
        {
            IValidationService validationService = _container.Resolve <IValidationService>();
            var editPersonViewModel = new EditPersonViewModel(SelectedPerson, validationService);

            SelectedPersonViewModel = editPersonViewModel;
            _eventAggregator.GetEvent <UserActionHappenedEvent>().Publish("Person edit view switched");
        }
        private void EditPersonDialogExecute()
        {
            IWindowService     windowService     = _container.Resolve <IWindowService>();
            IValidationService validationService = _container.Resolve <IValidationService>();
            var  editPersonViewModel             = new EditPersonViewModel(SelectedPerson, validationService);
            bool?dialogResult = windowService.ShowDialog(editPersonViewModel);

            if (dialogResult == true)
            {
                editPersonViewModel_EditApplied(editPersonViewModel, EventArgs.Empty);
            }
            else
            {
                editPersonViewModel_EditCanceled(editPersonViewModel, EventArgs.Empty);
            }

            _eventAggregator.GetEvent <UserActionHappenedEvent>().Publish("Person edit dialog opened");
        }
        private void PersonSelectionChanged(Tuple<Person, bool> payload)
        {
            if (payload.Item1 == null)
            {
                SelectedPersonViewModel = null;
                SelectedPerson = null;
                return;
            }

            SelectedPerson = payload.Item1;
            if (payload.Item2)
                SelectedPersonViewModel = new EditPersonViewModel(SelectedPerson, _container.Resolve<IValidationService>());
            else
                SelectedPersonViewModel = new PersonViewModel(SelectedPerson);
        }
        private void EditPersonDialogExecute()
        {
            IWindowService windowService = _container.Resolve<IWindowService>();
            IValidationService validationService = _container.Resolve<IValidationService>();
            var editPersonViewModel = new EditPersonViewModel(SelectedPerson, validationService);
            bool? dialogResult = windowService.ShowDialog(editPersonViewModel);
            if (dialogResult == true)
                editPersonViewModel_EditApplied(editPersonViewModel, EventArgs.Empty);
            else
                editPersonViewModel_EditCanceled(editPersonViewModel, EventArgs.Empty);

            _eventAggregator.GetEvent<UserActionHappenedEvent>().Publish("Person edit dialog opened");
        }
 private void EditPersonExecute()
 {
     IValidationService validationService = _container.Resolve<IValidationService>();
     var editPersonViewModel = new EditPersonViewModel(SelectedPerson, validationService);
     SelectedPersonViewModel = editPersonViewModel;
     _eventAggregator.GetEvent<UserActionHappenedEvent>().Publish("Person edit view switched");
 }