示例#1
0
 void DataLoadSuccessEventExecute(IRTreeMember <IEntity> NewHead)
 {
     TreeHeads = new ObservableCollection <OrganizationTreeItemViewModel>
     {
         TreeItemViewModelFactory.CreateOrganizationViewModel(null, NewHead)
     };
 }
        public void ShowNewEventPopup(Action <IDialogResult> action, IJob targetjob, IRTreeMember <IEntity> targetentity, int effects, int Date)
        {
            DialogParameters Paramaters = new DialogParameters {
                { "Job", targetjob }, { "Entity", targetentity }, { "Effects", effects }, { "Date", Date }
            };

            DS.ShowDialog(nameof(NewEventPopupView), Paramaters, action);
        }
示例#3
0
        public IRTreeMember <T> AddItem(T i_item, bool is_head = false)
        {
            IRTreeMember <T> member = factory.CreateRTreeMember(this);

            member.Item   = i_item;
            member.IsHead = is_head;
            dict.Add(member.Gid, member);
            return(member);
        }
        public IJob AddBlankJobToEntity(IRTreeMember <IEntity> parent_entity)
        {
            IJob J = _jobFactory.CreateJob();

            J.OwnerEntity = parent_entity.Gid;
            DS.Job_List.Add(J);
            NotifyJobListChanged();
            return(J);
        }
示例#5
0
        public List <IRTreeMember <T> > Get_Immidiate_Parents(IRTreeMember <T> i_item)
        {
            List <IRTreeMember <T> > Parents = new List <IRTreeMember <T> >();

            foreach (Guid G in i_item.Parents)
            {
                Parents.Add(dict[G]);
            }
            return(Parents);
        }
示例#6
0
        public List <IRTreeMember <T> > Get_Immidiate_Children(IRTreeMember <T> i_item)
        {
            List <IRTreeMember <T> > Children = new List <IRTreeMember <T> >();

            foreach (Guid G in i_item.Child_Guids)
            {
                Children.Add(dict[G]);
            }
            return(Children);
        }
示例#7
0
        public EntityProvider(IEventAggregator eventAggregator, IDataService dataService, IEntityFactory entityFactory)
        {
            DS = dataService;
            EA = eventAggregator;
            EF = entityFactory;

            currenttargetorganization = HeadEntities()[0];

            EA.GetEvent <SelectedEntityChangedEvent>().Subscribe(SelectedEntityChangedExecute);
            EA.GetEvent <AlterEntityRelationshipsEvent>().Subscribe(AlterEntityRelationshipsExecute);
        }
 public List <IJob> GetEntitiesJobs(IRTreeMember <IEntity> entity)
 {
     if (entity is not null)
     {
         return(DS.Job_List.Where(J => J.OwnerEntity == entity.Gid)?.ToList());
     }
     else
     {
         return(null);
     }
 }
        public CharacterTreeItemViewModel(IRTreeMember <IEntity> Parent, IRTreeMember <IEntity> target, IEventAggregator eventAggregator)
        {
            Target = target;
            parent = Parent;

            EA = eventAggregator;

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

            Visible    = true;
            IsSelected = false;
            IsExpanded = false;
        }
示例#10
0
        private void AlterEntityRelationshipsExecute(AlterEntityRelationshipContainer container)
        {
            IRTreeMember <IEntity> Parent = container.parent; //the parent of the target entity
            IRTreeMember <IEntity> Target = container.target; //the Entity the event was initiated by

            switch (container.RCT)
            {
            case RelationshipChangeType.Cut:
                EntityCopyPasteBuffer = Target;
                DS.EntityTree.RemoveChild(Parent, Target);
                NotifyEntityListChanged();
                break;

            case RelationshipChangeType.Copy:
                EntityCopyPasteBuffer = Target;
                break;

            case RelationshipChangeType.Paste:
                if (Target.Item is Organization)
                {
                    if (EntityCopyPasteBuffer is IRTreeMember <IEntity> )
                    {
                        if (EntityCopyPasteBuffer.IsHead == false)
                        {
                            DS.EntityTree.AddChild(Target, EntityCopyPasteBuffer);
                            NotifyEntityListChanged();
                        }
                    }
                }
                else
                {
                    throw new InvalidOperationException("Paste operation is not permitted on non Organization entities.");
                }
                break;

            case RelationshipChangeType.DeleteLocal:
                DS.EntityTree.RemoveChild(Parent, Target);
                NotifyEntityListChanged();
                break;

            case RelationshipChangeType.DeleteGlobal:
                DS.EntityTree.RemoveItem(Target);
                NotifyEntityListChanged();
                break;

            default:
                break;
            }
        }
示例#11
0
        public void RemoveItem(IRTreeMember <T> i_item)
        {
            List <Guid> P = new List <Guid>(i_item.Parents);
            List <Guid> C = new List <Guid>(i_item.Child_Guids);

            foreach (Guid G in P)
            {
                RemoveChild(dict[G], i_item);
            }
            foreach (Guid G in C)
            {
                RemoveChild(i_item, dict[G]);
            }
            dict.Remove(i_item.Gid);
        }
