/// <inheritdoc/> public Action Execute(object parameter) { if (parameter is TerminalModel toTerminal) { var wire = new WireModel(); _fromTerminal.ConnectWire(wire, toTerminal); var wireViewModel = new Wire(wire, new WirePathingAlgorithum()) { DoAnimationWhenViewIsLoaded = _animateWireWhenLoaded, }; _diagram.AddWire(wireViewModel); return(() => { _fromTerminal.DisconnectWire(wire, toTerminal); _diagram.RemoveWire(wireViewModel); }); } return(() => { }); }
/// <inheritdoc/> public Action Execute(object parameter) { if (parameter is WireModel wire && wire.SourceTerminal != null && wire.SinkTerminal != null) { if (wire.SourceTerminal != null && wire.SinkTerminal != null) { var sourceTerminal = wire.SourceTerminal; var sinkTerminal = wire.SinkTerminal; sourceTerminal.DisconnectWire(wire, sinkTerminal); _diagram.RemoveWire(wire); return(() => { sourceTerminal.ConnectWire(wire, sinkTerminal); _diagram.AddWire(wire); }); } _diagram.RemoveWire(wire); } return(() => { }); }