public ClosedDayGridViewModel(AggregateIdentifier identifier,
                                      ClientMedicalPracticeData medicalPractice,
                                      IViewModelCommunication viewModelCommunication,
                                      ISharedStateReadOnly <Size> appointmentGridSizeVariable)
        {
            this.viewModelCommunication      = viewModelCommunication;
            this.appointmentGridSizeVariable = appointmentGridSizeVariable;

            Identifier = identifier;
            IsActive   = false;

            viewModelCommunication.RegisterViewModelAtCollection <IAppointmentGridViewModel, AggregateIdentifier>(
                Constants.ViewModelCollections.AppointmentGridViewModelCollection,
                this
                );

            appointmentGridSizeVariable.StateChanged += OnGridSizeChanged;

            TimeGridViewModel = new TimeGridViewModel(Identifier, viewModelCommunication,
                                                      medicalPractice, appointmentGridSizeVariable.Value);

            TherapyPlaceRowViewModels = new ObservableCollection <ITherapyPlaceRowViewModel>();

            PracticeIsClosedAtThisDay = true;
        }
Beispiel #2
0
        public AppointmentGridViewModel(AggregateIdentifier identifier,
                                        ClientMedicalPracticeData medicalPractice,
                                        IViewModelCommunication viewModelCommunication,
                                        ISharedStateReadOnly <Size> gridSizeVariable,
                                        ISharedStateReadOnly <Guid?> roomFilterVariable,
                                        ISharedStateReadOnly <Guid> displayedMedicalPracticeVariable,
                                        ISharedState <AppointmentModifications> appointmentModificationsVariable,
                                        IAppointmentViewModelBuilder appointmentViewModelBuilder,
                                        AppointmentsOfADayReadModel readModel,
                                        IEnumerable <ITherapyPlaceRowViewModel> therapyPlaceRowViewModels,
                                        Action <string> errorCallback)
        {
            this.medicalPractice                  = medicalPractice;
            this.viewModelCommunication           = viewModelCommunication;
            this.gridSizeVariable                 = gridSizeVariable;
            this.roomFilterVariable               = roomFilterVariable;
            this.displayedMedicalPracticeVariable = displayedMedicalPracticeVariable;
            this.appointmentModificationsVariable = appointmentModificationsVariable;
            this.appointmentViewModelBuilder      = appointmentViewModelBuilder;
            this.readModel     = readModel;
            this.errorCallback = errorCallback;

            // Initial appointment-Creation is done at the AppointmentGridBuilder

            IsActive = false;
            PracticeIsClosedAtThisDay = false;

            gridSizeVariable.StateChanged   += OnGridSizeChanged;
            roomFilterVariable.StateChanged += OnGlobalRoomFilterVariableChanged;

            viewModelCommunication.RegisterViewModelAtCollection <IAppointmentGridViewModel, AggregateIdentifier>(
                Constants.ViewModelCollections.AppointmentGridViewModelCollection,
                this
                );

            Identifier = identifier;

            readModel.AppointmentChanged += OnReadModelAppointmentChanged;

            TimeGridViewModel = new TimeGridViewModel(Identifier, viewModelCommunication,
                                                      medicalPractice, gridSizeVariable.Value);

            TherapyPlaceRowViewModels = new ObservableCollection <ITherapyPlaceRowViewModel>(therapyPlaceRowViewModels);


            OnGlobalRoomFilterVariableChanged(roomFilterVariable.Value);
        }