private void GenerateTree(SmartMenuItemCollection collection)
        {
            //Collection = new SmartMenuItemCollection(collection.Owner, collection.ItemType);
            Collection = collection;
            foreach (SmartMenuItem item in collection)
            {
                if (item.Parent == null || item.Parent == "")
                    RootMenus.Add(item);
                else
                    ChildMenus.Add(item);
            }

            foreach (SmartMenuItem item in RootMenus)
            {
                TreeNode node = new TreeNode();
                node.Text = item.Ind;
                node.Name = item.MenuId;
                List<SmartMenuItem> childMenus = this.GetChildMenus(item);
                if (childMenus.Count > 0)
                {
                    node.Nodes.AddRange(this.GenerateChildTreeNodes(childMenus));
                }
                this.tView.Nodes[0].Nodes.Add(node);
            }
            this.tView.ExpandAll();
        }
Ejemplo n.º 2
0
 public SmartMenu()
 {
     _items = new SmartMenuItemCollection(this, typeof(SmartMenuItem));
 }
 public SmartMenuCollectionEditorDialog(SmartMenuItemCollection collection)
 {
     InitializeComponent();
     GenerateTree(collection);
 }