public virtual void DisconnectWire() { SourceTerminal.PropertyChanged -= SourceTerminalOnPropertyChanged; SinkTerminal.PropertyChanged -= SinkTerminalOnPropertyChanged; SourceTerminal.DisconnectWire(this); SinkTerminal.Data = null; SinkTerminal.DisconnectWire(this); SourceTerminal = null; SinkTerminal = null; }
public Wire(TerminalModel terminal1, TerminalModel terminal2) { IsActive = true; SinkTerminal = terminal1.Kind == TerminalKind.Input ? terminal1 : terminal2; SourceTerminal = terminal1.Kind == TerminalKind.Output ? terminal1 : terminal2;; if (!SourceTerminal.Type.IsSubclassOf(SinkTerminal.Type) && SourceTerminal.Type != SinkTerminal.Type) { return; } SourceTerminal.DisconnectWire(); SinkTerminal.DisconnectWire(); SourceTerminal.ConnectedWire = this; SinkTerminal.ConnectedWire = this; }