Пример #1
0
 public TreeEventViewModel([NotNull] TreeEvent treeEvent, [NotNull] EventTreeViewModel parentEventTreeViewModel, [NotNull] ProjectManipulationService projectManipulationService)
 {
     this.projectManipulationService = projectManipulationService;
     TreeEvent = treeEvent;
     ParentEventTreeViewModel   = parentEventTreeViewModel;
     treeEvent.PropertyChanged += TreeEventPropertyChanged;
 }
Пример #2
0
        public ProjectViewModel([NotNull] Project project)
        {
            BusyIndicator = StorageState.Idle;

            Project = project;
            projectManipulationService = new ProjectManipulationService(project);

            var eventTreeViewModels = new ObservableCollection <EventTreeViewModel>(project.EventTrees.Select(te =>
            {
                var eventTreeViewModel = new EventTreeViewModel(te, projectManipulationService)
                {
                    EstimationSpecificationViewModelFactory = new EstimationSpecificationViewModelFactory(project)
                };
                eventTreeViewModel.PropertyChanged += EventTreeViewModelPropertyChanged;
                return(eventTreeViewModel);
            }));

            EventTrees             = eventTreeViewModels;
            addTreeEventCommand    = new AddTreeEventCommand(this);
            removeTreeEventCommand = new RemoveTreeEventCommand(this);

            expertViewModels = new ObservableCollection <ExpertViewModel>(Project.Experts.Select(e => new ExpertViewModel(e)));
            expertViewModels.CollectionChanged += ExpertViewModelsCollectionChanged;

            hydraulicsViewModels = new ObservableCollection <HydraulicConditionViewModel>(Project.HydraulicConditions.Select(e => new HydraulicConditionViewModel(e)));
            hydraulicsViewModels.CollectionChanged += HydraulicsViewModelsCollectionChanged;

            project.EventTrees.CollectionChanged += EventTreesCollectionChanged;

            SelectedEventTreeFiltered = EventTrees.FirstOrDefault();
            foreach (var eventTreeViewModel in EventTrees)
            {
                eventTreeViewModel.SelectedTreeEvent = eventTreeViewModel.MainTreeEventViewModel;
            }
        }