public void Initialize(Framework.Models.WizardData wizardData, bool useCachedWizardData) { InitCommands(); InitializeWizardItems(); if (Items != null && Items.Count > 0) { List <Framework.Xaml.WizardStepItem> wizardStepItems = new List <Framework.Xaml.WizardStepItem>(); foreach (var item in Items) { if (!wizardStepItems.Any(t => t.WizardStepIndex == item.WizardStepIndex)) { var wizardStepItem = new Framework.Xaml.WizardStepItem { WizardStepIndex = item.WizardStepIndex, Active = false }; wizardStepItems.Add(wizardStepItem); item.WizardStepItem = wizardStepItem; } else { var wizardStepItem = wizardStepItems.First(t => t.WizardStepIndex == item.WizardStepIndex); item.WizardStepItem = wizardStepItem; } } this.WizardStepItems = wizardStepItems; } this.CurrentItem = Items.FirstOrDefault(); RaisePropertyChanged(nameof(EnableGoBackwardButton)); RaisePropertyChanged(nameof(EnableGoForwardButton)); if (useCachedWizardData) { // cached data if any this.Completed = wizardData.Completed; this.CurrentItem = this.Items.FirstOrDefault(t => t.Name.ToString() == wizardData.CurrentItemName); if (this.CurrentItem == null) { this.CurrentItem = Items.FirstOrDefault(); } if (wizardData.Items != null) { foreach (var item in wizardData.Items) { var wizardItemVM = this.Items.FirstOrDefault(t => t.Name.ToString() == item.Name); if (wizardItemVM != null) { wizardItemVM.Completed = item.Completed; } } } } }
public static async Task SetWelcomeWizardData(bool completed, string currentItemName, List <Framework.Models.WizardDataItem> wizardDataItems) { var wizardData = new Framework.Models.WizardData { Completed = completed , CurrentItemName = currentItemName , Items = wizardDataItems }; await SaveData(Key_WelcomeWizardData, wizardData); }