public SearchPageViewModel(IPatientSelectorViewModel patientSelectorViewModel, ISharedStateReadOnly <Patient> selectedPatientVariable, ISharedState <Date> selectedDateVariable, IViewModelCommunication viewModelCommunication, ICommandService commandService, IClientReadModelRepository readModelRepository, IClientMedicalPracticeRepository medicalPracticeRepository, Action <string> errorCallBack) { this.selectedPatientVariable = selectedPatientVariable; this.viewModelCommunication = viewModelCommunication; this.commandService = commandService; this.readModelRepository = readModelRepository; this.medicalPracticeRepository = medicalPracticeRepository; this.errorCallBack = errorCallBack; this.selectedDateVariable = selectedDateVariable; NoAppointmentsAvailable = false; selectedPatientVariable.StateChanged += OnSelectedPatientVariableChanged; PatientSelectorViewModel = patientSelectorViewModel; DeleteAppointment = new ParameterrizedCommand <DisplayAppointmentData>(DoDeleteAppointment); ModifyAppointment = new ParameterrizedCommand <DisplayAppointmentData>(DoModifyAppointment); SelectedPatient = NoPatientSelected; DisplayedAppointments = new ObservableCollection <DisplayAppointmentData>(); }
public PatientsPageViewModel(IPatientSelectorViewModel patientSelectorViewModel, IPatientRepository patientRepository, ISharedStateReadOnly <Patient> selectedPatientVariable, PatientNameGenerator patientNameGenerator) { this.patientRepository = patientRepository; this.selectedPatientVariable = selectedPatientVariable; this.patientNameGenerator = patientNameGenerator; PatientSelectorViewModel = patientSelectorViewModel; selectedPatientVariable.StateChanged += OnSelectedPatientChanged; OnSelectedPatientChanged(selectedPatientVariable.Value); Generate1000RandomPatients = new Command(DoGeneratePatients); }
public AddAppointmentDialogViewModel(IClientMedicalPracticeRepository medicalPracticeRepository, IClientReadModelRepository readModelRepository, IClientLabelRepository labelRepository, IPatientSelectorViewModel patientSelectorViewModel, ISharedStateReadOnly <Patient> selectedPatientVariable, Date creationDate, Guid medicalPracticeId, IAppointmentViewModelBuilder appointmentViewModelBuilder, Action <string> errorCallback) { this.readModelRepository = readModelRepository; this.creationDate = creationDate; this.appointmentViewModelBuilder = appointmentViewModelBuilder; this.errorCallback = errorCallback; this.selectedPatientVariable = selectedPatientVariable; ComputeTimeSlots(medicalPracticeRepository, medicalPracticeId); selectedPatientVariable.StateChanged += OnSelectedPatientVariableChanged; PatientSelectorViewModel = patientSelectorViewModel; CloseDialog = new Command(CloseWindow); CreateAppointment = new Command(DoCreateAppointment, () => CreationState != AppointmentCreationState.NoPatientSelected && CreationState != AppointmentCreationState.NoSpaceAvailable, new PropertyChangedCommandUpdater(this, nameof(CreationState))); HourPlusOne = new Command(DoHourPlusOne, CanHourPlusOne, new PropertyChangedCommandUpdater(this, nameof(DurationHours))); HourMinusOne = new Command(DoHourMinusOne, CanHourMinusOne, new PropertyChangedCommandUpdater(this, nameof(DurationHours), nameof(DurationMinutes))); MinutePlusFifteen = new Command(DoMinutePlusFifteen, CanMinutePlusFifteen, new PropertyChangedCommandUpdater(this, nameof(DurationHours), nameof(DurationMinutes))); MinuteMinusFifteen = new Command(DoMinuteMinusFifteen, CanMinuteMinusFifteen, new PropertyChangedCommandUpdater(this, nameof(DurationHours), nameof(DurationMinutes))); SelectedPatient = Patient.Dummy; Description = string.Empty; DurationMinutes = 0; DurationHours = 2; CreationState = AppointmentCreationState.NoPatientSelected; AllAvailablesLabels = new ObservableCollection <Label>(); labelRepository.RequestAllLabels( labelList => { Application.Current.Dispatcher.Invoke(() => { labelList.Do(AllAvailablesLabels.Add); SelectedLabel = labelList.First(); }); }, errorCallback ); }