Ejemplo n.º 1
0
        private void AddBaseTier()
        {
            var nodes = new List <INode>();

            nodes.AddRange(fsQuery.GetDescendantNodes("C:\\users\\andrew\\desktop\\folder\\", "*.*"));
            //Node node = new Node("Home","The Home Directory","Whoaa Description","C:\\users\\andrew\\", defaultNodeTheme, new Font("Arial",10),null, true,true);

            // nodes.Add(node);
            var OriginNodeTier = new NodeTier(nodes, 0);

            NodeTiers.Add(OriginNodeTier);
        }
Ejemplo n.º 2
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);
            var node = DetectNode(e.Location);

            if (node != null)
            {
                if (node.State == NodeState.None)
                {
                    // We aren't interested in this node. (Just stating its empty).
                    return;
                }


                if (!node.Equals(hoverNode))
                {
                    if (hoverNode != null)
                    {
                        hoverNode.State = NodeState.Normal;
                        node.State      = NodeState.Hover;
                    }


                    var row      = GetLayerID(node);
                    var diff     = NodeTiers.Count - row;
                    var hoverRow = GetLayerID(hoverNode);

                    if (row == hoverRow)
                    {
                        if (!node.HasDecendants)
                        {
                            NodeTiers = NodeTiers.Take(hoverRow + 1).ToList();
                        }
                        else
                        {
                            NodeTiers = NodeTiers.Take(hoverRow + 1).ToList();
                            var nodeTier =
                                new NodeTier(
                                    node.GenererateChildren(fsQuery, defaultFilter, defaultNodeTheme, defaultFont),
                                    NodeTiers[NodeTiers.Count - 1].LayerID + 1); // Reupdate the last row
                            NodeTiers.Add(nodeTier);
                        }
                    }
                    else
                    {
                        if (diff > 1) // then we are cutting off
                        {
// Progressive prune. WE HAVE ASCENDED
                            NodeTiers = NodeTiers.Take(row + 2).ToList();
                        }
                        else // we are adding on
                        {
                            // WE HAVE DESCENDED
                            var nodeTier =
                                new NodeTier(
                                    node.GenererateChildren(fsQuery, defaultFilter, defaultNodeTheme, defaultFont),
                                    NodeTiers[NodeTiers.Count - 1].LayerID + 1); // Reupdate the last row
                            NodeTiers.Add(nodeTier);
                        }
                    }


                    hoverNode = node;
                    if (HoverPath != null)
                    {
                        HoverPath(node.FileSystemUri);
                    }


                    Invalidate();
                }
            }
        }