How to Add Support for Multiple Choice Prompts

This example shows how to add support for multiple-choice prompts when implementing a custom host. This allows the host application to display a prompt in which the user can select more than one choice from the choices displayed by the prompt.

This example shows how to add this support to an existing host user interface class. For an example of of implementing a host user interface class, see How to Implement a Host User Interface.

To add support for multiple-choice prompts

  1. Add the IHostUISupportsMultipleChoiceSelection interface to the class declaration of your host user interface class.

  2. Implement the System.Management.Automation.Host.IHostUISupportsMultipleChoiceSelection.PromptForChoice(System.String,System.String,System.Collections.ObjectModel.Collection{System.Management.Automation.Host.ChoiceDescription},System.Collections.Generic.IEnumerable{System.Int32}) method. Following this procedure is a complete implementation of this method.

To see a sample host application that implements this support, see Host04 Sample.

Example

This example shows how to implement the PromptForChoice method.

See Also



Show:
© 2014 Microsoft