Beispiel #1
0
        public TreeNodeBase(string name, BaseObject baseObject, bool canBeDeleted, bool canBeRenamed, string typeName, long size, DateTime date, bool hasProperties, bool canContainDisk, bool canContainBox, bool canContainCategory, bool canContainImage)
            : base(name)
        {
            Debug.Assert(null != baseObject);

            this.baseObject = baseObject;
            this.canBeDeleted = canBeDeleted;
            this.canBeRenamed = canBeRenamed;
            this.typeName = typeName;
            this.date = date;
            this.size = size;
            this.hasProperties = hasProperties;
            this.canContainBox = canContainBox;
            this.canContainDisk = canContainDisk;
            this.canContainCategory = canContainCategory;
            this.canContainImage = canContainImage;
        }
Beispiel #2
0
        private void SetItem(DisksDB.DataBase.BaseObject item)
        {
            if (this.activeItem != item)
            {
                if (null != this.activeItem)
                {
                    this.activeItem.NameChanged -= new EventHandler(ItemNameChanged);
                }

                this.activeItem = item;

                item.NameChanged += new EventHandler(ItemNameChanged);
            }
        }
Beispiel #3
0
        private void RemoveItem(TreeNodeCollection lst, BaseObject obj)
        {
            LoadTreeNodeChilds();

            if (obj is DisksDB.DataBase.Image)
            {
                DisksDB.DataBase.Image img = (DisksDB.DataBase.Image)obj;

                for (int i = 0; i < lst.Count; i++)
                {
                    if (lst[i] is TreeNodeImage)
                    {
                        TreeNodeImage ti = (TreeNodeImage)lst[i];

                        if (ti.InternalImage == img)
                        {
                            lst.RemoveAt(i);
                            return;
                        }
                    }
                }
            }
        }
Beispiel #4
0
 private void ChildItemRemoved(BaseObject item)
 {
     this.TreeView.Invoke(new EventHandlerNodesUpdated(RemoveItem), new object[] { this.Nodes, item } );
 }
Beispiel #5
0
        private void AddItem(TreeNodeCollection lst, BaseObject obj)
        {
            LoadTreeNodeChilds();

            if (obj is DisksDB.DataBase.Image)
            {
                DisksDB.DataBase.Image img = (DisksDB.DataBase.Image)obj;

                int pos = 0;

                for (pos = 0; (pos < lst.Count) && (lst[pos] is TreeNodeImage); pos++)
                {
                    TreeNodeImage ti = (TreeNodeImage)lst[pos];

                    if (ti.InternalImage.Name.CompareTo(img.Name) >= 0)
                    {
                        lst.Insert(pos, new TreeNodeImage(img, this.imgFact));
                        return;
                    }
                }

                lst.Insert(pos, new TreeNodeImage(img, this.imgFact));
            }
        }
Beispiel #6
0
 internal virtual void Remove(BaseObject child)
 {
     OnChildRemoved(child);
 }
Beispiel #7
0
        protected internal void OnChildRemoved(BaseObject removedItem)
        {
            if (null != this.ChildItemRemoved)
            {
                this.ChildItemRemoved(removedItem);
            }

            OnChildsChanged();
        }
Beispiel #8
0
        protected internal void OnChildAdded(BaseObject newItem)
        {
            if (null != this.ChildItemAdded)
            {
                this.ChildItemAdded(newItem);
            }

            OnChildsChanged();
        }
Beispiel #9
0
        private void RemoveItem(TreeNodeCollection lst, BaseObject obj)
        {
            LoadTreeNodeChilds();

            if (obj is DataBase.Category)
            {
                DataBase.Category c = (DataBase.Category) obj;

                for (int i = 0; i < lst.Count; i++)
                {
                    if (lst[i] is TreeNodeCategory)
                    {
                        TreeNodeCategory cc = (TreeNodeCategory) lst[i];

                        if (cc.cat == c)
                        {
                            lst.RemoveAt(i);
                            return;
                        }
                    }
                }
            }
            else if (obj is DataBase.Box)
            {
                DataBase.Box b = (DataBase.Box) obj;

                for (int i = 0; i < lst.Count; i++)
                {
                    if (lst[i] is TreeNodeBox)
                    {
                        TreeNodeBox bb = (TreeNodeBox) lst[i];

                        if (bb.InternalBox == b)
                        {
                            lst.Remove(bb);
                            return;
                        }
                    }
                }
            }
        }
