Nevron Forum

Layout persistence save

https://www.nevron.com/Forum/Topic3517.aspx

By JSW W. - Wednesday, May 12, 2010

What file format will save in smallest size?
Which format operate faster?

How to choose between these format?

I have a scenario need to work out for the layout save.
assuming the save was done in previous session:

- If I load layout back to my winform, my content will probably not load as well right?

- So should I recreated all contents and managers first then load layout. or the other way around?

- Further more, if I have nested managers then I need to load them from inside or from the outside?

"You should give unique string keys to each panel and NControlHost instances for the persistency to work properly."

What actually panel.ID is design for? sometimes I could not get correct value for this ID.

key is not the same as the ID?

How get to NControlHost - if you have manager, panel, and document?

By Angel Chorbadzhiev - Thursday, May 13, 2010

Hello JSW W.,

I will try to answer to your questions in the same order you asked them.

  • CustomBinary format has smallest size.
  • There is no significant difference in speed between formats.
  • To set the format that you want to use you should set the Format property of framework state to the desired format.
  • The framework state saves and loads only docking framework state. It doesn't saves the containing controls.
  • When you load the layout you should have your docking manager created. You should put the content after the state is loaded.
  • If you have nested managers you should have framework state for each manager and save and load them separately. 
  • Panel.ID property is for internal use.
  • Key is different from ID. You can set Key property and it is string, while ID is generated automatically and it is of type GUID.

I am not sure I understand your last question could you elaborate?

By JSW W. - Saturday, May 15, 2010

From your document
"You should give unique string keys to each panel and NControlHost instances for the persistency to work properly."

The last question is about NControlHost I have never use it before so if you have some example to work with NControlHost. I am not sure how to handle it.

...
So in order to retrieve layout correctly.
1) reload managers
2) here should I recreate all panels/docs with correct keys?
3) load all layout into manager.
4) load connect back into panels/docs.
By Angel Chorbadzhiev - Sunday, May 16, 2010

Hello JSW W.,

To be able to load previously saved state all you need is when the panels and documents are created to set uniquely their Key and Text property (only to NDockingPanel and NUIDocument).

To load the saved state you need to call one of the three overloads of the Load methods.

Finally, you should add the hosted controls in the panels or in documents if they are not there already.

Usually, when load a state the panels and documents are already created together with the controls that they contain, and you don't need to add them again.

Regards,

Angel.