/// <summary> /// Restores the state of the branch. /// </summary> /// <typeparam name="TTabModel">The type of tab model</typeparam> /// <typeparam name="TTabViewModel">The type of tab view model to be displayed in the app.</typeparam> /// <param name="tabablzControl">The control in which to restore the items</param> /// <param name="branchState">The state of the branch to be restored</param> /// <param name="viewModelFactory">The function that creates the view model based on a model</param> private static void RestoreBranchState <TTabModel, TTabViewModel> (TabablzControl tabablzControl, BranchState <TTabModel> branchState, Func <TTabModel, TTabViewModel> viewModelFactory) { var layout = Layout.Find(tabablzControl).RootLayout; var newHost = layout.InterLayoutClient.GetNewHost(tabablzControl.InterTabController.Partition, tabablzControl); var branch = Layout.Branch(tabablzControl, newHost.TabablzControl, branchState.Orientation, false, branchState.Ratio); RestoreBranchItemState(tabablzControl, branchState.FirstChild, viewModelFactory); RestoreBranchItemState(branch.TabablzControl, branchState.SecondChild, viewModelFactory); }
/// <summary> /// Restores the state of the branch /// </summary> /// <typeparam name="TTabModel">The type of tab model</typeparam> /// <typeparam name="TTabViewModel">The type of tab view model to be displayed in the app.</typeparam> /// <param name="tabablzControl">The control in which to restore the items</param> /// <param name="branchState">The state of the branch to be restored</param> /// <param name="viewModelFactory">The function that creates the view model based on a model</param> private static void RestoreBranchState <TTabModel, TTabViewModel>(TabablzControl tabablzControl, BranchState <TTabModel> branchState, Func <TTabModel, TTabViewModel> viewModelFactory) { var branchResult = Layout.Branch(tabablzControl, CopyTabablzControl(tabablzControl), branchState.Orientation, false, branchState.Ratio); RestoreBranchItemState(tabablzControl, branchState.FirstChild, viewModelFactory); RestoreBranchItemState(branchResult.TabablzControl, branchState.SecondChild, viewModelFactory); }