Esempio n. 1
0
        private void OnGlobalRoomFilterVariableChanged(Guid?newRoomFilter)
        {
            if (IsActive)
            {
                if (displayedMedicalPracticeVariable.Value == medicalPractice.Id)
                {
                    if (newRoomFilter == null)
                    {
                        TherapyPlaceRowViewModels.Do(viewModel =>
                        {
                            viewModelCommunication.SendTo(
                                Constants.ViewModelCollections.TherapyPlaceRowViewModelCollection,
                                viewModel.Identifier,
                                new SetVisibility(true)
                                );
                        });
                    }
                    else
                    {
                        TherapyPlaceRowViewModels.Do(viewModel =>
                        {
                            viewModelCommunication.SendTo(
                                Constants.ViewModelCollections.TherapyPlaceRowViewModelCollection,
                                viewModel.Identifier,
                                new SetVisibility(false)
                                );
                        });

                        medicalPractice.GetRoomById(newRoomFilter.Value)
                        .TherapyPlaces
                        .Select(therapyPlace => therapyPlace.Id)
                        .Do(id =>
                        {
                            viewModelCommunication.SendTo(
                                Constants.ViewModelCollections.TherapyPlaceRowViewModelCollection,
                                new TherapyPlaceRowIdentifier(Identifier, id),
                                new SetVisibility(true)
                                );
                        });
                    }
                }
            }
        }
Esempio n. 2
0
        private void OnGridSizeChanged(Size newGridSize)
        {
            if (IsActive)
            {
                viewModelCommunication.SendTo(
                    Constants.ViewModelCollections.TimeGridViewModelCollection,
                    Identifier,
                    new NewSizeAvailable(newGridSize)
                    );

                foreach (var therapyPlaceRowIdentifier in TherapyPlaceRowViewModels.Select(viewModel => viewModel.Identifier))
                {
                    viewModelCommunication.SendTo(
                        Constants.ViewModelCollections.TherapyPlaceRowViewModelCollection,
                        therapyPlaceRowIdentifier,
                        new NewSizeAvailable(newGridSize)
                        );
                }
            }
        }
Esempio n. 3
0
        protected override void CleanUp()
        {
            gridSizeVariable.StateChanged   -= OnGridSizeChanged;
            roomFilterVariable.StateChanged -= OnGlobalRoomFilterVariableChanged;
            readModel.AppointmentChanged    -= OnReadModelAppointmentChanged;

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

            viewModelCommunication.SendTo(
                Constants.ViewModelCollections.TimeGridViewModelCollection,
                Identifier,
                new Dispose()
                );

            readModel.Appointments
            .Do(RemoveAppointment);

            readModel.Dispose();

            TherapyPlaceRowViewModels.Do(viewModel => viewModel.Dispose());
        }