Wraps an Activity whose execution is initialized by an event. This class cannot be inherited.
Assembly: System.Workflow.Activities (in System.Workflow.Activities.dll)
It is a CompositeActivity that is used to handle an event; typically it can be raised from the host or by the runtime in response to a delay timer expiring. is inherited from SequenceActivity; therefore, it is a sequence that has the additional restriction that the first activity should be an IEventActivity.
The first child of an activity must be an activity that inherits from IEventActivity. All subsequent children can be activities of any type. The IEventActivity blocks and waits for the pending occurrence of some events, such as starting a timer or the arrival of a message. When the event occurs, the IEventActivity finishes running and then all subsequent activities are executed.
When the StateMachineWorkflowActivity contains an , the has some restrictions:
The may contain one, and only one, activity of type IEventActivity.
The HandleExternalEventActivity must be the first child activity. An HandleExternalEventActivity cannot be in the event handler for a child activity and cannot be a child to the if the HandleExternalEventActivity is not the first child.
As long as the first activity is the HandleExternalEventActivity, the event handler can contain any activities. If an activity other than HandleExternalEventActivity is contained in , that activity cannot have an event handler.
For example, an activity that supports event handling can be used inside the but the activity cannot have event handlers attached to itself.
The following code example shows how to use the to perform state machine transitions. This code example is part of the SimpleStateMachineWorkflow SDK sample from the StateMachineWorkflow.cs file. For more information, see Simple State Machine.
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.