Пример #1
0
        private void editPersonViewModel_EditCanceled(object sender, EventArgs e)
        {
            EditPersonViewModel senderVM = (EditPersonViewModel)sender;

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

            SelectedPersonViewModel = editPersonViewModel;
            _eventAggregator.GetEvent <UserActionHappenedEvent>().Publish("Person edit view switched");
        }
Пример #3
0
        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");
        }
Пример #4
0
        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);
        }
Пример #5
0
        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");
        }
Пример #6
0
 private void EditPersonExecute()
 {
     IValidationService validationService = _container.Resolve<IValidationService>();
     var editPersonViewModel = new EditPersonViewModel(SelectedPerson, validationService);
     SelectedPersonViewModel = editPersonViewModel;
     _eventAggregator.GetEvent<UserActionHappenedEvent>().Publish("Person edit view switched");
 }