Share via


Adding a User Experience to a Reusable Component

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies.
This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Your organization has developed a reusable component, such as an application block, with the following properties:

  • Its functionality belongs to a single, finely scoped domain (for example, logging or caching).
  • Its functionality is applicable and valuable to many different applications.
  • It has no architectural or design constraints on applications that use the component.
  • Its behavior can be customized through configuration.
  • Its functionality can be extended with pluggable providers.

The component is developed and maintained by a centralized team in the organization. The component is updated where necessary, based on new requirements and feedback from the organization’s developers. However, the team that owns the component does not want individual project teams to modify the source, so the component is distributed in binary form.

You want to add an integrated user experience to the reusable component.

Scenario Goals

You want to use the features of the Guidance Automation Toolkit to simplify the following processes:

  • Adding the component to the application for the first time
  • Configuring the component for some common scenarios
  • Generating prototype code that the application uses to call the component
  • Extending the application block with plug-in components

Implementing a User Experience with Guidance Automation Toolkit

To meet the stated goals, you assemble a Guidance Package that consists of a number of recipes, wizards, and templates. The Guidance Package meets the scenario goals in the following ways:

  • Adding the component to the application for the first time
  • Configuring the component for common scenarios
  • Generating prototype code that the application uses to call the component
  • Extending the application block through plug-in components

Adding the Component to the Application for the First Time

You create an unbound recipe that launches a wizard, prompting for basic information about how the component should be used. The recipe creates a reference to the component’s assembly, creates configuration files and any classes required based on the arguments provided in the wizard, and attaches a bound recipe reference to the configuration file. The recipe is associated with all code projects in the solution.

Configuring the Component for Common Scenarios

You create a bound recipe that, when activated, displays a wizard that gathers information about how the components should be used. The recipe uses the information to modify the configuration file so that it meets the user’s requirements. The recipe reference is attached to the configuration file by the unbound recipe described in the previous section.

Generating Prototype Code that the Application Uses to Call the Component

You create an unbound recipe that launches a wizard, gathering arguments that determine how the component is called. The recipe creates a fragment of code and adds it to the current class. The recipe is associated with all classes in projects that have references to the component.

Extending the Application Block Through Plug-in Components

You create a recipe that launches a wizard. The wizard prompts for basic information about the plug-in, such as name, and whether it requires properties from a configuration file. The recipe generates a plug-in class from a template and updates the component's configuration file to use the new extension. You also create a Visual Studio Item template, which is responsible for launching the recipe. The Item template is added to the Add New Item dialog box.

See also

Common Scenarios | Adding a User Experience to an Application Framework | Packaging an Application Architecture as a Reusable Guidance | Adding a User Experience Around a Pattern