Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Saving A Diagram Asynchronously (Read 2080 times)
integragreg
YaBB Newbies
*
Offline



Posts: 40
Location: Tennessee
Joined: Jan 26th, 2009
Saving A Diagram Asynchronously
Sep 24th, 2009 at 9:03pm
Print Post  
We are trying to put the call to Diagram.SaveToXml() on a BackgroundWorker thread so that it does not interrupt the main application thread.

Because of cross-thread security, we are using the diagram's Dispatcher to call SaveToXml() like so:

Code
Select All
currentDiagram.Dispatcher.BeginInvoke(new System.Action(() => currentDiagram.SaveToXml(diagramFilePath)));
 



When we do it in this manner, we get a SerializationException with the following message:

Code
Select All
Type 'System.Windows.Media.SolidColorBrush' in Assembly 'PresentationCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is not marked as serializable.
 



Everything works fine if we save the diagram from the main application thread.

Can anyone suggest an alternative method for saving a diagram asynchronously?

Thanks,

Greg
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Saving A Diagram Asynchronously
Reply #1 - Sep 25th, 2009 at 12:42pm
Print Post  
This worked in our test, with a few ShapeNodes and links in the diagram. Could you copy the exception stack trace here?
  
Back to top
 
IP Logged
 
integragreg
YaBB Newbies
*
Offline



Posts: 40
Location: Tennessee
Joined: Jan 26th, 2009
Re: Saving A Diagram Asynchronously
Reply #2 - Sep 25th, 2009 at 12:47pm
Print Post  
Actually, it may be an issue in our implementation.

We have a custom object that is assigned to the diagram's Tag property, and if we set that to null just before saving the diagram, everything works.

We're looking into what could be causing the problem with serializing the tag.

Greg
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint