The Problem SolverWIndows Workflow Foundation
HomeShow ChangesEditPrintRecent ChangesSubscriptionsLost and FoundFind ReferencesRename



26-11-2007 08:13:445-10-2007 14:16:3612-6-2007 12:20:274-12-2006 17:36:024-12-2006 13:50:34

List all versions

I Activity Event Listener

The interface consists of a single member, the OnEvent with the QueueEventArgs type paramater.


Imports System.Workflow.ComponentModel

Public Class Activity1
    Inherits Activity
    Implements IActivityEventListener(Of QueueEventArgs)

    Public Sub OnEvent(ByVal sender As Object, ByVal e As QueueEventArgs) Implements IActivityEventListener(Of QueueEventArgs).OnEvent
        Dim context As ActivityExecutionContext
        context = CType(sender, ActivityExecutionContext)
    End Sub

    Protected Overrides Sub Initialize(ByVal provider As System.IServiceProvider)
        Dim context As ActivityExecutionContext
        context = CType(provider, ActivityExecutionContext)
        Dim wqs As WorkflowQueuingService = context.GetService(Of WorkflowQueuingService)()
        Dim queue As WorkflowQueue = wqs.CreateWorkflowQueue("MyQueueName", True)
        queue.RegisterForQueueItemAvailable(Me, QualifiedName)

    End Sub

    Protected Overrides Function Execute(ByVal executionContext As ActivityExecutionContext) As ActivityExecutionStatus
        Return ActivityExecutionStatus.Executing
    End Function
End Class

See also CombiningIEventActivityAndIActivityEventListener

Wiki Usage

This wiki site is supposed to be a shared resource. As a shared resource everyone is encouraged to add new content or modify existing content!

Enjoy the WF wiki.

Recent Topics