Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to save my diagram? (Read 8454 times)
Taivan
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 37
Joined: Jun 15th, 2012
How to save my diagram?
Jul 17th, 2012 at 8:53am
Print Post  
Hi stoyan.

How to save my diagram items and controls.

What kind of options? (Syntax)?

Please share me thank you Cheesy
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to save my diagram?
Reply #1 - Jul 17th, 2012 at 9:24am
Print Post  
You can use the SaveToXml and LoadFromXml methods of the Diagram class. If you use ControlNodes, you must handle the SerializeControl and DeserializeControl events to implement serialization of hosted controls' properties.

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


I Love MindFusion!

Posts: 37
Joined: Jun 15th, 2012
Re: How to save my diagram?
Reply #2 - Jul 17th, 2012 at 9:26am
Print Post  
Stoyo wrote on Jul 17th, 2012 at 9:24am:
You can use the SaveToXml and LoadFromXml methods of the Diagram class. If you use ControlNodes, you must handle the SerializeControl and DeserializeControl events to implement serialization of hosted controls' properties.

I hope that helps,
Stoyan


Do you have any sample? Cheesy
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to save my diagram?
Reply #3 - Jul 17th, 2012 at 10:02am
Print Post  
You can find sample handlers here:
http://www.mindfusion.eu/onlinehelp/diagramlite/index.htm?E_MindFusion_Diagrammi...

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


I Love MindFusion!

Posts: 37
Joined: Jun 15th, 2012
Re: How to save my diagram?
Reply #4 - Jul 18th, 2012 at 1:27am
Print Post  
Stoyo wrote on Jul 17th, 2012 at 10:02am:
You can find sample handlers here:
http://www.mindfusion.eu/onlinehelp/diagramlite/index.htm?E_MindFusion_Diagrammi...

I hope that helps,
Stoyan


Hi stoyan. Sorry for my bad programming skill. Please see my uploaded project.
I want save my diagram to file is it possible?
thank you. Cheesy

http://www.4shared.com/rar/wtDbUj1d/PrototypeV2.html
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to save my diagram?
Reply #5 - Jul 18th, 2012 at 8:48am
Print Post  
Please attach the test project to your forum post. 4shared require registering an account with them to download and I am not getting their activation email message. Remove any dll and xap files from the archive to make sure it fits into the forum's 250KB limit.
  
Back to top
 
IP Logged
 
Taivan
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 37
Joined: Jun 15th, 2012
Re: How to save my diagram?
Reply #6 - Jul 18th, 2012 at 8:54am
Print Post  
Stoyo wrote on Jul 18th, 2012 at 8:48am:
Please attach the test project to your forum post. 4shared require registering an account with them to download and I am not getting their activation email message. Remove any dll and xap files from the archive to make sure it fits into the forum's 250KB limit.


Okay here is my proj file
  

PrototypeV2.rar (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to save my diagram?
Reply #7 - Jul 18th, 2012 at 11:11am
Print Post  
Calling diagram.SaveToXml("test.xml") will save the file in the Silverlight's isolated storage. If you want to save a file on the file system, you will have to use a SaveFileDialog:

Code
Select All
var saveFileDlg = new SaveFileDialog
{
	Filter = "XML Files (.xml)|*.xml|All Files|*.*"
};
if (saveFileDlg.ShowDialog() == true)
{
	using (var stream = saveFileDlg.OpenFile())
		diagram.SaveToXml(stream);
} 



Otherwise, due to Silverlight security restrictions you can't save directly on the FS by specifying a full file path.

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


I Love MindFusion!

Posts: 37
Joined: Jun 15th, 2012
Re: How to save my diagram?
Reply #8 - Jul 19th, 2012 at 3:32am
Print Post  
Stoyo wrote on Jul 18th, 2012 at 11:11am:
Calling diagram.SaveToXml("test.xml") will save the file in the Silverlight's isolated storage. If you want to save a file on the file system, you will have to use a SaveFileDialog:

Code
Select All
var saveFileDlg = new SaveFileDialog
{
	Filter = "XML Files (.xml)|*.xml|All Files|*.*"
};
if (saveFileDlg.ShowDialog() == true)
{
	using (var stream = saveFileDlg.OpenFile())
		diagram.SaveToXml(stream);
} 



Otherwise, due to Silverlight security restrictions you can't save directly on the FS by specifying a full file path.

I hope that helps,
Stoyan


Thanks i can save my diagram to file. But Load my diagram from file i lost my ControlNodes binding controls. Any suggestions Stoyan? Cheesy

My load Code is here:

-------------------------------------------
var openFileDlg = new OpenFileDialog
                {
                    Filter = "XML Files (.xml)|*.xml"
                };
                if (openFileDlg.ShowDialog() == true)
                {
                    using (var stream = openFileDlg.File.OpenRead())
                        diagram.LoadFromXml(stream);
                }
-------------------------------------------
  

Save.jpg (Attachment deleted)
Load.jpg (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to save my diagram?
Reply #9 - Jul 19th, 2012 at 9:05am
Print Post  
You will have to handle SerializeControl and DeserializeControl events to handle serialization of custom controls. The help topic linked above contains some sample event handlers.

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