Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Reading serialized files from WinForm version (Read 2004 times)
jarv2003
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Jan 21st, 2010
Reading serialized files from WinForm version
Sep 13th, 2011 at 5:50pm
Print Post  
I have an WinForm application that is using the WinForm version of the control. Now I'm migrating it to ASP.NET and would like to know if the ASP.NET is able to read the serialized file created in the WinForm version.

Please advise
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Reading serialized files from WinForm version
Reply #1 - Sep 13th, 2011 at 6:13pm
Print Post  
Yes, as long as there are no Windows Forms objects saved in the files (e.g. ControlNodes or your own custom types deriving from WinForms classes).

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


I love YaBB 1G - SP1!

Posts: 7
Joined: Jan 21st, 2010
Re: Reading serialized files from WinForm version
Reply #2 - Sep 13th, 2011 at 6:33pm
Print Post  
What about if I have my custom objects tagged to diagram nodes?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Reading serialized files from WinForm version
Reply #3 - Sep 13th, 2011 at 6:49pm
Print Post  
If you use XML format, just copy your Serialize/DeserializeTag event handlers to the ASP.NET app. If using binary format and the tag type is defined in a dll file that will be used in the web project too, it should work out of the box.

There will be a problem if the tag type was defined in the .exe file. The type is identified by its full name (including assembly + namespace), so it will fail to load if you just copy the code to the web project. To work around that, set Diagram.SerializationBinder to an object whose BindToType instance returns the type from the web project that corresponds to the specified full name from the exe project:

Code
Select All
public Type BindToType(
	string assemblyName,
	string typeName)
{
	if (assemblyName = "MyExeProject")
	{
		if (typeName == "MyExeNameSpace.MyType")
			return typeof(MyWebNameSpace.MyType);
		...
	}
	return null;
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint