Пример #1
0
 public void Do()
 {
     if (sourceNode != null)
     {
         int             index      = sourceNode.Index;
         QAliberTreeNode parentNode = sourceNode.Parent as QAliberTreeNode;
         if (parentNode != null && parentNode.Nodes.Count > index + 1)
         {
             parentNode.RemoveChild(sourceNode);
             parentNode.InsertChild(index + 1, sourceNode);
         }
         if (treeView != null)
         {
             treeView.cancelMultiSelection = true;
             treeView.SelectedNode         = sourceNode;
             treeView.cancelMultiSelection = false;
         }
         storedNode = new CommandInfo(sourceNode, false);
     }
 }
Пример #2
0
 public void Redo()
 {
     if (storedNode.Indices.Count > 0)
     {
         QAliberTreeNode nodeToFind = treeView.Nodes[storedNode.Indices[0]] as QAliberTreeNode;
         for (int i = 1; i < storedNode.Indices.Count; i++)
         {
             nodeToFind = nodeToFind.Nodes[storedNode.Indices[i]] as QAliberTreeNode;
         }
         if (nodeToFind != null)
         {
             int             index      = nodeToFind.Index;
             QAliberTreeNode parentNode = nodeToFind.Parent as QAliberTreeNode;
             if (parentNode != null && parentNode.Nodes.Count > index + 1)
             {
                 parentNode.RemoveChild(nodeToFind);
                 parentNode.InsertChild(index + 1, nodeToFind);
             }
         }
         storedNode = new CommandInfo(nodeToFind, false);
     }
 }