Exemple #1
0
        // <summary>
        // Method for copying "virtual" tree branch; called recursively
        // </summary>
        private void CopyVirtualBranch(MyTreeNode start, FolderInventoryNode root)
        {
            start.virtualNode = root;
            if (root.Items.Count > 0)
            {
                IOrderedEnumerable <FolderInventoryNode> items;
                if (_current_sort_order == SortOrder.Alpha)
                {
                    items = (IOrderedEnumerable <FolderInventoryNode>)root.Items.OrderBy(t => t.Name);
                }
                else
                {
                    items = (IOrderedEnumerable <FolderInventoryNode>)root.Items.OrderByDescending(t => t.TotalWeight);
                }

                foreach (FolderInventoryNode item in items)
                {
                    MyTreeNode treenode = new MyTreeNode(item.ToString(_active_measure_unit, _LocRM));
                    treenode.BackColor = item.GetColorByDirInfo(treenode.ForeColor);
                    start.Nodes.Add(treenode);

                    CopyVirtualBranch(treenode, item);
                }
            }
        }
Exemple #2
0
        private void UpdateAllVisibleTreeNodes(MyTreeNode root)
        {
            if (root == null)
            {
                return;
            }
            if (root.virtualNode != null)
            {
                root.Text = root.virtualNode.ToString(_active_measure_unit, _LocRM);
            }

            foreach (MyTreeNode node in root.Nodes)
            {
                UpdateAllVisibleTreeNodes(node);
            }
        }
Exemple #3
0
        // <summary>
        // Method for rebuilding TreeView by already built "virtual" Tree
        // </summary>
        public void RepopulateTreeView()
        {
            FolderInventoryNode internal_root = _folder_inventory.Root;

            if (internal_root == null)
            {
                return;
            }
            string     path  = internal_root.Name;
            MyTreeNode start = new MyTreeNode(path);

            tvInventory.Nodes.Clear();

            tvInventory.Nodes.Add(start);

            CopyVirtualBranch(start, internal_root);
            start.Text = internal_root.ToString(_active_measure_unit, _LocRM);
        }
Exemple #4
0
        // <summary>
        // Method for rebuilding TreeView by already built "virtual" Tree
        // </summary>
        public void RepopulateTreeView()
        {
            FolderInventoryNode internal_root = _folder_inventory.Root;
            if (internal_root == null) { return; }
            string path = internal_root.Name;
            MyTreeNode start = new MyTreeNode(path);
            tvInventory.Nodes.Clear();

            tvInventory.Nodes.Add(start);

            CopyVirtualBranch(start, internal_root);
            start.Text = internal_root.ToString(_active_measure_unit, _LocRM);
        }
Exemple #5
0
        private void UpdateAllVisibleTreeNodes(MyTreeNode root)
        {
            if (root == null) { return; }
            if (root.virtualNode != null)
            {
              root.Text = root.virtualNode.ToString(_active_measure_unit, _LocRM);
            }

            foreach (MyTreeNode node in root.Nodes)
            {
                UpdateAllVisibleTreeNodes(node);
            }
        }
Exemple #6
0
        // <summary>
        // Method for copying "virtual" tree branch; called recursively
        // </summary>
        private void CopyVirtualBranch(MyTreeNode start, FolderInventoryNode root)
        {
            start.virtualNode = root;
            if (root.Items.Count > 0)
            {
                IOrderedEnumerable<FolderInventoryNode> items;
                if (_current_sort_order == SortOrder.Alpha)
                {
                    items = (IOrderedEnumerable<FolderInventoryNode>)root.Items.OrderBy(t => t.Name);
                }
                else
                {
                    items = (IOrderedEnumerable<FolderInventoryNode>)root.Items.OrderByDescending(t => t.TotalWeight);
                }

                foreach (FolderInventoryNode item in items)
                {
                    MyTreeNode treenode = new MyTreeNode(item.ToString(_active_measure_unit, _LocRM));
                    treenode.BackColor = item.GetColorByDirInfo(treenode.ForeColor);
                    start.Nodes.Add(treenode);

                    CopyVirtualBranch(treenode, item);
                }
            }
        }