private void RegisterCreatePersonDialog(IPersonDataStore personDataStore) { _messenger.Register <CreatePersonDialogMessage>(this, x => { var m = new CreatePersonViewModel { Title = "Person erstellen" }; IWindow w = _vs.ExecuteFunction <CreatePersonViewModel, IWindow>((IWindow)Current.MainWindow, m); bool?result = w.ShowDialog(); if (!result.HasValue || !result.Value) { return; } Person person = new Person { FirstName = m.FirstName, LastName = m.LastName, DateOfBirth = m.DateOfBirth, Address = m.Address, City = m.City, ZipCode = m.ZipCode, Email = m.Email, Phone = m.Phone }; personDataStore.Create(person); _messenger.Send(new RefreshDataFromRepositoriesMessage()); _messenger.Send(new SetSelectedPersonMessage(person.PersonId)); }); }
private void ExecuteCreatePersonCommand(UiPerson uiPerson) { Person p = uiPerson.ToPerson(); _personDataStore.Create(p); _uiEvents.PersonDataStoreChanged(); _windowService.CloseCreatePersonWindow(); _uiEvents.SelectPersonById(p.PersonId); }
private Shooter CreateUnknownShooter(int shooterNumber) { Person person = new Person() { FirstName = "unknown", LastName = "unknown" }; _personDataStore.Create(person); Shooter shooter = new Shooter(); shooter.PersonId = person.PersonId; shooter.ShooterNumber = shooterNumber; _shooterDataStore.Create(shooter); return(shooter); }
private void RegisterCreatePersonDialog(IPersonDataStore personDataStore) { _messenger.Register<CreatePersonDialogMessage>(this, x => { var m = new CreatePersonViewModel { Title = "Person erstellen" }; IWindow w = _vs.ExecuteFunction<CreatePersonViewModel, IWindow>((IWindow) Current.MainWindow, m); bool? result = w.ShowDialog(); if (!result.HasValue || !result.Value) return; Person person = new Person { FirstName = m.FirstName, LastName = m.LastName, DateOfBirth = m.DateOfBirth, Address = m.Address, City = m.City, ZipCode = m.ZipCode, Email = m.Email, Phone = m.Phone }; personDataStore.Create(person); _messenger.Send(new RefreshDataFromRepositoriesMessage()); _messenger.Send(new SetSelectedPersonMessage(person.PersonId)); }); }