Form Development in Visual Studio
A form can be used as an activity in a workflow subprocess to provide a user interface (UI) that works with a workflow task step.
Introduction
A form can display data or allow you to interact with a running process, or both. VB.Net projects with user controls are used to build the forms. A pre-built base form is provided to reduce the amount of coding required. The base form handles implementing the communication interfaces to and from a workflow.
References are used to add classes to the coding project. Overrides are used to override the inputs and outputs of the base form and to allow the passing of inputs to and from a workflow into your form code. A ValidateForm method allows code to be used to verify the data in the form and provide a message to the end user if the data is not valid.
These are the core aspects of building custom forms. This section also includes advanced topics for reading and writing data internally to and from the form and also to subscribe to events within the form.
Supported UI Technology Types
The following are the UI technology types supported in Workflow:
- Windows Forms (WinForms)
- Web
- Windows Presentation Foundation (WPF)
This section deals primarily with WPF-based forms that are developed in Visual Studio 2005 or 2008 with VB.Net. WinForm-based development is similar; however, there are several steps that differ. Additional notes are provided for those steps where WinForm-based development differs.
Prerequisites
To build forms, you need either:
- Visual Studio 2008 (for WPF forms or WinForms)
- Visual Studio 2005 (for WinForms only).
Features and Capabilities of Forms
- Inherit from an existing BaseForm to minimize coding
- Pass data into and out of the form
- Validation capability
- Read data internally from other available data service providers to the form, as well as from Workflow
- Write data from the form to other data service providers, as well as outputs to Workflow
- Forms can be set up to published events from other service providers, as well as Workflow events
The Interfaces
In order to communicate with the Workflow client in a standard way, a form should implement the IForm
interface. You can implement the interfaces yourself, but the easiest way to achieve this is to extend a base class.
Available Forms
A base form is provided, which implements the communication interfaces. To use the base form, you must inherit it, and then override three methods (to input, output, and validate data). It is located in the Program folder of the installation directory, and is called Proficy.Platform.Samples.Forms.BaseForm.dll.
Sample forms are also included. You can copy one of the sample forms and modify it to create a new form. The samples are available for download.