I have a MDIManager which is used to host various forms/pluggin-modules from seperate assemblies; (dll, exe, etc.) But when I attempt to use the Serialization and Deserialization methods of the MDIManager, it seems my child forms arn't being stored and reloaded. From the example help/doc - "Save and Restore a Tabbed MDI Layout", it uses the Save/Load from binary; but i also tried using "from xml" and through examining the xml file found that none of the obvious details of my forms are stored. In anycase, I've already resorted to saving the layout through xml manually, by iterating through the TabbedMdiMan.TabGroups[x].Tabs, etc. However the question is how do I manually load the forms back?
I am able to read my own xml file (obviously), but i need to know how to create new TabGroups, Tabs, a new tab assigned to specific group, and attach a new form to that tab.
In my application, we use Assembly.LoadFrom(~), but a simple example using local assemblies would do just fine - i'm sure i can figure out the rest.
regards,
-kel-
Kel,
Here's the section from the help file that pointed me in the right direction.
I was running into the same problem with the RestoreTab event. The key to getting all of the forms to reload correctly is the last line of this code:
e.Form = edit
I spent about half an hour hunting this down and realized I missed this line. Once I added it, all of my mdi forms were restored correctly. Good luck.
Bob
[C#]
using Infragistics.Win; using Infragistics.Win.UltraWinTabs; using Infragistics.Win.UltraWinTabbedMdi; private void ultraTabbedMdiManager1_RestoreTab(object sender, Infragistics.Win.UltraWinTabbedMdi.RestoreTabEventArgs e) { // The 'RestoreTab' event is invoked during a call to // LoadFromBinary or LoadFromXml when deserializing the // serialized MdiTab objects. The event is invoked once // for each serialized tab so that it may be associated // with an mdi child. If the Form is not initialized the // tab will be discarded. // // The 'PersistedInfo' can be used to store any serializable // value. It is opaque to the tab and can be used to store // information to help recreate the form that the tab should // be associated with. // string fileName = e.Tab.PersistedInfo as string; // By exiting without setting the 'Form' parameter, // we're discarding the tab. if (fileName == null || !System.IO.File.Exists(fileName)) return; // Create the form that we will associate with the Tab. Normally // whenever an mdi child form is created, an MdiTab is automatically // created for the form but during the RestoreTab event, this will // not happen so that new forms may be created to associate with // a deserialized tab. // EditForm edit = new EditForm(); edit.FileName = fileName; // set the MdiParent property of the new form so it // will be an mdi child form. Since the event could // be caught somewhere other than the form class, we // can access the MdiParent via the associated // UltraTabbedMdiManager's MdiParent. edit.MdiParent = e.Tab.Manager.MdiParent; // The 'WasVisible' parameter indicates whether the tab // was part of the HiddenTabs collection when the serialization // took place. If the visible state is different, then the // tab will be moved to/from the HiddenTabs collection to/from // a tab group as needed. // edit.Visible = e.WasVisible; // Set the 'Form' parameter so that the MdiTab will be // associated with the form. e.Form = edit; }
I would recommend submitting a sample that demonstrates the issue to the support group: http://devcenter.infragistics.com/Protected/SubmitSupportIssue.Aspx.