After choosing from a set of dialogs shipped with SharpSetup, adding desired dialogs to your installer solution and scheduling them to display at appropriate point in installer sequence you may want to gain more control over step behaviour. This article shows you how.

Each step has 3 important properties that influence its behaviour and look (in adition to properties inherited from Control class):

  • Title - a short text that appears in bold near the top of the dialog,
  • Subtitle - a slightly longer text (up to two lines) that may appear just below step title,
  • StepType - an enumeration with one of 4 values:
    • None - an ordinary step with Back, Next and Cancel buttons; the Back button may be disabled when there is no previous step,
    • Last - a step with Finish button instead of Next button; Cancel button not visible,
    • Transitionary - causes Back and Next buttons to be disabled; in Entered event handler you should move to next step automatically, pressing Back button one the next step will omit this step,
    • TransitionaryOnetime - blocks Back and Next buttons as above; it also disables Back button on next step as this step may be visited only once.

In addition to that, each step has several important lifecycle events:

  • creation (constructor) - this is the place where you can perform one time step initialization,
  • Entering event - raised before showing given step allows you to decide at runtime whether the step should be shown for example based on user input in previous steps,
  • Entered event - allows you to perform actions after the step has been shown to the user,
  • OnNext event - allows you to perform actions when user clicks Next button; you may for example cancel leaving current step if user input is invalid,
  • OnBack event - allows you to perform actions when user clicks Back button,
  • OnFinish event - allows you to perform actions when user clicks Finish button; you may for example want to run application or show Readme file on exiting installation wizard.

Of course you still have access to all other events that are common for all WinForms controls (like Load event). To subscribe to any of these events you should open given step in control designer, open properties window, click on thunder icon, find appropriate step from the list above and double click.

How these properties and event can be used you can learn by viewing sample step templates shipped with SharpSetup. You should pay close attention to operations and properties exposed through Wizard property (of type ModernWizard) such as NextStep(), BackStep(), ContinueMove() (either BackStep() or NextStep() depending on user's last action), Cancel(), Finish(), BackButton or NextButton, etc.

Next article will present how to create your own SharpSetup step from scratch without using templates.

Previous in series: Using installer dialogs

Next in series: Controls overview