Three Key Steps for Designing the UI: An Overview
There are three steps to adding a user interface to any component, and each will be examined in detail. However, it is essential that you build the actual component first; get the functionality working properly, iron out any problems, tweak the performance, and make sure it installs properly. Once those core tasks are complete, you can add the polish to the solution by designing the UI. Trying to build anything other than a simple UI at the same time you are building the component can create unnecessary overhead in keeping the two projects working well in tandem. With that said, here’s a summary of each of the three key UI steps.
- The first step is to add a class that implements the IDtsComponentUI interface. This defines the methods needed for the designer to interact with your user interface class. This class is not the visible UI itself; rather, it provides a way for the designer to request what it needs when it needs it and exposes several methods that enable you to hook into the life cycle of your UI. For example, you have a New method, which is called when a component is first added to a package, and an Edit method, which is called when you open an existing component inside your package. The interface is expanded on in the following paragraphs.
- The second step is to actually build the visible interface, normally a Windows Form. The form is invoked from the IDtsComponentUI.Edit method; by customizing the constructor, you can pass through references to the base component and supporting services. The form then displays details such as component properties or data-handling options, including inputs, outputs, and columns within each.
- The final stage is to update the component itself to tell the designer that you have provided a user interface and where to find it, or specifically where to find the IDtsComponentUI implementation. You do this through the UITypeName property of the DtsPipelineComponent attribute, which decorates the component, your existing PipelineComponent inheriting class. The UITypeName is the fully qualified name of the class implementing your user interface, enabling the designer to find the assembly and class to invoke the user interface when required through the interface methods mentioned previously.
In summary, you need a known interface with which the designer can interact along with a form that you display to the user through the relevant interface method; the component also needs to advertise that it has a user interface and provide instructions about where to find the UI when required.