Esempio n. 1
0
        private void AddItemsFor(NTreeViewItemCollection items, NXmlElement element)
        {
            int childCount = element.ChildrenCount;

            for (int i = 0; i < childCount; i++)
            {
                NXmlElement child = element.GetChildAt(i) as NXmlElement;
                if (child == null)
                {
                    continue;
                }

                NTreeViewItem item = CreateTreeViewItem(child);
                if (item != null)
                {
                    items.Add(item);
                    if (item.Tag is NXmlElement == false)
                    {
                        // This is a folder item, so add items for its children, too
                        AddItemsFor(item.Items, child);
                    }
                }
                else
                {
                    AddItemsFor(items, child);
                }
            }
        }
Esempio n. 2
0
            private static NTreeViewItem AddFile(NTreeViewItemCollection items, string name)
            {
                NTreeViewItem item = CreateItem(NResources.Image__16x16_Contacts_png, name);

                items.Add(item);
                return(item);
            }
        private NTreeViewItem GetOrCreateItem(NTreeViewItemCollection items, string name)
        {
            for (int i = 0, count = items.Count; i < count; i++)
            {
                NLabel label = (NLabel)items[i].Header.GetFirstDescendant(NLabel.NLabelSchema);
                if (label.Text == name)
                {
                    return(items[i]);
                }
            }

            NTreeViewItem item = new NTreeViewItem(NPairBox.Create(NResources.Image__16x16_Folders_png, name));

            items.Add(item);
            return(item);
        }