I’m trying to keep all my node and link change handling in one location, in View.OnDocumentchanged. Works great for node creation/deleation and link creation/deleation, using:
e.Hint == GoLayer.RemovedObject
e.Hint == GoLayer.InsertedObject
I also want to treat re-linking as a link deleate and link add. I've tried using:
e.Hint == GoDocument.ChangedObject
e.SubHint == GoLink.ChangedFromPort
e.SubHint == GoLink.ChangedToPort
e.SubHint == GoPort.ChangedRemovedLink
e.SubHint == GoPort.ChangedAddedLink
When a link is detached the following events are fired:
(SubHint)
ChangedRemovedLink
ChangedToPort
ChangedRemovedLink
ChangedFromPort
When attached to some other port the following events are fired:
ChangedAddedLink
ChangedFromPort
ChangedAddedLink
ChangedToPort
Convoluted but still workable. However, when links are deleted the following event is fired
ChangedRemovedLink
and ChangedAddedLink is fired when a link is drawn. Making it difficult to distingwish between link creation/deleation and re-linking.
I guess I could switch my link creation detection from GoLayer.InsertedObject to GoLayer.ChangedObject/GoPort.ChangedAddedLink, with a flag to fire the link creation once (since I get two ChangedAddedLink events).
But I can help think I'm going about this all wrong and that there is some simpler way of doing this?
Any help would be appreciated.
Thank You
Jack