Example #1
0
        /// <summary>
        /// Restores the state of the tabSet
        /// </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="tabSetState">The state of the tab set to be restored</param>
        /// <param name="viewModelFactory">The function that creates the view model based on a model</param>
        public static void RestoreTabSetState <TTabModel, TTabViewModel>(TabablzControl tabablzControl, TabSetState <TTabModel> tabSetState, Func <TTabModel, TTabViewModel> viewModelFactory)
        {
            foreach (var tabModel in tabSetState.TabItems)
            {
                tabablzControl.AddToSource(viewModelFactory(tabModel));
            }

            tabablzControl.Dispatcher.BeginInvoke(new Action(() =>
            {
                tabablzControl.SelectedIndex = tabSetState.SelectedTabItemIndex ?? -1;
            }), DispatcherPriority.Loaded);
        }
Example #2
0
 /// <summary>
 /// The generic constructor, used by the Json deserializer
 /// </summary>
 /// <param name="itemAsBranch">If this item is a branch, this parameter must contain the branch state (<c>null</c> otherwise)</param>
 /// <param name="itemAsTabSet">If this item is a tab set, this parameter must contain the tab set state (<c>null</c> otherwise)</param>
 public BranchItemState(BranchState <TTabItem> itemAsBranch, TabSetState <TTabItem> itemAsTabSet)
 {
     this.ItemAsBranch = itemAsBranch;
     this.ItemAsTabSet = itemAsTabSet;
 }