Esempio n. 1
0
        public void EnumerateSubitems(TreeItemEnumDelegate itemsEnum, TreeItem <T> startItem)
        {
            LightCollection <string> subitems;

            if (startItem == null)
            {
                subitems = _rootItems;
            }
            else
            {
                subitems = startItem.Subitems.ItemsId;
            }

            for (int i = 0; i < subitems.Count; i++)
            {
                if (itemsEnum != null)
                {
                    TreeItem <T> current = _globalCollection[subitems[i]];
                    itemsEnum(current);
                    EnumerateSubitems(itemsEnum, current);
                }
            }
        }
Esempio n. 2
0
        /*public void AddRootItem(T value)
         * {
         *      string key = _globalCollection.CreateFreeKey();
         *      AddRootItem(key, value);
         * }
         * public void AddRootItem(string id)
         * {
         *      AddRootItem(id, default(T));
         * }
         * public void AddRootItem(string id, T value)
         * {
         *      if(_globalCollection.Contains(id))
         *              throw new Exception("key \""+id+"\" already exist");
         *
         *      TreeCollection<T> _this = this;
         *      TreeItem<T> treeItem = new TreeItem<T>(id, "_root", ref _this);
         *      _globalCollection.Add(id, treeItem);
         *      _globalCollection[id].Value = value;
         *
         *      _rootItems.Add(id);
         *
         * }
         * public bool TryAddRootItem(string id, T value)
         * {
         *      if(_globalCollection.Contains(id))
         *      {
         *              return false;
         *      }
         *
         *      TreeCollection<T> _this = this;
         *      TreeItem<T> treeItem = new TreeItem<T>(id, "_root", ref _this);
         *      _globalCollection.Add(id, treeItem);
         *      _globalCollection[id].Value = value;
         *
         *      _rootItems.Add(id);
         *      return true;
         * }*/

        public void EnumerateSubitems(TreeItemEnumDelegate itemsEnum)
        {
            EnumerateSubitems(itemsEnum, null);
        }