public void Undo(UcTreeDesigner designer) { //Reset the Positions: _mergedNode.includedNodes .ForEach(n => n.PosX -= _mergedNode.PosX) .ForEach(n => n.PosY -= _mergedNode.PosY) .ForEach(n => designer.RemoveNode(n)); //Re-Apply the Inputs: foreach (var node in _mergedNode.includedNodes) { _newConnections .Where(c => c.InputNode == node) .ForEach(c => node.SetInput(c.InputIndex, c.OutputNode)); } //Finally Readd the node: designer.AddNode(_mergedNode); //Reapply all connections outside of the Node: _newConnections .Where(c => !_mergedNode.includedNodes.Contains(c.InputNode)) .Select(c => new Connection(_mergedNode, c.InputNode, c.InputIndex)) .ForEach(designer.AddConnection); _newConnections .Where(c => !_mergedNode.includedNodes.Contains(c.OutputNode)) .Select(c => new Connection(c.OutputNode, _mergedNode, c.InputIndex)) .ForEach(designer.AddConnection); }
public void Redo(UcTreeDesigner designer) { //Reset the Positions: _mergedNode.includedNodes .ForEach(n => n.PosX -= _mergedNode.PosX) .ForEach(n => n.PosY -= _mergedNode.PosY) .ForEach(n => designer.RemoveNode(n)); //Re-Apply the Inputs: foreach (var node in _mergedNode.includedNodes) { _connectionsAfterUnmerge .Where(c => c.InputNode == node) .ForEach(c => node.SetInput(c.InputIndex, c.OutputNode)); } //Finally Readd the node: designer.AddNode(_mergedNode); //Readd connections from outside the Bundle: _oldConnections.ForEach(designer.AddConnection); }
public void Redo(UcTreeDesigner designer) { nodes.ForEach(n => designer.AddNode(n)); }
public void Undo(UcTreeDesigner designer) { nodes.ForEach(n => designer.AddNode(n)); connections.ForEach(c => designer.AddConnection(c)); }