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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

using AppStateSerializer to serialise DockingWindow state to a file.

Thread ID:





10988 Feb 19,2004 03:30 AM UTC Feb 19,2004 10:39 AM UTC WinForms 1
Tags: Tools
Sue Harris
Asked On February 19, 2004 03:30 AM UTC

Hi, I''m trying to serialise the DockingWindow state to a file. Initially I was using: manager.SaveDockState(Syncfusion.Runtime.Serialization.SerializeMode.BinaryFmtStream, stream); which seems to work, but has a warning that the method is obsolete and will be removed. I tried using: Syncfusion.Runtime.Serialization.AppStateSerializer serialiser = new Syncfusion.Runtime.Serialization.AppStateSerializer(Syncfusion.Runtime.Serialization.SerializeMode.BinaryFmtStream, stream); manager.SaveDockState(serialiser); but my stream is always empty after the call. Could you tell me what I''m doing wrong? Thanks, Sue

Administrator [Syncfusion]
Replied On February 19, 2004 10:39 AM UTC

Hi Sue, 1. We have decided against retiring the following methods, and we will continue to support them in our future releases as well. public virtual void SaveDockState(SerializeMode,object); public virtual void LoadDockState(SerializeMode,object); 2. While using AppStateSerializer with MemoryStreams the ''Save'' module and ''Load'' module should look as shown in the code snippets below : //Save Module AppStateSerializer aser = new AppStateSerializer(SerializeMode.BinaryFmtStream, this.binstream); this.dockingManager1.SaveDockState(aser); aser.PersistNow(); //Load Module this.binstream.Position = 0; AppStateSerializer aser = new AppStateSerializer(SerializeMode.BinaryFmtStream, this.binstream); this.dockingManager1.LoadDockState(aser); AppStateSerializer does write information into the memory stream correctly. But you need to reset the memory stream’s current position to the beginning or to the point from which the serialized bytes begin before passing it to the AppStateSerializer or calling a LoadState method. The AppStateSerializer will have no concept of where the stream begins or ends and it is up to the application to manage the stream. Assuming that this particular stream has just the persisted state information, then setting it’s current position to 0 before calling LoadBarState() will make it work correctly (as shown in the code snippet above). I have also attached a sample application which illustrates this. Please let me know if you need any additional information. Regards, Guru Patwal Syncfusion, Inc.


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon