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) ); }); } } } }
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()); }