public void Restore(DockState state, IDockablePanelFactory factory) { Clear(); if (state.SplitState != null) { var panel1 = new DockPanel(); panel1.Restore(state.SplitState.panel1, factory); var panel2 = new DockPanel(); panel2.Restore(state.SplitState.panel2, factory); GridLengthConverter converter = new GridLengthConverter(); splitContainer = new SplitPanel { Panel1 = panel1, Panel2 = panel2, Orientation = state.SplitState.orientation, Panel1Size = (GridLength)converter.ConvertFromString(state.SplitState.panel1Size), Panel2Size = (GridLength)converter.ConvertFromString(state.SplitState.panel2Size), }; Content = splitContainer; } else if (state.tabStates != null) { tabControl = new TabControl(); tabControl.Restore(state, factory); Content = tabControl; } }
public void Restore(WorkspaceState state, IDockablePanelFactory factory) { if (state == null) { return; } rootDockPanel.Restore(state.dockState, factory); peekPanel.Restore(state.peekState, factory); }
public void Restore(DockState state, IDockablePanelFactory factory) { foreach (TabState tabState in state.tabStates) { Type t = Type.GetType(tabState.ClassName); IDockablePanel control = factory.MakePanel(t); if (control is IStateControl) { using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(tabState.ControlState))) (control as IStateControl).RestoreState(stream); } var tab = new EditorTab(control); Items.Add(tab); } }