Example #1
0
 private void MoveFolderNode(TreeNodeMovePattern move, TreeNode node)
 {
     switch (move)
     {
         case TreeNodeMovePattern.Up:
             int index = node.Index - 1;
             if (0 <= index)
             {
                 MoveNode(index, Nodes, node);
             }
             break;
         case TreeNodeMovePattern.Down:
             index = node.Index + 1;
             if (Nodes.Count - 1 >= index)
             {
                 MoveNode(index, Nodes, node);
             }
             break;
     }
 }
Example #2
0
 private void MovePatternNode(TreeNodeMovePattern move, TreeNode node)
 {
     switch (move)
     {
         case TreeNodeMovePattern.Up:
             int index = node.Index - 1;
             if (0 <= index)
             {
                 MoveNode(index, node.Parent.Nodes, node);
             }
             else if (node.Parent.PrevNode != null)
             {
                 MoveNode(node.Parent.PrevNode.Nodes.Count, node.Parent.PrevNode.Nodes, node);
             }
             break;
         case TreeNodeMovePattern.Down:
             index = node.Index + 1;
             if (node.Parent.Nodes.Count - 1 >= index)
             {
                 MoveNode(index, node.Parent.Nodes, node);
             }
             else if (node.Parent.NextNode != null)
             {
                 MoveNode(0, node.Parent.NextNode.Nodes, node);
             }
             break;
     }
 }
Example #3
0
        public void MoveNode(TreeNodeMovePattern direction)
        {
            if (SelectedNode == null)
            {
                throw new InvalidOperationException("移動対象が選択されていません");
            }
            switch (SelectedNode.Level)
            {
                case FolderLevel:
                    MoveFolderNode(direction, SelectedNode);
                    break;

                case PatternLevel:
                    MovePatternNode(direction, SelectedNode);
                    break;
            }
        }