private void RegisterViews(IWizardContext context) { ValidateContext(context); stepViews = new List <object>(); var stepsRegion = GetStepsRegion(wizardRegionManager); var orderedSteps = context.OrderBy((s) => s.Index).ToList(); foreach (var step in orderedSteps) { wizardContainer.RegisterType(step.IViewModel, step.ViewModel); wizardRegionManager.RegisterViewWithRegion(stepsRegion.Name, () => { var viewType = step.View; var stepViewInstance = wizardContainer.Resolve(viewType); stepViews.Add(stepViewInstance); return(stepViewInstance); }); } var firstStep = orderedSteps.FirstOrDefault(); if (firstStep != null) { firstStep.IsCurrent = true; } }
private void ValidateContext(IWizardContext context) { var duplicateSteps = context.Select(ci => ci.Index).GroupBy(i => i). Where(g => g.Count() > 1).Select(g => g.Key); if (duplicateSteps.Count() > 0) { throw new Exception("Found duplicated step indices. All step indices must be unique"); } var duplicateViewTypes = context.Select(ci => ci.View).GroupBy(i => i). Where(g => g.Count() > 1).Select(g => g.Key); if (duplicateViewTypes.Count() > 0) { throw new Exception("Found duplicated view types. Each step should have it's own unique view type"); } }
private void SwitchStepView(WizardStep currentStep, WizardStep nextStep, IWizardContext context) { if (currentStep != null) { if (currentStep.Index == nextStep.Index) // don't switch to already active step { return; } currentStep.IsCurrent = false; var region = GetStepsRegion(wizardRegionManager); var viewToActivate = stepViews[nextStep.Index]; //region.Views.Where((v) => v.GetType() == nextStep.View).FirstOrDefault(); if (viewToActivate != null) { region.Activate(viewToActivate); eventAggregator.GetEvent <UpdateNavBarEvent>().Publish(context); nextStep.IsCurrent = true; } } }
public virtual void OnCancel( IWizardContext context, CancelEventArgs e ) { }
public abstract WizardPage CreateInitialPage( IWizardContext context );
public virtual void OnPageOpened( IWizardContext context ) { _context = context; }
public virtual void OnPageClosed() { _context = null; }
private void OnUpdateNavBarEvent(IWizardContext context) { UpdateSteps(); }