void RegisterNewPatient() { PatientDemographicsViewModel newPatientVM = (PatientDemographicsViewModel)Workspaces.FirstOrDefault(w => w is PatientDemographicsViewModel); if (newPatientVM == null) { var newPatient = new PatientDemographicsModel { WasEnvelopeRandomised = IsEnvelopeRandomising }; newPatientVM = new PatientDemographicsViewModel(_repository, newPatient); this.Workspaces.Add(newPatientVM); } this.SetActiveWorkspace(newPatientVM); }
void ShowEnrolDetails(object param) { var window = new PatientDemographicUpdateView(); var model = Mapper.Map <PatientDemographicsModel>(_repository.FindParticipantAndCollections(SelectedParticipant.Id)); model.StudyCentre = SelectedParticipant.StudyCentre; var vm = new PatientDemographicsViewModel(_repository, model); window.DataContext = vm; EventHandler enrolCloseHandler = null; enrolCloseHandler = delegate { window.Close(); vm.RequestClose -= enrolCloseHandler; }; vm.RequestClose += enrolCloseHandler; window.ShowDialog(); }