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

using AppStateSerializer to serialise DockingWindow state to a file.

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

1 Reply

AD Administrator Syncfusion Team 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.

Live Chat Icon For mobile
Up arrow icon