private void CallMakePretty() { Tree tree = new Tree(selectedNodes,Lines); Tree wholeTree = new Tree(tree.getWholeTree(),Lines); if (wholeTree.allNodesOneParentAndLessThanThreeChildren()) undoRedo.InsertInUndoRedo(new MakePrettyCommand(Nodes, selectedNodes)); }
private void CallRemoveNodeInTree() { Tree tree = new Tree(selectedNodes,Lines); Tree wholeTree = new Tree(tree.getWholeTree(),Lines); if (selectedNodes == null || selectedNodes.Count != 1) System.Windows.MessageBox.Show("You have to mark excactly one node"); else if (!wholeTree.isValidBST()) System.Windows.MessageBox.Show("This tree is not valid"); else { undoRedo.InsertInUndoRedo(new RemoveNodeInTreeCommand(tree, Nodes, selectedNodes, Lines)); } }