Nevron Forum

NConnectorTool

https://www.nevron.com/Forum/Topic3504.aspx

By Luis Mendes - Tuesday, May 11, 2010

I am trying to create the connection between two vertices. I am listening to the EventSinkService_Connecting and trying to get the connecting nodes out of the NConnectionCancelEventArgs. How can I get the newly create Edge so I can get the From and To nodes?
By Nevron Support - Wednesday, May 12, 2010

Hi Luis,

in the Connecting event you can easily get the ports being connected:

 

NPort port1 = (NPort)document.GetElementFromUniqueId(args.UniqueId1);

NPort port2 = (NPort)document.GetElementFromUniqueId(args.UniqueId2);

 

Next you can use the Shape property of the port to get the shape.

By Luis Mendes - Wednesday, May 12, 2010

Thank you, I am almost there. Now that I have the two nodes, I can do my logic and if it doesn't pass I need to cancel the connection. However, when I set the args.Cancel = true, the Connected event doesn't get fired, great, but the line still draws on the document. How can I tell the I try to call Abort and Disactivate on the connector but it didn't work. Thanks much!!!
By Luis Mendes - Wednesday, May 12, 2010

Nevermind, I found a work around