Wizard Architecture
The wizard system architecture — WizardManager, WizardInstance, form types, painters, step validation, and animation engine
Overview
The wizard system provides a complete multi-step wizard framework with 4 form styles, 4 painter styles, step validation, and animation:
- WizardManager — Static facade. CreateWizard(), ShowWizard(), wizard registry
- WizardInstance — Stateful instance. Navigate, validate, complete, cancel
- WizardForms — 4 form types: VerticalStepper, HorizontalStepper, Minimal, Cards
- WizardPainters — Corresponding painters for each form style
WizardManager
public static class WizardManager
{
public static WizardStyle DefaultStyle { get; set; } = WizardStyle.HorizontalStepper;
public static bool EnableAnimations { get; set; } = true;
public static WizardInstance CreateWizard(WizardConfig config);
public static DialogResult ShowWizard(WizardConfig config);
public static DialogResult ShowWizard(WizardConfig config, IWin32Window owner);
public static WizardInstance GetWizard(string key);
public static void CloseWizard(string key);
public static void CloseAllWizards();
}WizardInstance
public class WizardInstance
{
public WizardConfig Config { get; }
public WizardContext Context { get; }
public int CurrentStepIndex { get; }
public WizardStep CurrentStep { get; }
public bool IsFirstStep { get; }
public bool IsLastStep { get; }
public async Task<bool> NavigateNextAsync();
public async Task<bool> NavigateBackAsync();
public async Task<bool> CompleteAsync();
public void Cancel();
public Task<DialogResult> ShowDialogAsync();
public event EventHandler<StepChangingEventArgs> StepChanging;
public event EventHandler<StepChangedEventArgs> StepChanged;
public event EventHandler<WizardCompletedEventArgs> Completed;
public event EventHandler<WizardCancelledEventArgs> Cancelled;
}Wizard Forms
| Form | Style | Description |
|---|---|---|
| VerticalStepperWizardForm | Vertical stepper | Left sidebar with vertical step indicators |
| HorizontalStepperWizardForm | Horizontal stepper | Top horizontal step bar with progress |
| MinimalWizardForm | Minimal | Clean simple navigation without step indicators |
| CardsWizardForm | Cards | Card-based wizard with flip animation |
Wizard Painters
- VerticalStepperPainter — Paints left-side stepper with numbered circles and connector lines
- HorizontalStepperPainter — Paints top bar with connected step nodes
- MinimalPainter — Paints simple navigation bar
- CardsPainter — Paints card transitions
WizardConfig & Models
public class WizardConfig
{
public string Key { get; set; }
public string Title { get; set; }
public WizardStyle Style { get; set; }
public List<WizardStep> Steps { get; set; }
public bool ShowCancelButton { get; set; }
public bool AllowBackNavigation { get; set; }
public IWizardFormHost FormHost { get; set; }
}
public class WizardStep
{
public string Title { get; set; }
public string Description { get; set; }
public Control Content { get; set; }
public Func<bool> ValidateFn { get; set; }
public Action SaveFn { get; set; }
public string IconPath { get; set; }
}Examples
var config = new WizardConfig
{
Key = "setup",
Title = "Application Setup",
Style = WizardStyle.VerticalStepper,
Steps = new List<WizardStep>
{
new WizardStep
{
Title = "Welcome",
Description = "Get started with setup",
Content = new WelcomeControl()
},
new WizardStep
{
Title = "Configuration",
Description = "Configure settings",
Content = new ConfigControl(),
ValidateFn = () => ValidateConfig()
}
}
};
var result = WizardManager.ShowWizard(config);
if (result == DialogResult.OK)
ApplyConfiguration(config.Context);