public OrganizationTreeItemViewModel(IRTreeMember <IEntity> Parent, IRTreeMember <IEntity> target, ITreeItemViewModelFactory treeItemViewModelFactory, IEventAggregator eventAggregator)
        {
            Target = target;
            parent = Parent;
            TreeItemViewModelFactory = treeItemViewModelFactory;

            Visible    = true;
            IsSelected = false;
            IsExpanded = true;

            EA = eventAggregator;

            EA.GetEvent <FilterClearRequestEvent>().Subscribe(FilterClearRequestEventExecute);

            RebuildChildren();
        }
示例#2
0
        public EntityListViewModel(IEventAggregator eventAggregator, IEntityProvider entityProvider, TreeItemViewModelFactory treeItemViewModelFactory)
        {
            //assign event aggregator to local variable for later use
            EA = eventAggregator;
            EA.GetEvent <NewEntityRequestEvent>().Subscribe(NewEntityRequestEventExecute);
            EA.GetEvent <DataLoadSuccessEvent>().Subscribe(DataLoadSuccessEventExecute);

            EA.GetEvent <FilterRequestEvent>().Subscribe(FilterRequestEventExecute);

            EA.GetEvent <UIUpdateRequestEvent>().Subscribe(UIUpdateRequestExecute);

            TreeItemViewModelFactory = treeItemViewModelFactory;

            EP = entityProvider;

            TreeHeads = new ObservableCollection <OrganizationTreeItemViewModel>
            {
                //currently only uses the first head specified in the RTree, eventually plan to add multi head RTrees
                //RTrees currently support multi heading, TreeHeads does not
                TreeItemViewModelFactory.CreateOrganizationViewModel(null, EP.HeadEntities()[0])
            };
            RaisePropertyChanged(nameof(TreeHeads));
        }