-
Notifications
You must be signed in to change notification settings - Fork 2
Getting Started with Wizards
Make sure you referenced
Craftplacer.ClassicSuite.Wizards
in your project
- Create a new
UserControl
- View the control's code by pressing F7, or right-clicking and selecting "View Code"
- Change the base type from
UserControl
toWizardPage
.
- public partial class MyCoolPage : UserControl
+ public partial class MyCoolPage : WizardPage
- Start adding controls to the page.
The WizardForm
is the main component of this library. It controls navigation and the outer interface of pages. There are multiple ways to interface with it.
A WizardForm
can be also constructed using WizardForm.FromList(...)
, it takes in IEnumerable<WizardPage>
(i.e. a list of pages).
That methods automatically links pages together with their next one. Using this method is easy as:
var wizard = WizardForm.FromList(new WizardPage[]
{
new StartPage(),
new FirstPage(),
new SecondPage(),
});
This method requires you to manually define the next page of another page.
You can do this by setting the NextPage
property inside the constructor of your page control.
public FirstPage()
{
InitializeComponent();
NextPage = new SecondPage();
}
You can invoke the WizardForm
by simple passing the starting page in its constructor like:
var startPage = new FirstPage();
var wizard = new WizardForm(startPage);
WizardForm
will simply assume it's the end of the wizard and finish after that.
Since WizardForm
is just a regular Form
, it can be invoked like any other Form
.
// If the application loop (Application.Run()) is already running:
wizardForm.ShowDialog();
// When your entire application uses the wizard interface:
Application.Run(wizardForm);
This is the most basic usage of this library, there are pages about customizing pages and asynchronous work.