Ejemplo n.º 1
0
        public InventoryTreeList(WTTreeView tree, InventoryList ilist)
        {
            this.Unsorted         = ilist;
            this.Sorted           = new List <InventoryEntry>();
            this.Tree             = tree;
            this.NavigationLayers = 1;

            Unsorted.EntryAdd          += OnEntryAdd;
            Unsorted.EntryRemove       += OnEntryRemove;
            Unsorted.EntryRemoveNode   += OnEntryRemoveNode;
            Unsorted.ListReload        += OnListReload;
            Unsorted.NameFormatChanged += OnNameFormatChanged;
            Unsorted.TreeThemeChanged  += OnTreeThemeChanged;
            //Unsorted.NavigationDepthChanged += OnNavigationDepthChanged;
            //Unsorted.SortModeChanged += OnSortModeChanged;
        }
Ejemplo n.º 2
0
        public static TreeNodeAdv FindFirstNodeByTag(this WTTreeView tree, object searchTag, bool searchChildren)
        {
            TreeNodeAdv root = tree.Root;

            if (root.Children.Count == 0)
            {
                return(null);
            }

            TreeNodeAdv node = root.Children[0];

            while (node != null)
            {
                Node data = node.Tag as Node;

                // Check this node
                if (data.Tag.Equals(searchTag))
                {
                    return(node);
                }

                // Select the next node
                if ((searchChildren == true) && (node.Children.Count > 0))
                {
                    node = node.Children[0];        // First child node
                }
                else
                {
                    while (node.NextNode == null)
                    {
                        // No more siblings, so back to the parent
                        node = node.Parent;
                        if (node == root)
                        {
                            return(null);
                        }
                    }
                    node = node.NextNode;           // Next sibling node
                }
            }
            return(null);
        }
Ejemplo n.º 3
0
        public static IEnumerable <TreeNodeAdv> FindNodes(this WTTreeView tree, string searchText, bool searchChildren)
        {
            TreeNodeAdv root = tree.Root;

            if (root.Children.Count == 0)
            {
                yield break;
            }

            TreeNodeAdv node = root.Children[0];

            while (node != null)
            {
                Node data = node.Tag as Node;

                // Check this node
                if (data.Text == searchText)
                {
                    yield return(node);
                }

                // Select the next node
                if ((searchChildren == true) && (node.Children.Count > 0))
                {
                    node = node.Children[0];        // First child node
                }
                else
                {
                    while (node.NextNode == null)
                    {
                        // No more siblings, so back to the parent
                        node = node.Parent;
                        if (node == root)
                        {
                            yield break;
                        }
                    }
                    node = node.NextNode;           // Next sibling node
                }
            }
        }
Ejemplo n.º 4
0
        public static TreeNodeAdv FindFirstNode(this WTTreeView tree, string searchText, bool searchChildren)
        {
            TreeNodeAdv root = tree.Root;

            return(FindFirstNode(root, searchText, searchChildren));
        }
Ejemplo n.º 5
0
 public static void Clear(this WTTreeView tree)
 {
     (tree.Model as TreeModel).Nodes.Clear();
 }