The Problem SolverWIndows Workflow Foundation
HomeShow ChangesEditPrintRecent ChangesSubscriptionsLost and FoundFind ReferencesRename

Search

History

3-1-2007 12:20:083-1-2007 12:18:59

List all versions

Dynamic Set State Activity
.
Summary

Use the TargetStateName just as in the standard SetStateActivity to indicate the target state.

Imports System.Workflow.ComponentModel

Public Class DynamicSetStateActivity
    Inherits Activity

    Public Shared TargetStateNameProperty As DependencyProperty = DependencyProperty.Register("TargetStateName", GetType(String), GetType(DynamicSetStateActivity))

    <Description("This is the description which appears in the Property Browser")> _
    <Category("This is the category which will be displayed in the Property Browser")> _
    <Browsable(True)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)> _
    Public Property TargetStateName() As String
        Get
            Return (CType((MyBase.GetValue(DynamicSetStateActivity.TargetStateNameProperty)), String))
        End Get
        Set(ByVal Value As String)
            MyBase.SetValue(DynamicSetStateActivity.TargetStateNameProperty, Value)
        End Set
    End Property

    Protected Overrides Function Execute(ByVal executionContext As ActivityExecutionContext) As ActivityExecutionStatus
        Dim wqs As WorkflowQueuingService = executionContext.GetService(Of WorkflowQueuingService)()
        Dim queue As WorkflowQueue = wqs.GetWorkflowQueue("SetStateQueue")
        Dim e As New SetStateEventArgs(TargetStateName)
        queue.Enqueue(e)

        Return ActivityExecutionStatus.Closed
    End Function
End Class
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