Hi David,
The SaveBarState/LoadBarState methods persist the positional information of the menus/toolbars only. Hiding/showing or adding/removing BarItems/toolbars amounts to menu customization and the MainFrameBarManager''''s protected methods - LoadCustomizationInfo / SaveCustomizationInfo handle this.You have to derive a custom mainframeBarManager and use these methods to persist customization.
Set the following properties to false and then load the state from a serialized file. This way all the state persistance is done to the same xml file.
this.mainFrameBarManager1.AutoLoadToolBarPositions = false;
this.mainFrameBarManager1.AutoPersistCustomization = false;
//to programatically hide the bars
mainFrameBarManager1.GetCommandBarManager().SetBarVisibility(bar1,false);
mainFrameBarManager1.GetCommandBarManager().SetBarVisibility(bar2,false);
I have attached a sample which demonstrate this completely.In this sample when you click on "New" baritem the bar1 and bar2 will be hidden.When you click on "save" and "Load" buttons to save and load the customized informations.
Please let me know if this meets your requirements.
Thank you,
J.Nagaraj.
persistCustomization.zip