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
close icon

DockingManager LoadDockState problem

Hi, I encountered a problem with DockingManager while trying to use SaveDockState and LoadDockState metods with external stream. In SaveDockState method everithing is OK and the stream is full with docking state data, but when I call the LoadDockState to deserialize the docking state nothig happens .. and the LoadDockState returns a false. As an example a piece of code is given: System.IO.Stream stream = new System.IO.MemoryStream(); AppStateSerializer serializer = new AppStateSerializer(SerializeMode.BinaryFmtStream, stream); this.dockingManager.SaveDockState(serializer); serializer.PersistNow(); memento.Stream = stream; ... System.IO.Stream stream = memento.Stream; AppStateSerializer serializer = new AppStateSerializer(SerializeMode.BinaryFmtStream, stream); bool r = this.dockingManager.LoadDockState(serializer); Any ideas? Radoslav Mihaylov, Radslav

1 Reply

VS Vijayanand S Syncfusion Team November 2, 2005 09:59 AM UTC

Hi Radslav, 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 the LoadDockState 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 LoadDockState() will make it work correctly (as shown in the code snippet below) : // loading dock state information this.memstream.Position = 0; AppStateSerializer aser = new AppStateSerializer(SerializeMode.BinaryFmtStream, memstream); this.dockingManager1.LoadDockState(aser); // saving dock state information this.memstream = new MemoryStream(); AppStateSerializer aser = new AppStateSerializer(SerializeMode.BinaryFmtStream, memstream); this.dockingManager1.SaveDockState(aser); aser.PersistNow(); Please refer to the complete sample attached here which illustrates the above, and let me know if you need further assistance. We appreciate your interest in Syncfusion products. Regards, Vijay

Loader.
Live Chat Icon For mobile
Up arrow icon