Posted 14 years ago
by Phil Devaney
-
Senior Software Engineer,
Serck Controls Ltd
Version: 4.5.0486

I am using DockSiteLayoutSerializer to save and restore the location of my tool windows into user.config, but when I restore the layout the first tab in each ToolWindowContainer is selected and I want the previously selected tab to be restored.
I have come up with some code to do this:Is this the best way to do this? Is IsSelected the best property to use to determine which ToolWindows are active? Could something be added to DockSiteLayoutSerializer to save this information?
PS Looks like your C# colorizer could do with updating for C# 3.0 :)
I have come up with some code to do this:
// In Window.Loaded handler, after call to DockSiteLayoutSerializer.LoadFromString
foreach ( var s in Properties.Settings.Default.SelectedTools.Split( ';' ) )
{
var window = this.dockSite.GetDockingWindow( s );
if ( window != null )
window.IsSelected = true;
}
// In Window.Closing handler, after call to DockSiteLayoutSerializer.SaveToString
var selectedTools = from t in this.dockSite.ToolWindows
where t.IsSelected
select t.Name;
Properties.Settings.Default.SelectedTools = string.Join( ";", selectedTools.ToArray() );
PS Looks like your C# colorizer could do with updating for C# 3.0 :)