FlowSwitch<T> Activity Designer
The FlowSwitch<T> activity is a conditional node that provides branching for the flow of control based on match criterion when more than two alternative branches are required. If the flow branching requires only two paths, use the FlowDecision activity instead.
The FlowSwitch<T> Activity
The FlowSwitch<T> activity contains an Expression that returns a value of type T (specified by the generic parameter) when evaluated. The activity also contains a set of Cases, which specifies a unique mapping from possible results of this evaluation to a set of FlowNode objects. The FlowNode executed is the one whose object of type T matches the value of the evaluated Expression. A Default case can (optionally) be provided for the case in which no match is obtained.
Using the FlowSwitch<T> Activity Designer
The FlowSwitch<T> activity designer can be found in the Flowchart category of the Toolbox, which is accessed by clicking the Toolbox tab on the left side of the Workflow Designer. Alternatively, select Toolbox from the View menu, or press Ctrl+Alt+X.
The FlowSwitch<T> activity designer can be dragged from the Toolbox and dropped on to the Workflow Designer surface within a Flowchart activity designer. Use the Select Types window that displays to specify the type (associated in code with the FlowSwitch<T> by its generic parameter) obtained from evaluating the Expression. This procedure creates a FlowSwitch<T> activity labeled Switch within the Flowchart activity. The Expression can be typed in the Expression box of the Properties window by clicking where the hint text says "Enter a VB expression".
Mouse over the FlowSwitch<T> activity designer to cause the square handles that are used to link up Cases to appear around its edges. After dragging the FlowSwitch<T> activity designer and other activity designers onto the Flowchart, the Activity objects they represent are ready to be linked together to specify the order of execution. To create one of the Cases associated with the FlowSwitch<T>, click one of the square case handles on the perimeter of the FlowSwitch<T> and drag it (by holding down the mouse button) to one of the handles that appears in a similar manner around the destination activity when the mouse hovers over its designer. Release the mouse button and an arrow from the FlowSwitch<T> to the destination designer appears representing this case. The default value for this case displays on the arrow and it can be edited in the Case box of the Properties window.
The FlowSwitch<T> Properties
The following table shows the FlowSwitch<T> properties and describes how they are used in the designer. These properties can be edited in the property grid or on designer surface.
Property Name | Required | Usage |
---|---|---|
Expression | True | Specifies the expression that is evaluated to determine which of the Cases to switch to in the path of execution. |
Cases | False | Specifies a unique mapping from possible results obtained from evaluating the Expression to a set of FlowNode objects. |
Default | True | Specifies the mapping when the evaluation of the Expression does not match one of the values contained in the Cases object. |