GoDigram for .NET Framework and .NET Core
Northwoods.Go Namespace / GoToolLinking Class / IsValidLink Method
In This Topic
    IsValidLink Method (GoToolLinking)
    In This Topic
    This predicate is called during the process of finding the nearest port that the user can link to.
    Syntax
    public virtual bool IsValidLink( 
       IGoPort fromPort,
       IGoPort toPort
    )

    Parameters

    fromPort
    toPort

    Return Value

    Basically this is implemented as fromPort.IsValidLink(toPort)
    Remarks

    If both fromPort and toPort are null, this returns false. If only one of the parameters is null, then this returns the value of fromPort.CanLinkFrom() or toPort.CanLinkTo(), on the non-null port parameter. This predicate also disallows interactive linking of a link to a port that is part of the link--e.g. linking to a port that is a label on a GoLabeledLink. The results of these calls are stored in the ValidPortsCache hash table. The ports are associated with Valid or Invalid values depending on whether this predicate returned true or false. Note that to check for links from a port to itself, this predicate may be called with the same value for both arguments.

    GoPort has more options for link validity checking; see IsValidLink for more details. If you override this method, you may well need to do so for both GoToolLinkingNew and GoToolRelinking, and then replace both of the standard linking tools in your GoView by calling GoView.ReplaceMouseTool.

    See Also