示例#12
0
 public void AddChild(IRTreeMember <T> Parent, IRTreeMember <T> Child)
 {
     if (Get_All_Parents(Parent).Contains(Child) == false)
     {
         if (Parent.Gid != Child.Gid)
         {
             Parent.AddChild(Child.Gid);
             Child.AddParent(Parent.Gid);
         }
     }
     else
     {
         //do nothing, adding the child would create a recursive loop
     }
 }
示例#13
0
 void SelectedEntityChangedExecute(IRTreeMember <IEntity> Selected_Item)
 {
     if (Selected_Item.Item is Character)
     {
         RM.RequestNavigate("DETAIL_REGION", "CharacterDetailView");
     }
     else if (Selected_Item.Item is Organization)
     {
         RM.RequestNavigate("DETAIL_REGION", "OrganizationDetailView");
     }
     else
     {
         throw new Exception("Selected_Item is not Character or Organization");
     }
 }
        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();
        }
示例#15
0
 private void SelectedEntityChangedExecute(IRTreeMember <IEntity> newTarget)
 {
     if (newTarget.Item is Character)
     {
         currenttargetcharacter = newTarget;
         NotifySelectedCharacterChanged();
     }
     else if (newTarget.Item is Organization)
     {
         currenttargetorganization = newTarget;
         NotifySelectedOrganizationChanged();
         //EA.GetEvent<SelectedEntityChangedPostEvent>().Publish(EntityTypes.Organization);
     }
     else
     {
         throw new Exception("newtarget is not character or organization");
     }
 }
示例#16
0
        public List <IRTreeMember <T> > Get_All_Parents(IRTreeMember <T> i_item)
        {
            List <IRTreeMember <T> > Parents = Get_Immidiate_Parents(i_item);
            List <IRTreeMember <T> > Result  = new List <IRTreeMember <T> >();

            foreach (IRTreeMember <T> i in Parents)
            {
                Result.Add(i);
                foreach (IRTreeMember <T> j in Get_All_Parents(i))
                {
                    if (Result.Contains(j) == false)
                    {
                        Result.Add(j);
                    }
                }
            }
            return(Result);
        }
示例#17
0
        public List <IRTreeMember <T> > Get_All_Children(IRTreeMember <T> i_item)
        {
            List <IRTreeMember <T> > Children = Get_Immidiate_Children(i_item);
            List <IRTreeMember <T> > Result   = new List <IRTreeMember <T> >();

            foreach (IRTreeMember <T> i in Children)
            {
                Result.Add(i);
                foreach (IRTreeMember <T> j in Get_All_Children(i))
                {
                    if (Result.Contains(j) == false)
                    {
                        Result.Add(j);
                    }
                }
            }
            return(Result);
        }
示例#18
0
        public List <IEvent> GetEventsForEntity(IRTreeMember <IEntity> E)
        {
            List <IEvent> E_List = new List <IEvent>();

            if (E is not null)
            {
                List <IJob> J_List = JDP.GetEntitiesJobs(E);

                foreach (IJob job in J_List)
                {
                    E_List.AddRange(GetEventsForJob(job));
                }
                return(E_List);
            }
            else
            {
                return(null);
            }
        }
示例#19
0
 public List <IRTreeMember <IEntity> > GetImmidiateChildren(IRTreeMember <IEntity> rTreeMember)
 {
     return(DS.EntityTree.Get_Immidiate_Children(rTreeMember));
 }
示例#20
0
 public List <IRTreeMember <IEntity> > GetAllChildren(IRTreeMember <IEntity> rTreeMember)
 {
     return(DS.EntityTree.Get_All_Children(rTreeMember));
 }
示例#21
0
 public void AddChild(IRTreeMember <IEntity> Parent, IRTreeMember <IEntity> Child)
 {
     DS.EntityTree.AddChild(Parent, Child);
 }
示例#22
0
 public AlterEntityRelationshipContainer(RelationshipChangeType relationshipChangeType, IRTreeMember <IEntity> Parent, IRTreeMember <IEntity> Target)
 {
     RCT    = relationshipChangeType;
     parent = Parent;
     target = Target;
 }
示例#23
0
 public OrganizationTreeItemViewModel CreateOrganizationViewModel(IRTreeMember <IEntity> parent, IRTreeMember <IEntity> target)
 {
     return(new OrganizationTreeItemViewModel(parent, target, this, EA));
 }
示例#24
0
 void DataLoadSuccessEventExecute(IRTreeMember <IEntity> paramater)
 {
     RaisePropertyChanged("Filename");
 }
示例#25
0
 public CharacterTreeItemViewModel CreateCharacterViewModel(IRTreeMember <IEntity> parent, IRTreeMember <IEntity> target)
 {
     return(new CharacterTreeItemViewModel(parent, target, EA));
 }
示例#26
0
 public void RemoveChild(IRTreeMember <T> Parent, IRTreeMember <T> Child)
 {
     Parent.RemoveChild(Child.Gid);
     Child.RemoveParent(Parent.Gid);
 }