Example #1
0
        public void AddNode(UITreeViewEntity item)
        {
            List <string> paths = new List <string>(Regex.Split(@item.GetPath(), @"\\"));

            if (TreeNodeLevel > paths.Count - 1)
            {
                return;
            }
            string id    = paths[TreeNodeLevel];
            bool   found = false;

            foreach (var p in TaskCollection)
            {
                if (p.ToString() == id)
                {
                    found = true;
                    p.AddNode(item);
                    return;
                }
            }
            if (!found)
            {
                UITreeViewEntity addItem = item.GetParentItemByLevel(TreeNodeLevel + 1);
                //item.Parent = addItem ;
                TaskCollection.Add(addItem);
                this.OnPropertyChanged("HasChildNodes");
            }
        }
Example #2
0
 public UITreeViewEntity FindChildNode(int taskID, int objectID)
 {
     if (TaskID == taskID && ObjectID == objectID)
     {
         return(this);
     }
     else
     {
         foreach (var p in TaskCollection)
         {
             if (p.TaskID == taskID && p.ObjectID == objectID)
             {
                 return(p);
             }
             {
                 foreach (var x in p.TaskCollection)
                 {
                     UITreeViewEntity returnObject = p.FindChildNode(taskID, objectID);
                     if (returnObject != null)
                     {
                         return(returnObject);
                     }
                 }
             }
         }
     }
     return(null);
 }
Example #3
0
 public UITreeViewEntity(string name, string image, int ID, int objectID, UITreeViewEntity parent)
 {
     TaskName       = name;
     Image          = image;
     TaskID         = ID;
     ObjectID       = objectID;
     Parent         = parent;
     TaskCollection = new ObservableCollection <UITreeViewEntity>();
 }
Example #4
0
        public UITreeViewEntity GetParentChildItem(int taskID, int objectID)
        {
            UITreeViewEntity returnObject = GetParentItem(taskID);

            if (returnObject == null)
            {
                return(null);
            }
            return(returnObject.TaskCollection.Where(p => p.ObjectID == objectID).FirstOrDefault());
        }
Example #5
0
        private UITreeViewEntity GetParentItemByLevel(int levelID, UITreeViewEntity item)
        {
            UITreeViewEntity returnObject = null;

            if (item.TreeNodeLevel == (int)levelID)
            {
                returnObject = item;
            }
            else
            {
                if (item.Parent != null)
                {
                    returnObject = GetParentItem(levelID, item.Parent);
                }
            }
            return(returnObject);
        }
Example #6
0
        public UITreeViewEntity GetParentItemByLevel(int levelID)
        {
            UITreeViewEntity returnObject = null;

            if (TreeNodeLevel == (int)levelID)
            {
                returnObject = this;
            }
            else
            {
                if (Parent != null)
                {
                    returnObject = GetParentItemByLevel(levelID, Parent);
                }
            }
            return(returnObject);
        }
Example #7
0
        private UITreeViewEntity GetParentItem(int taskID, UITreeViewEntity item)
        {
            UITreeViewEntity returnObject = null;

            if (item.TaskID == (int)taskID)
            {
                returnObject = item;
            }
            else
            {
                if (item.Parent != null)
                {
                    returnObject = GetParentItem(taskID, item.Parent);
                }
            }
            return(returnObject);
        }
Example #8
0
        public UITreeViewEntity GetParentItem(int taskID)
        {
            UITreeViewEntity returnObject = null;

            if (TaskID == (int)taskID)
            {
                returnObject = this;
            }
            else
            {
                if (Parent != null)
                {
                    returnObject = Parent.GetParentItem(taskID);
                }
            }
            return(returnObject);
        }
Example #9
0
        private int GetParentObjectID(int taskID, UITreeViewEntity item)
        {
            int objectID = 0;

            if (item.TaskID == (int)taskID)
            {
                objectID = item.ObjectID;
            }
            else
            {
                if (item.Parent != null)
                {
                    objectID = GetParentObjectID(taskID, item.Parent);
                }
            }
            return(objectID);
        }
Example #10
0
        public UITreeViewEntity GetNetParentItem(int taskID, int objectID)
        {
            UITreeViewEntity returnObject = GetParentItemByLevel(0);

            if (returnObject.TaskID == taskID && returnObject.ObjectID == objectID)
            {
                return(returnObject);
            }
            else
            {
                foreach (var p in returnObject.TaskCollection)
                {
                    returnObject = p.FindChildNode(taskID, objectID);
                    if (returnObject != null)
                    {
                        return(returnObject);
                    }
                }
            }
            return(null);
        }