/// <summary> /// Called by the base ConnectAction class to create the underlying relationship. /// </summary> /// <remarks> /// This implementation delegates calls to the ConnectionBuilder SocketUseReferencesSocketBuilder. /// </remarks> public override void CreateConnection(DslDiagrams::ShapeElement sourceShapeElement, DslDiagrams::ShapeElement targetShapeElement, DslDiagrams::PaintFeedbackArgs paintFeedbackArgs) { if (sourceShapeElement == null) { throw new global::System.ArgumentNullException("sourceShapeElement"); } if (targetShapeElement == null) { throw new global::System.ArgumentNullException("targetShapeElement"); } sourceShapeElement = RemovePassThroughShapes(sourceShapeElement); targetShapeElement = RemovePassThroughShapes(targetShapeElement); DslModeling::ModelElement sourceElement = sourceShapeElement.ModelElement; if (sourceElement == null) { sourceElement = sourceShapeElement; } DslModeling::ModelElement targetElement = targetShapeElement.ModelElement; if (targetElement == null) { targetElement = targetShapeElement; } // You will need to implement a method with the following signature: // public static void Connect(DslModeling::ModelElement sourceElement, DslModeling::ModelElement targetElement) // { // } // in a partial class of SocketUseReferencesSocketBuilder. SocketUseReferencesSocketBuilder.Connect(sourceElement, targetElement); }
/// <summary> /// Called by the base ConnectAction class to determine if the given shapes can be connected. /// </summary> /// <remarks> /// This implementation delegates calls to the ConnectionBuilder SocketUseReferencesSocketBuilder. /// </remarks> public override bool CanCreateConnection(DslDiagrams::ShapeElement sourceShapeElement, DslDiagrams::ShapeElement targetShapeElement, ref string connectionWarning) { bool canConnect = true; if (sourceShapeElement == null) { throw new global::System.ArgumentNullException("sourceShapeElement"); } sourceShapeElement = RemovePassThroughShapes(sourceShapeElement); DslModeling::ModelElement sourceElement = sourceShapeElement.ModelElement; if (sourceElement == null) { sourceElement = sourceShapeElement; } DslModeling::ModelElement targetElement = null; if (targetShapeElement != null) { targetShapeElement = RemovePassThroughShapes(targetShapeElement); targetElement = targetShapeElement.ModelElement; if (targetElement == null) { targetElement = targetShapeElement; } } // base.CanCreateConnection must be called to check whether existing Locks prevent this link from getting created. canConnect = base.CanCreateConnection(sourceShapeElement, targetShapeElement, ref connectionWarning); if (canConnect) { if (targetShapeElement == null) { // You will need to implement a method with the following signature: // public static bool CanAcceptSource(DslModeling::ModelElement sourceElement) // { // } // in a partial class of SocketUseReferencesSocketBuilder. return(SocketUseReferencesSocketBuilder.CanAcceptSource(sourceElement)); } else { // You will need to implement a method with the following signature: // public static bool CanAcceptSourceAndTarget(DslModeling::ModelElement sourceElement, DslModeling::ModelElement targetElement) // { // } // in a partial class of SocketUseReferencesSocketBuilder. return(SocketUseReferencesSocketBuilder.CanAcceptSourceAndTarget(sourceElement, targetElement)); } } else { //return false return(canConnect); } }