Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Tags and serialization (save) (Read 4807 times)
JasonB
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: Jun 5th, 2008
Tags and serialization (save)
Jul 14th, 2008 at 6:46pm
Print Post  
Hi,

It looks like diagram.SaveToXml() is attempting to serialize the Tag values for my nodes, links, anchor points, etc. My objects are not serializable, and even if they were, serializing them wouldn't work as they need to be specific references to other objects and not just serialized copies. WIth this in mind, is it possible to pass as an option to SaveToXml() a boolean parameter to skip *all* tag values?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Tags and serialization (save)
Reply #1 - Jul 14th, 2008 at 8:12pm
Print Post  
Hi,

You could handle the SerializeTag event and set e.Handled = true.

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


I love YaBB 1G - SP1!

Posts: 24
Joined: Jun 5th, 2008
Re: Tags and serialization (save)
Reply #2 - Jul 15th, 2008 at 2:09pm
Print Post  
Thanks, I will check this out.
  
Back to top
 
IP Logged
 
JasonB
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: Jun 5th, 2008
Re: Tags and serialization (save)
Reply #3 - Jul 15th, 2008 at 3:39pm
Print Post  
The problem with this is I have tag values for my custom UI elements, and so the exception still occurs since it looks like SerializeTag event only fires for diagram item, right?  Looks like you are using xamlwriter for saving? Not a problem now though; I'll just temporarily remove my tags prior to save and re-add them after the save. I'd imagine there is some way to tell the xamlwriter to skip the field though.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Tags and serialization (save)
Reply #4 - Jul 15th, 2008 at 5:07pm
Print Post  
Ok, I thought you were using the DiagramItem's Tag property. So you might try to use the node adapters' tags and not your own.

Another possibility is to override the SaveToXml and LoadFromXml methods of DiagamNodeAdapter and don't rely on the XamlWriter but save just the properties you are interested in. This should help for the DeviceDiagram problem too.

We'll check if there is some attribute that would make XamlWriter skip the properties marked with the attribute.

Stoyan
  
Back to top
 
IP Logged
 
JasonB
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 24
Joined: Jun 5th, 2008
Re: Tags and serialization (save)
Reply #5 - Jul 15th, 2008 at 8:37pm
Print Post  
Looks like its best just to completely override the save on the diagram and take full control of the save / load process. I won't be able to add an attribute to the tag property as I am just using the Tag property on various Controls that they inherit from FrameworkElement. Thanks for all your help.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint