コード例 #1
0
        public void DisposeViewModel(IMainViewModel viewModelToDispose)
        {
            viewModelCommunication.RemoveViewModelCollection(Constants.ViewModelCollections.TherapyPlaceRowViewModelCollection);
            viewModelCommunication.RemoveViewModelCollection(Constants.ViewModelCollections.AppointmentGridViewModelCollection);
            viewModelCommunication.RemoveViewModelCollection(Constants.ViewModelCollections.TimeGridViewModelCollection);
            viewModelCommunication.RemoveViewModelCollection(Constants.ViewModelCollections.AppointmentViewModelCollection);

            var optionsPageViewModel             = viewModelToDispose.OptionsPageViewModel;
            var searchPageViewModel              = viewModelToDispose.SearchPageViewModel;
            var overviewPageViewModel            = viewModelToDispose.OverviewPageViewModel;
            var patientSelectorViewModel         = searchPageViewModel.PatientSelectorViewModel;
            var dateDisplayViewModel             = overviewPageViewModel.DateDisplayViewModel;
            var medicalPracticeSelectorViewModel = overviewPageViewModel.MedicalPracticeSelectorViewModel;
            var roomSelectorViewModel            = overviewPageViewModel.RoomFilterViewModel;
            var dateSelectorViewModel            = overviewPageViewModel.DateSelectorViewModel;
            var gridContainerViewModel           = overviewPageViewModel.GridContainerViewModel;
            var undoRedoViewModel = overviewPageViewModel.UndoRedoViewModel;

            viewModelCommunication.DeregisterViewModelMessageHandler <AsureDayIsLoaded>(gridContainerViewModel);
            viewModelCommunication.DeregisterViewModelMessageHandler <ShowPage>(viewModelToDispose);
            viewModelCommunication.DeregisterViewModelMessageHandler(confirmChangesMessageHandler);
            viewModelCommunication.DeregisterViewModelMessageHandler(rejectChangesMessageHandler);

            optionsPageViewModel.Dispose();
            searchPageViewModel.Dispose();
            overviewPageViewModel.Dispose();
            patientSelectorViewModel.Dispose();
            dateDisplayViewModel.Dispose();
            medicalPracticeSelectorViewModel.Dispose();
            roomSelectorViewModel.Dispose();
            dateSelectorViewModel.Dispose();
            gridContainerViewModel.Dispose();
            undoRedoViewModel.Dispose();
        }
コード例 #2
0
 protected override void CleanUp()
 {
     viewModelCommunication.DeregisterViewModelMessageHandler <ShowNotification>(this);
     viewModelCommunication.DeregisterViewModelMessageHandler <HideNotification>(this);
 }