public static NodeBase AddChildTransactional(this NodeBase node) { if (node?.Document != null) { var command = new InsertChildCommand(node, null, NodeSide.Auto); var tansactionName = LocalizationManager.GetString("TransactionName_AddChild"); node.Document.MakeTransaction(tansactionName, commands => { commands.Apply(command); }); command.Child.Select(); return(command.Child); } return(null); }
public static NodeBase AddSibilingTransactional(this NodeBase node) { var selectedNormalNode = node as Node; if (selectedNormalNode?.Document != null) { var command = new InsertChildCommand(selectedNormalNode.Parent, null, selectedNormalNode.NodeSide); var tansactionName = LocalizationManager.GetString("TransactionName_AddSibling"); selectedNormalNode.Document.MakeTransaction(tansactionName, commands => { commands.Apply(command); }); command.Child.Select(); return(command.Child); } return(null); }