예제 #1
0
        void FTreeViewMouseMove(object sender, MouseEventArgs e)
        {
            if (!ShowTooltip)
            {
                return;
            }

            var treeNode = FTreeView.GetNodeAt(e.Location) as MapperTreeNode;

            if (treeNode != FLastTooltipNode)
            {
                InvalidateTreeNode(FLastTooltipNode);
                FLastTooltipNode = treeNode;
                InvalidateTreeNode(FLastTooltipNode);

                if (treeNode != null)
                {
                    var mapper = treeNode.Mapper;
                    if (mapper.CanMap <IDescripted>())
                    {
                        string tip = mapper.Map <IDescripted>().Description;
                        if (!string.IsNullOrEmpty(tip))
                        {
                            FToolTip.Show(tip, FTreeView, e.X + 15, treeNode.Bounds.Y + 30);
                            return;
                        }
                    }
                }

                HideToolTip();
            }
        }
예제 #2
0
        public override void Reload()
        {
            FTreeView.BeginUpdate();

            if (FRootMapper != null)
            {
                FRootMapper.Dispose();
            }

            FRootMapper = new ModelMapper(Input, Registry);

            if (ShowRoot)
            {
                var rootNode = new MapperTreeNode(FRootMapper);
                rootNode.Expand();
                FTreeView.Nodes.Add(rootNode);
            }
            else
            {
                var items = FRootMapper.Map <IParent>();
                if (FSynchronizer != null)
                {
                    FSynchronizer.Dispose();
                }
                FSynchronizer = FTreeView.Nodes.SyncWith(items.Childs, item => new MapperTreeNode(FRootMapper.CreateChildMapper(item)));
            }

            FTreeView.EndUpdate();
        }
예제 #3
0
        protected MapperTreeNode FindNode(MapperTreeNode parentNode, object tag)
        {
            if (parentNode.Tag == tag)
            {
                return(parentNode);
            }

            foreach (MapperTreeNode node in parentNode)
            {
                var result = FindNode(node, tag);
                if (result != null)
                {
                    return(result);
                }
            }

            return(null);
        }
예제 #4
0
 protected MapperTreeNode CreateTree(MapperTreeNode parentNode, object item)
 {
     return(parentNode.CreateChildNode(item));
 }