public void Undo() { if (node.Selected = true && node.Tree.SelectedNodes.Count == 1) { MapNode nextSelection = node.Tree.GetClosestUnselectedNode(node); node.Tree.SelectedNodes.Add(nextSelection); } node.DeleteNode(); }
/// <summary> /// This method is only for ending inline textbox editing (usually used for short nodes i.e. single line) /// </summary> /// <param name="node"></param> /// <param name="updateNode"></param> public void EndNodeEdit(bool updateNode, bool focusMap) { MapNode node = (MapNode)this.editBox.Tag; if (node == null) { return; } if (updateNode && editBox.CanUndo) { UpdateNodeText(node, this.editBox.Text); mapView.AdjustLocationToShowNodeView(node.NodeView); } else if (!updateNode && node.IsEmpty()) { node.Tree.GetClosestUnselectedNode(node).Selected = true; node.DeleteNode(); } else { ResetNodeTextSize(node.NodeView); } this.IsTextEditing = false; this.editBox.Text = null; this.editBox.Tag = null; // ensures that Lost Focus event doesn't call stopNodeEdit again as control is made unvisible this.editBox.Visible = false; if (focusMap) { mapView.Canvas.Focus(); } }