Beispiel #10
0
 private void ChildItemRemoved(BaseObject item)
 {
     if (true == this.cat.IsRoot)
     {
         this.trv.Invoke(new EventHandlerNodesUpdated(RemoveItem), new object[] {this.trv.Nodes, item});
     }
     else
     {
         this.TreeView.Invoke(new EventHandlerNodesUpdated(RemoveItem), new object[] {this.Nodes, item});
     }
 }
Beispiel #11
0
        private void AddItem(TreeNodeCollection lst, BaseObject obj)
        {
            LoadTreeNodeChilds();

            if (obj is DataBase.Category)
            {
                DataBase.Category c = (DataBase.Category) obj;

                int pos = 0;

                for (pos = 0; (pos < lst.Count) && (lst[pos] is TreeNodeCategory); pos++)
                {
                    TreeNodeCategory cc = (TreeNodeCategory) lst[pos];

                    if (cc.cat.Name.CompareTo(c.Name) >= 0)
                    {
                        lst.Insert(pos, new TreeNodeCategory(this.db, c, this.trv));
                        return;
                    }
                }

                lst.Insert(pos, new TreeNodeCategory(this.db, c, this.trv));
            }
            else if (obj is DataBase.Box)
            {
                DataBase.Box b = (DataBase.Box) obj;

                int pos = 0;

                for (pos = 0; pos < lst.Count; pos++)
                {
                    if (lst[pos] is TreeNodeBox)
                    {
                        TreeNodeBox bb = (TreeNodeBox) lst[pos];

                        if (bb.InternalBox.Name.CompareTo(b.Name) >= 0)
                        {
                            lst.Insert(pos, new TreeNodeBox(this.db, b, this.trv));
                            return;
                        }
                    }
                }

                lst.Insert(pos, new TreeNodeBox(this.db, b, this.trv));
            }
        }
Beispiel #12
0
        private void RemoveItem(TreeNodeCollection lst, BaseObject obj)
        {
            LoadTreeNodeChilds();

            if (obj is DisksDB.DataBase.Disk)
            {
                DisksDB.DataBase.Disk d = (DisksDB.DataBase.Disk)obj;

                for (int i = 0; i < lst.Count; i++)
                {
                    if (lst[i] is TreeNodeDisk)
                    {
                        TreeNodeDisk dd = (TreeNodeDisk)lst[i];

                        if (dd.InternalDisk == d)
                        {
                            lst.RemoveAt(i);
                            return;
                        }
                    }
                }
            }
        }
Beispiel #13
0
 private void ChildItemAdded(BaseObject item)
 {
     this.TreeView.Invoke(new EventHandlerNodesUpdated(AddItem), new object[] { this.Nodes, item } );
     //AddItem(this.Nodes, item);
 }
Beispiel #14
0
        private void AddItem(TreeNodeCollection lst, BaseObject obj)
        {
            LoadTreeNodeChilds();

            if (obj is DisksDB.DataBase.Disk)
            {
                DisksDB.DataBase.Disk d = (DisksDB.DataBase.Disk)obj;

                int pos = 0;

                for (pos = 0; (pos < lst.Count) && (lst[pos] is TreeNodeDisk); pos++)
                {
                    TreeNodeDisk dd = (TreeNodeDisk)lst[pos];

                    if (dd.InternalDisk.Name.CompareTo(d.Name) >= 0)
                    {
                        lst.Insert(pos, new TreeNodeDisk(d, this.db));
                        return;
                    }
                }

                lst.Insert(pos, new TreeNodeDisk(d, this.db));
            }
        }