Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to detect DiagramLink disconnect (Read 2913 times)
stefski
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 31
Location: Norway
Joined: Jul 17th, 2009
How to detect DiagramLink disconnect
Aug 30th, 2010 at 10:44am
Print Post  
Hello,

I am struggling somewhat to figure out how to detect when a DiagramLink has been disconnected from a DiagramNode.

Basically I would expect to get information about the link, endpoint (Origin or Destination) and node involved in the disconnect.

I have tried handling (among others) the LinkModified and DestinationAnchorChanged events, but they either don't fire often enough or provide too little information.

Suggestions are very welcome!


Best regards

Steffen Skov
principal consultant
SPTGroup AS
  

Kind regards

Steffen Skov
OLGA Application Architect
Schlumberger Information Solutions AS
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to detect DiagramLink disconnect
Reply #1 - Aug 30th, 2010 at 1:47pm
Print Post  
Hi,

If you need to know when a link is no longer connected to a node, handling LinkModified should be enough:

Code
Select All
private void diagram_LinkModified(object sender, LinkEventArgs e)
{
	if (e.AdjustmentHandle == 0 && e.Link.Origin is DummyNode)
		Debug.WriteLine("disconnected origin");
	if (e.AdjustmentHandle == e.Link.ControlPoints.Count - 1 && e.Link.Destination is DummyNode)
		Debug.WriteLine("disconnected destination");
} 



Unfortunately the event arguments do not include a reference to the origin or destination before disconnecting. If you need that, you can save reference to the respective node from a LinkStartModifying handler.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
stefski
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 31
Location: Norway
Joined: Jul 17th, 2009
Re: How to detect DiagramLink disconnect
Reply #2 - Sep 1st, 2010 at 8:07am
Print Post  
Thank you, Stoyan!

I solved the problem by adding some state to my event handling class, which would then be able to fire my own events on connecting and disconnecting.


Best regards

Steffen Skov
principal consultant
SPTGroup AS
  

Kind regards

Steffen Skov
OLGA Application Architect
Schlumberger Information Solutions AS
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint