Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Query regarding new form creation and saving (Read 3314 times)
Sivaraj p
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 21
Joined: Mar 14th, 2013
Query regarding new form creation and saving
Mar 14th, 2013 at 10:08am
Print Post  
Hi,
It is really great to be part of Mindfusion community. I am a new user and I found it great going through the various features in Mindfusion.
I had a query in WinForms. When I create a diagram with some nodes, save it as XMl and then reopens it, it works fine.
Now I wish to implement another thing:
On double click of a node(Master node), a new form should be opened in which I will be able to draw many subnodes in it, and I should be able to save this subform and return back to my main form. After I save it as XML, then reopen this diagram and double click my master node, I should be able to view the subform in which i created nodes earlier.
Can anybody please help me in this? Smiley
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Query regarding new form creation and saving
Reply #1 - Mar 14th, 2013 at 10:54am
Print Post  
Hi and welcome Smiley

You could save the subform's diagram as a string using the SaveToString method, and assign the string to the master node's Tag or Id property, or any custom property you add to a derived node class. Upon double click, open the subform and call LoadFromString to load the previously saved diagram.

Another possibility is to save the diagrams into separate files, and keep file names as masternode.Tag values. You could use a Zip library such as icsharpcode.sharpziplib to store the diagrams in a single archive file.

Yet another one is to use a DiagramDocument, where the first page is your main diagram, next pages are sub-diagrams, and keep only page indices as master nodes' Tags.

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


I Love MindFusion!

Posts: 21
Joined: Mar 14th, 2013
Re: Query regarding new form creation and saving
Reply #2 - Mar 15th, 2013 at 5:55am
Print Post  
Hi stoyo,
  As u said, I tried to save the diagram to a string in form2(subform).
In form1, I am unable to get the node which on double click, generated the subform, so that to the double clicked node's tag property, I am able to save the string generated from form 2.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Query regarding new form creation and saving
Reply #3 - Mar 15th, 2013 at 7:04am
Print Post  
Hi,

You could add a "public DiagramNode MasterNode" property to your sub-diagram form. Assign subForm.MasterNode = e.Node before showing the form from NodeDoubleClicked, and set MasterNode.Tag when closing the form.

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


I Love MindFusion!

Posts: 21
Joined: Mar 14th, 2013
Re: Query regarding new form creation and saving
Reply #4 - Mar 15th, 2013 at 7:51am
Print Post  
Hi Stoyo,
  Thanks a lot. You explanation was really clear. It works.
  
Back to top
 
IP Logged
 
Sivaraj p
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 21
Joined: Mar 14th, 2013
Re: Query regarding new form creation and saving
Reply #5 - Mar 15th, 2013 at 8:01am
Print Post  
Hi Stoyo,
  One more query in this:
If I am saving the subform diagram in ASCII format, does it mean that for whatever nodes are there in the subform, I won't be able to track/set their id's in the saved xml?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Query regarding new form creation and saving
Reply #6 - Mar 15th, 2013 at 8:25am
Print Post  
Hi,

I'm not sure what your question means. If you want to see legible Id values of sub-diagram nodes in the saved XML, try saving in SaveToStringFormat.Xml format instead of default base64-encoded format. If you decide to use DiagramDocument to implement your sub-diagrams feature, you will see each sub-diagram saved under a <DiagramPage> element in files created by DiagramDocument.SaveToXml, with nodes content visible under the <Nodes> child elements.

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


I Love MindFusion!

Posts: 21
Joined: Mar 14th, 2013
Re: Query regarding new form creation and saving
Reply #7 - Mar 18th, 2013 at 6:27am
Print Post  
Thanks a lot Stoyan.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint