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
|
Hi everyone! I need a quick and efficient way to deserialise and serialise flow diagrams on the server into a similar object model that the front end component has. From what I can see there shouldn't be any issue using the FlowDiagramNode object server side, but I can't use the FlowDiagramModel as it inherits DependencyObject and needs a STA thread to run. In my scenario there could be many threads processing different flow diagrams in parallel. Is there a component provided as part of flow diagrams that can do this? Any help appreciated! Cheers, Kyryll |
|
|
Hello Kyryll The only serialization support built into WPF Diagrams is the XML serializer. For flow diagrams, this is the FlowDiagramXmlSerializer. You will probably need to make your own custom serializer to fit the needs of your application. Let me know if you need help with reading a diagram model to serialize it. Jason Fauchelle |
|
|
Hi Jason, Thanks for your fast reply:) I am currently looking at FlowDiagramXmlSerialiser and what it does to initialise the FlowDiagramModel. I can see what it's doing to deserialise built in node types and custom nodes, basically iterating through the Nodes section then iterating through the Connections section :) I'm going to come up with my own FlowDiagram object that will basically just have two properties for Nodes and Connections and none of the visual wpf stuff. Do you see any danger in using the FlowDiagramNode object from FlowDiagrams.dll on the server? Cheers, Kyryll |
|
|
Hello Kyryll I do not see any problem with using FlowDiagramNode objects on the sever, though I have never tried it. If you run into problems, you could always create your own model objects to represent them on the server. Also, are you using WPF FlowDiagrams version 1.0? If so, you may want to consider upgrading to WPF Diagrams 2.0 if possible which is greatly improved. The FlowDiagramModel doesn't contain visual related code. Customizing diagrams (for both the model and the visuals) is also much easier in version 2.0. Jason Fauchelle |
|
|
Hi Jason, I am using version 1.0.565.14793 I have tried to use the FlowDiagramModel on the server and what happens is I run into problems which I believe are caused by having to mark the threads that reference FlowDiagramModel as STA threads. Basically everything works fine at first, but as my application starts to get under load (after 1+ days of running) I start getting thread dispatcher expections coming from within FlowDiagramModel. I am using the model for getting references to the custom data stored in each node as well as to get connections that link nodes together (so I can navigate them). I am looking for the path of least resistance (as usual) :) Is the object model between versions 1 and 2 very different? Does the FlowDiagramModel in version 2 still need to be run in STA thread? Does it inherit DependencyObject? Thank you very much for your help, Kyryll |
|
|
Hello Kyryll The API for the object model between versions 1 and 2 are mostly the same. The internal implementation is a bit different so as to removing coupling to visual objects and improve performance. Some of the model objects still use the Dispatcher, so you'd most likely run into similar dispatcher exceptions as you are at the moment. Keep in mind that if you want to move to version 2, customizing the visuals is quite different (simplified). If you want to experiment with version 2, let me know if you have any questions. In any case, I'd say that it's best for you to create your own model objects to store the model information on the server side, rather than using WPF diagrams classes. Jason Fauchelle |
|
|
Thanks for your prompt support, Jason:) I am almost done implementing my own FlowDiagramModel and FlowDiagramXmlSerialiser and will pursue this route for now. It's good to know I can quickly ask a question if I need to:) Cheers, Kyryll |
|
|
Decided to follow up on this old thread in case anyone else is doing anything similar:) I was quick to implement my custom FlowDiagramModel object and the corresponding serialiser. I followed the FlowDiagramXmlSerialiser very closely in implementation. This was OK at the start. Everything appeared to work, but got into some issues down the track. As it tuns out, DiagramConnectionSegment also inherits from DependencyObject. I have now removed any support for Segments in the server side implementation as Connections still seem to work fine and I don't need to preserve the exact layout of the connection segments for logic that is used on the server. I will be running load tests over the next few weeks and will update this thread with results. Any questions - contact me at code@kyryll.com Cheers, Kyryll |
|