Export (0) Print
Expand All

HandleExternalEventActivity.OnInvoked Method

Called just after the external event is received to allow derived classes to process the inbound EventArgs before the activity closes.

Namespace:  System.Workflow.Activities
Assembly:  System.Workflow.Activities (in System.Workflow.Activities.dll)

protected virtual void OnInvoked(
	EventArgs e
)

Parameters

e
Type: System.EventArgs

The EventArgs that are received from the external event that was just received.

The most common use of the OnInvoked method in derived classes is to extract members from the received EventArgs to set the values of the derived-classed activity's public properties.

The following example shows an implementation of the OnInvoked method. This example is from the Correlated Local Service SDK sample, from the TaskCompleted.cs file. For more information, see Correlated Local Service Sample.

private WorkflowQueue CreateQueue(ActivityExecutionContext context)
{
    Console.WriteLine("CreateQueue");
    WorkflowQueuingService qService = context.GetService<WorkflowQueuingService>();

    if (!qService.Exists(this.QueueName))
    {
        qService.CreateWorkflowQueue(this.QueueName, true);
    }

    return qService.GetWorkflowQueue(this.QueueName);
}

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft