public void Configure(IList <BaseWizardStep> bases, BaseWizardStep nstep) { for (int i = 0; i < bases.Count; i++) { if (bases[i] is WizardStepGroup group) { var nextStep = i == bases.Count - 1 ? nstep : bases[i + 1]; group.StepsCount = group.Children.Count; group.HasChildren = true; bases[i].PrevStep = pstep; bases[i].NextStep = group.Children[0]; group.Children[0].PrevStep = bases[i]; if (i > 0) { bases[i].PrevStep = bases[i - 1]; } for (int j = 0; j < group.Children.Count; j++) { group.Children[j].Parent = group; } Configure(group.Children, nextStep); } else if (bases[i] is ExecutableWizardStep step) { if (step.Parent == null) { step.PrevStep = pstep; } if (bases.Count == 1) { step.NextStep = nstep; if (step.Parent == null) { step.PrevStep = pstep; } pstep = step; } if (i > 0 && i < bases.Count - 1 && bases.Count != 1) { step.NextStep = bases[i + 1]; if (bases[i - 1] is WizardStepGroup) { step.PrevStep = pstep; } else { step.PrevStep = bases[i - 1]; } } else if (i == 0 && i < bases.Count && bases.Count != 1) { step.NextStep = bases[i + 1]; } else if (i > 0 && i == bases.Count - 1) { if (bases[i - 1] is WizardStepGroup) { step.PrevStep = pstep; } else { step.PrevStep = bases[i - 1]; } pstep = step; if (step.IsLast) { step.NextStep = null; } else { step.NextStep = nstep; } } } } setupWizard.SelectedStep = bases[0]; }
public SetupWizardBuilder AddStep(BaseWizardStep baseWizardStep) { setupWizard.WizardSteps.Add(baseWizardStep); return(this); }
public ExecutableWizardStepBuilder SetPrevStep(BaseWizardStep prevStep) { executedWizardStep.PrevStep = prevStep; return(this); }
public WizardStepGroupBuilder AddChildren(BaseWizardStep childWizardStep) { executedWizardStep.Children.Add(childWizardStep); return(this); }
public ExecutableWizardStepBuilder SetNextStep(BaseWizardStep nextStep) { executedWizardStep.NextStep = nextStep; return(this); }