I am writing a app which contains a flow diagram and I wish to prevent the user from creating any cyclical dependancies between nodes. To this end I have used the GoDocumentValidCycle property NotDirected which works well. However I wish to inform the user that the reason that they were not allowed to draw the link was because a cyle would have been created. How could I achieve this? - is there an event fired when the link fails to be created? Thus far I have not been able to find one. Any advice would be appreciated.
Sorry, there isn’t any event like GoView.LinkCreated or GoView.LinkRelinked to indicate that no link was drawn or reconnected.
Instead you’ll need to replace the standard linking tools with custom ones that override GoToolLinkingNew.DoNoNewLink and GoToolRelinking.DoNoRelink.
If the mouse was over an invalid port at the time of the mouse-up, that port is passed as one of the argument ports. (Which one depends on the direction of the linking gesture, according to GoToolLinking.Forwards.) Otherwise one of the argument ports will be null, indicating that there were no valid ports nearby.
GoToolLinking.OriginalStartPort will be the other port argument, which is the port at which the linking gesture started.
GoToolRelinking.Link is the link that is being (unsuccessfully) reconnected.
To install your custom tools by replacing the standard ones:
goView1.ReplaceMouseTool(typeof(GoToolLinkingNew), new LinkingNewTool(goView1));