/// <summary> /// Sets input and output PinTarget for this connection</summary> public void SetPinTarget() { if (InputPin != null) { bool isInputElementRef = InputElement.DomNode.Is <IReference <DomNode> >(); if (InputPin.Is <GroupPin>()) { if (isInputElementRef) { var pinTarget = InputPin.Cast <GroupPin>().PinTarget; InputPinTarget = new PinTarget(pinTarget.LeafDomNode, pinTarget.LeafPinIndex, InputElement.DomNode); } else { InputPinTarget = InputPin.Cast <GroupPin>().PinTarget; } } else { if (isInputElementRef) { var reference = InputElement.As <IReference <DomNode> >(); InputPinTarget = new PinTarget(reference.Target, InputPin.Index, InputElement.DomNode); } else { InputPinTarget = new PinTarget(InputElement.DomNode, InputPin.Index, null); } } Debug.Assert(InputPinTarget != null, "sanity check"); } if (OutputPin != null) { bool isOutputElementRef = OutputElement.DomNode.Is <IReference <DomNode> >(); if (OutputPin.Is <GroupPin>()) { if (isOutputElementRef) { var pinTarget = OutputPin.Cast <GroupPin>().PinTarget; OutputPinTarget = new PinTarget(pinTarget.LeafDomNode, pinTarget.LeafPinIndex, OutputElement.DomNode); } else { OutputPinTarget = OutputPin.Cast <GroupPin>().PinTarget; } } else { if (isOutputElementRef) { var reference = OutputElement.Cast <IReference <DomNode> >(); OutputPinTarget = new PinTarget(reference.Target, OutputPin.Index, OutputElement.DomNode); } else { OutputPinTarget = new PinTarget(OutputElement.DomNode, OutputPin.Index, null); } } Debug.Assert(OutputPinTarget != null, "sanity check"); } }