We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Controls are reversed when saving/loading a DockManager

Thread ID:

Created:

Updated:

Platform:

Replies:

50218 Oct 9,2006 04:41 PM UTC Oct 11,2006 04:09 PM UTC WinForms 1
loading
Tags: Tools
Daniel Chait
Asked On October 9, 2006 04:41 PM UTC

I save out my dock manager using the following code:

private byte[] GetDockState()
{
MemoryStream ms = new MemoryStream();
AppStateSerializer appStateSer = new AppStateSerializer(SerializeMode.XMLFile, ms);
_dockMgr.SaveDockState(appStateSer);
appStateSer.PersistNow();
string stateStr = ms.ToString();
return ms.ToArray();
}


and load it back like this:

private void SetDockState(byte[] value)
{
_dockMgr.LoadDockState(new AppStateSerializer(
SerializeMode.XMLFile, new MemoryStream(value)));
}

However when I do, two of the controls are reversed. This happens every time, so if I save and load, they swap again. How can I fix this?

Murugan [Syncfusion]
Replied On October 11, 2006 04:09 PM UTC

Hi Daniel,

Before going to load from MemoryStream its seeking position has to be initialized to Beginning of the stream. Please refer the attached code snippet for more details.

private byte[] GetDockState ( )
{
MemoryStream ms = new MemoryStream();
AppStateSerializer app = new AppStateSerializer(SerializeMode.XMLFile, ms);
this.dockingManager1.SaveDockState(app);
app.PersistNow();
return ms.ToArray();
}

private void SetDockState (byte[] value)
{
MemoryStream ms = new MemoryStream(value);
ms.Seek(0, SeekOrigin.Begin);
this.dockingManager1.LoadDockState(new AppStateSerializer(SerializeMode.XMLFile, ms));
}

Thanks for choosing Syncfusion products.

Best Regards,
Murugan P.S

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;