コード例 #1
0
ファイル: ServerTree.cs プロジェクト: xxftapv/RDCMan
 protected override void OnBeforeSelect(TreeViewCancelEventArgs e)
 {
     base.OnBeforeSelect(e);
     if (_noSelectCounter <= 0 && base.SelectedNode != null)
     {
         RdcTreeNode rdcTreeNode = base.SelectedNode as RdcTreeNode;
         ServerBase  serverBase  = rdcTreeNode as ServerBase;
         if (serverBase == null || serverBase.IsClientUndocked || !serverBase.IsClientFullScreen)
         {
             rdcTreeNode.Hide();
         }
     }
 }
コード例 #2
0
ファイル: ServerTree.cs プロジェクト: xxftapv/RDCMan
        public void RemoveNode(RdcTreeNode node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }
            TreeNode           treeNode    = base.SelectedNode;
            TreeNodeCollection parentNodes = (node.Parent != null) ? node.Parent.Nodes : base.Nodes;

            if (treeNode != null)
            {
                bool inSelectedPath = false;
                (treeNode as RdcTreeNode).VisitNodeAndParents(delegate(RdcTreeNode n)
                {
                    if (n == node)
                    {
                        inSelectedPath = true;
                    }
                });
                if (inSelectedPath)
                {
                    (treeNode as RdcTreeNode).Hide();
                    node.Hide();
                    treeNode          = ((node.Index > 0) ? parentNodes[node.Index - 1] : ((node.Index >= parentNodes.Count - 1) ? node.Parent : parentNodes[node.Index + 1]));
                    base.SelectedNode = null;
                }
            }
            Operation(OperationBehavior.RestoreSelected, delegate
            {
                GroupBase groupBase = node.Parent as GroupBase;
                node.OnRemoving();
                parentNodes.Remove(node);
                if (groupBase != null)
                {
                    OnGroupChanged(groupBase, ChangeType.TreeChanged);
                }
            });
            base.SelectedNode = treeNode;
        }