This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I'm using CustomConnection like this: public class CustomConnection : FlowDiagramConnection
How can i serialize/deserialize connections? In particular i want to save a position of every segment.
|
|
|
Hello If you are serializing to XML, then take a look at the ActivityDiagramXmlSerializer class in the ActivityDiagrams sample project. This serializer extends the DiagramXmlSerializer class. For serializing a connection, you need to override the SerializeConnectionCore method. Here you return a new XElement object with any additional attributes that your connection may need to store. The DiagramXmlSerializer will automatically take care of the segments. Let me know if you need further help. |
|
|
If i press "save" and "open", this project throw FormatException on not Engish computers. I found error in your source file DiagramXmlSerializer.cs in line 275: new XAttribute(EndPointAttributeName, segment.EndPoint), Right line is: new XAttribute(EndPointAttributeName, _pointConverter.ConvertToInvariantString(segment.EndPoint)),
|
|
|
Next problem: i write custom serialized/deserializer. I success read segments of connection from xml string. After it i call new FlowDiagramConnection(fromConnectionPoint, toConnectionPoint, segments)
But in diagram i see other segments, calculated by pathfinder.
I debug source code and see that method DiagramConnectionBase.ApplyPathfindingLater called. I see that file DiagramConnectionBase.cs in constructor DiagramConnectionBase(TOutboundPoint fromConnectionPoint, TInboundPoint toConnectionPoint, IList<DiagramConnectionSegment> segments) function SetConnectionPoints(fromConnectionPoint, toConnectionPoint); raised event DiagramConnectionPointBase.OnPositionChanged
Is it right?
Call stack: Mindscape.WpfDiagramming.Foundation.dll!Mindscape.WpfDiagramming.Foundation.DiagramConnectionBase<Mindscape.WpfDiagramming.DiagramConnectionPoint,Mindscape.WpfDiagramming.DiagramConnectionPoint,Mindscape.WpfDiagramming.DiagramConnectionPoint>.ApplyPathfindingLater() Line 261 C#
|
|
|
Sorry for last message,it's wrong way. I just found real reason. I'm using method UpdateConnectionPointCalculators method through a dispatcher in the constructor (http://www.mindscapehq.com/forums/Post.aspx?ThreadID=4266&PostID=14939) Segments deserialize perfectly if I comment out this method UpdateConnectionPointCalculators. How can i combine "multiply connection points" and "connection deserializing"?
|
|
|
Hello shuraz I have made modifications to the foundation that will allow you to remove the dispatcher from the constructor of your nodes. Now you can directly call the UpdateConnectionPointCalculators method from the constructor. This will allow the calculators to be updated in the model before the connections have even been created. Now the segments will not be interfered by setting the position calculators. This update can be downloaded through the nightly builds from tomorrow the 10th of June. Let us know how it goes. I have also made that fix you mentioned in the DiagramXmlSerializer. - Jason |
|
|
I download file WpfDiagrams1Dev-20110610.msi So i have files Mindscape.WpfDiagramming.FlowDiagrams.dll and Mindscape.WpfDiagramming.Foundation.dll with version 2.0.580.17402 I download sample project "DynamicConnectionPoints.zip" from http://www.mindscapehq.com/forums/Post.aspx?ThreadID=4266&PostID=14939 Multiply connection points are working with dispatcher. Multiply connection points are not working with direct call the UpdateConnectionPointCalculators method.
|
|
|
Hello Shuraz That was my mistake. The changes will be in the nightly builds from tomorrow the 14th of June. Sorry for the inconvenience. - Jason |
|
|
I see only build from 10th of June...
|
|
|
Hello Shuraz This problem has been resolved and you can download the fix I mentioned through the nightly builds any time. - Jason |
|
|
Thank you, Jason It's worked. |
|