示例#1
0
 private void ReprecateMenuToTree(TreeNodeCollection collection, CustomToolStripMenuItem menu)
 {
     if (menu.IsFolder)
     {
         var treeNode = new CustomTreeNode(menu.CustomToolTipText, menu.Text);
         this.AddFolder(collection, treeNode);
         foreach (CustomToolStripMenuItem childMenu in menu.DropDownItems)
         {
             ReprecateMenuToTree(treeNode.Nodes, childMenu);
         }
     }
     else
     {
         var treeNode = new CustomTreeNode(menu.Dumper, menu.Text);
         this.AddFlow(collection, treeNode);
         if (menu.DropDownItems.Count > 0)
         {
             foreach (CustomToolStripMenuItem childMenu in menu.DropDownItems)
             {
                 var childNode = new CustomTreeNode(childMenu.Dumper, childMenu.Text);
                 this.AddFlow(treeNode.Nodes, childNode);
             }
         }
     }
 }
示例#2
0
 private void AddFolder(TreeNodeCollection collection, CustomTreeNode node)
 {
     node.Name             = node.Text;
     node.ImageKey         = folderKey;
     node.SelectedImageKey = folderKey;
     collection.Add(node);
 }
示例#3
0
 private void AddFlow(TreeNodeCollection collection, CustomTreeNode node)
 {
     node.Name             = node.Text;
     node.ImageKey         = flowSourceKey;
     node.SelectedImageKey = flowSourceKey;
     collection.Add(node);
 }
示例#4
0
        public override object Clone()
        {
            CustomTreeNode ret = Dumper == null ? new CustomTreeNode(CustomToolTipText, Text) : new CustomTreeNode(Dumper, Text);

            ret.Name = Name;
            return(ret);
        }
示例#5
0
        protected CustomTreeNode(SerializationInfo info, StreamingContext context)
        {
            var address = (IntPtr)info.GetValue("dataAddress", typeof(IntPtr));
            var handle  = GCHandle.FromIntPtr(address);

            Data = (CustomTreeNode)handle.Target;
            handle.Free();
        }
示例#6
0
        private bool IsFilteredNode(CustomTreeNode node, NodeFilterInfoBase filter)
        {
            if (node.Dumper == null)
            {
                return(true);
            }

            return(!filter.IsHide(node.Dumper));
        }
示例#7
0
 void areaControl_Drop(object sender, System.Windows.DragEventArgs e)
 {
     if (e.Data.GetDataPresent(typeof(CustomTreeNode)) && !(e.Data.GetData(typeof(CustomTreeNode)) as CustomTreeNode).Data.IsFolder)
     {
         CustomTreeNode treeNode = (e.Data.GetData(typeof(CustomTreeNode)) as CustomTreeNode).Data;
         var            p        = e.GetPosition(areaControl);
         AddSource(treeNode.Dumper, p.X, p.Y);
     }
 }
示例#8
0
        private void treeView1_MouseMove(object sender, MouseEventArgs e)
        {
            var node = treeView1.GetNodeAt(new Point(e.X, e.Y)) as CustomTreeNode;

            if (node != lastHoverNode)
            {
                HideToolTip();
                timer.Stop();
                timer.Start();
                lastHoverNode = node;
            }
        }
示例#9
0
        private bool IsFilteredNode(CustomTreeNode node, string filter)
        {
            if (node.Text.ToLower().Contains(filter))
            {
                return(true);
            }

            var customTreeNode = node as CustomTreeNode;

            if (customTreeNode == null || customTreeNode.Dumper == null)
            {
                return(false);
            }

            foreach (var item in customTreeNode.Dumper.InEvents.Concat(customTreeNode.Dumper.OutEvents).Concat(
                         customTreeNode.Dumper.InProperties).Concat(customTreeNode.Dumper.OutProperties))
            {
                if (item.Name.ToLower().Contains(filter))
                {
                    return(true);
                }
            }
            return(false);
        }