Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Saving/Copying tagged node (Read 2525 times)
noen0909
YaBB Newbies
*
Offline


Hi, Everyone.

Posts: 9
Joined: May 20th, 2010
Saving/Copying tagged node
Sep 1st, 2010 at 4:57pm
Print Post  
Hi Stoyan,

I want to save my node using saveToFile method, well it works out fine, except that my tag that was attached won't came along when I load that saved file. If I tagged a class to a node, it didn't show up when I load the file using loadFromFile method. The same problem occurs when i tried to copy a node with :

diagramView.CopyToClipboard(true);

Is there any way to save/copy a node with all its corresponding tag? or maybe i missing something important code or something?
Thanks a lot before,

Best regards,
Aiinun
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Saving/Copying tagged node
Reply #1 - Sep 1st, 2010 at 5:12pm
Print Post  
Hi Aiinun,

Tags are saved automatically only if they are from a value type. Otherwise you must mark your class as [Serializable] and implement the ISerializable interface for binary serialization to work. For XML serialization, handle the SerializeTag and DeserializeTag events.

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


Hi, Everyone.

Posts: 9
Joined: May 20th, 2010
Re: Saving/Copying tagged node
Reply #2 - Sep 1st, 2010 at 5:37pm
Print Post  
Hi Stoyan,

Thanks for your quick reply but,
I am sorry, actually I kind of lost, could you give me some reference so I could study more of this serialization stuff?

Thanks a lot before,
Best regards,

Ainun.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Saving/Copying tagged node
Reply #3 - Sep 1st, 2010 at 5:50pm
Print Post  
Hi Ainun,

You can find an example here:
http://msdn.microsoft.com/en-us/library/ms182342(VS.80).aspx

Technically it's enough to just add the [Serializable] attribute and the framework will automatically serialize your objects using reflection. However if there's a possibility that the class will change (it will have members added or removed), you'd better implement ISerializable too so that you can add versioning support.

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


Hi, Everyone.

Posts: 9
Joined: May 20th, 2010
Re: Saving/Copying tagged node
Reply #4 - Sep 1st, 2010 at 6:08pm
Print Post  
Hi Stoyan,

Thanks!! Grin

Now I get what you are trying to tell, I've implemented it and it worked. Copy method worked out as well. I can't explain how the whole thing worked though. ???

But, man... i didn't know it was that simple.. Grin

Thanks a lot Stoyan,
Best regards,
Ainun
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Saving/Copying tagged node
Reply #5 - Sep 1st, 2010 at 6:33pm
Print Post  
Ok, great Smiley CopyToClipboard uses the same serialization code to save things in the clipboard.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint