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

Toolbar persistence

Thread ID:





42352 Mar 27,2006 08:17 PM UTC Mar 31,2006 12:05 PM UTC WinForms 6
Tags: Tools
Chris C
Asked On March 27, 2006 08:17 PM UTC

We have a MDI application, similar to the DiagramBuilder sample. We would like to save the toolbar state of both the mainframe toolbars and the child window toolbars. The mainframe toolbar state is saved but not the state of the child window toolbars. The DiagramBuilder sample exhibits the same behavior. I found a post to this forum from June of 2004 that seems to describe the same problem (http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=15387). It indicated that a fix would be in the next release. Has this been fixed, or is there something that I''m missing in my application to get this working? Thanks in advance for your help. Chris C

Administrator [Syncfusion]
Replied On March 27, 2006 08:40 PM UTC

I forgot to mention that we are using Essential Studio Chris C

Mano J [Syncfusion]
Replied On March 28, 2006 03:06 PM UTC

Hi Chris, We regret for the inconvenience caused. You can use AppStateSerializer to store the persist states of toolBars. I have modified the Diagram Builder sample and attached it here. I have used AppStateSerializer''''s InitializeSingleton method in the MainForm.cs before InitializeComponent to block the state persistance from getting stored into the Isolated Storage folder. AppStateSerializer.InitializeSingleton(SerializeMode.XMLFile, "..//..//StateInfo"); In DiagramForm.cs _FormLoad event, load the previously stored state: AppStateSerializer app = new AppStateSerializer(SerializeMode.XMLFile, "..//..//StateInfo"); this.childFrameBarManager.MainFrameBarManager.LoadBarState(app); In DiagramForm_Closing event, I have stored the toolBars state as shown below: AppStateSerializer app = new AppStateSerializer(SerializeMode.XMLFile, "..//..//StateInfo"); this.childFrameBarManager.MainFrameBarManager.SaveBarState(app); app.PersistNow(); Please refer to the modified sample attached and let me know if this works for you. Thanks for using Syncfusion products. Regards, Mano Diagram_sample.zip

Chris C
Replied On March 29, 2006 11:02 PM UTC

Thanks for your help. I added the code you suggested and the persisted state seems to work correctly. I''ve noticed a few instances where the toolbar did not persist as expected but I can not consistently reproduce the problem. Our application also implements a MRU file list. I had originally saved the state to isolated storage and it worked fine. However, it would be nice to keep all of the application state in the same storage so I tried to save the MRU state to the same XML storage as the toolbars and that did not work. Is it possible to do this? If so, do you have any idea why the MRU serialization is not working with the XML? Here is a code snippet of our MRU serialization: // save MRU AppStateSerializer serializer = new AppStateSerializer(SerializeMode.XMLFile, gdeDir + GdeStateFile); serializer.SerializeObject(MRUFilesInfoTag, this.biFileMRU.ChildCaptions, true); // load MRU AppStateSerializer serializer = new AppStateSerializer(SerializeMode.XMLFile, gdeDir + GdeStateFile); object objectOut = serializer.DeserializeObject(MRUFilesInfoTag); if(objectOut != null) { StringCollection collection = objectOut as StringCollection; this.biFileMRU.ChildCaptions.Clear(); foreach(string item in collection) this.biFileMRU.ChildCaptions.Add(item); } Thanks in advance for your help. Chris C

Mano J [Syncfusion]
Replied On March 30, 2006 03:05 PM UTC

Hi Chris, I have tested this issue. Currently, the MRUList child captions cannot be persisted in an XML file. I am unable to provide you an accurate explanation of why this behavior occurs. As for now, please use the IsolatedStorage medium to persist the MRUList using GetSingleton method. AppStateSerializer serializer = AppStateSerializer.GetSingleton(); I will consult with the development team and update you regarding this issue. Please let me know if you have any questions. Thanks for your patience. Regards, Mano

Chris C
Replied On March 30, 2006 05:16 PM UTC

Hi Mano, Thanks for your quick response. I''m assuming from your reply to my first message that I have to use XML to persist toolbar state (why doesn''t isolated storage work for that?). I used the code you suggested for that and called InitializeSingleton to initialize it for XML. Can I just reinitialize it to isolated storage for the mru? What is the best way to persist the toolbars to XML and MRU list to isolated storage in the same application? Thanks in advance for your help. Chris

Mano J [Syncfusion]
Replied On March 31, 2006 12:05 PM UTC

Hi Chris, AppStateSerializer''s GetSingleton method uses "SyncfusionToolsStateInfo" string as the default storage folder name in the IsolatedStorage path. You can use the same name as the storage path name for persisting the toolBars state in the Isolated Storage. Diagram_Load event: AppStateSerializer app = new AppStateSerializer(SerializeMode.IsolatedStorage, "SyncfusionToolsStateInfo"); this.childFrameBarManager.MainFrameBarManager.LoadBarState(app); Diagram_Form_Closing event: AppStateSerializer app = new AppStateSerializer(SerializeMode.IsolatedStorage, "SyncfusionToolsStateInfo"); this.childFrameBarManager.MainFrameBarManager.SaveBarState(app); app.PersistNow(); Hence the MRUList files also gets stored in the same path. Please let me know if this works for you. Regards, Mano


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