Using Windows Home Server Wizards

by fkollmann 3/8/2009 11:31:40 PM

Today I implemented a wizard on the Windows Home Server Console. Honestly, since the wizard mechanism of WHS is not compatible with the designer, it took me and Reflector a long time to figure out how it works and which members are important.

I ended up with creating some wrapper classes which allow to actually create the wizard pages using the designer:

  image2   image 

 

Note: The implementation of the wrappers are part of the RouterControl.Whs assembly under the namespace RouterControl.Whs.Wizards. A full code example can be found in the WHS add-in code: RouterControl.WhsAddin.Wizards.

The wizard consists of two object types: the wizard itself and one or more wizard pages. The wizard is just a few lines of code and does nothing more than to register the pages to use (example). The wizard pages are then simply user controls which inherit WizardPageClientBase or WizardPageClientBannerTop to be precise (example).

To run the wizard, the wizard class is instanced and its Run() metod called:

        private void createNewLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            try
            {
                var wiz = new Wizards.EditPortForwarding();

                wiz.Run();
            }
            catch (Exception ex)
            {
                _log.Error("Failed to run edit-port-forwarding wizard", ex);
            }
        }

I do not want to end up in details because all the source is open. You can either download the source or browse the changeset directly.

Comments