コード例 #1
0
        private void LoadProjectWithPersister(IProjectPersister persister)
        {
            vm.ActivePersister = persister;

            vm.CurrentProjectVM = persister.LoadProject();
            menuVM             = new ProjectMenuVM(vm.CurrentProjectVM);
            vm.ActiveSectionVM = menuVM;

            vm.CurrentProjectVM.BoreIntervalsVM.ActivateIntervalImagesCommand =
                new DelegateCommand(arg =>
            {
                Intervals.PhotoCalibratedBoreIntervalVM intervalVM = arg as Intervals.PhotoCalibratedBoreIntervalVM;
                vm.ActiveSectionVM = intervalVM;
            });


            menuVM.ActivateBoreIntervalsCommand = new DelegateCommand(() =>
            {
                vm.ActiveSectionVM = vm.CurrentProjectVM.BoreIntervalsVM;
            });

            menuVM.ExitAppCommand = ExitCommand;

            menuVM.SaveCommand = new DelegateCommand(() =>
            {
                vm.ActivePersister.SaveProject(vm.CurrentProjectVM);
                MessageBox.Show("Проект успешно сохранен", "Успешно", MessageBoxButton.OK, MessageBoxImage.Information);
            });

            menuVM.ActivateAnnotationPlaneCommand = this.ActivateAnnotationPlaneDelegateCommand;

            vm.CurrentProjectVM.PlaneColumnSettingsVM.ActivateAnnotationPlaneCommand = menuVM.ActivateAnnotationPlaneCommand;

            menuVM.ActivateReportGenerationCommand = ActivateReportGenerationDelegateCommand;
        }