Hello,
I’d like to exchange “from” to “to” node if user make a link at reverse sens, whitout errors.
I made this code : <BR>protected override void InsertLink(QD_Link linkdata)<BR> { <BR> int iRes = IsLinkOk(linkdata, null);<BR> if ( iRes == 0) this.RollbackTransaction();<BR> else if (iRes == -1)<BR> {<BR> QD_Node oToNode = this.GetToNodeForLink(linkdata);<BR> QD_Node oFromNode = this.GetFromNodeForLink(linkdata);<BR> this.RollbackTransaction(); <--- breakpoint<BR><BR> Application.Current.Dispatcher.BeginInvoke((Action)(() =><BR> {<BR> QD_Link oNewLink = new QD_Link(this.Options);<BR> oNewLink.From = oToNode.Key;<BR> oNewLink.To = oFromNode.Key;<BR> oNewLink.QDCategory = QD_Link.ECategory.Belongs;<BR> iRes = IsLinkOk(oNewLink, null);<BR> if (iRes == 1)<BR> {<BR> this.AddLink(oNewLink);<BR> }<BR> }), DispatcherPriority.ApplicationIdle);<BR> }<BR> else<BR> {<BR> base.InsertLink(linkdata); <BR> }<BR>}<BR>
Where IsLinkOk verify if node is acceptable.
I’ve put a breakpoint at rollbacktransaction, and this is the data state : (I can’t insert image then i will copy the results :
+ [0] {1} SphinxV6.Concept.QDiagram.QD_Node
+ [1] {2} SphinxV6.Concept.QDiagram.QD_Node
+ [2] {10} SphinxV6.Concept.QDiagram.QD_Node
+ [3] {3} SphinxV6.Concept.QDiagram.QD_Node
+ [4] {4} SphinxV6.Concept.QDiagram.QD_Node
+ [5] {5} SphinxV6.Concept.QDiagram.QD_Node
+ [6] {6} SphinxV6.Concept.QDiagram.QD_Node
+ [7] {7} SphinxV6.Concept.QDiagram.QD_Node
+ [8] {8} SphinxV6.Concept.QDiagram.QD_Node
+ [9] {9} SphinxV6.Concept.QDiagram.QD_Node
+ [10] {11} SphinxV6.Concept.QDiagram.QD_Node