SetStateActivity Class
Provides the transition to a StateActivity in a state machine workflow. This class cannot be inherited.
Assembly: System.Workflow.Activities (in System.Workflow.Activities.dll)
The SetStateActivity can be used only in state machine workflows.
The SetStateActivity provides transitions only to leaf StateActivity activities (a StateActivity that does not contain other StateActivity activities).
The SetStateActivity only provides transitions between two StateActivity classes and does not support StateActivity to parent StateActivity transitions or any other combination.
The SetStateActivity has to be a leaf node within the activity tree of an event handler.
There can be more than one SetStateActivity but all the activities must be leaf nodes.
SetStateActivity is always the last activity in the run path of a EventDrivenActivity activity.
The following code example shows how to create a new instance of the SetStateActivity class and use it implement a simple state machine to transition between 3 states. This code example is part of the SimpleStateMachineWorkflow SDK Sample from the StateMachineWorkflow.cs file. For more information, see Simple State Machine.
Me.WhileLoop = New System.Workflow.Activities.WhileActivity() Me.Parallel = New System.Workflow.Activities.ParallelActivity() Me.Sequence1 = New System.Workflow.Activities.SequenceActivity() Me.Sequence2 = New System.Workflow.Activities.SequenceActivity() Me.ConsoleMessage1 = New System.Workflow.Activities.CodeActivity() Me.ConsoleMessage2 = New System.Workflow.Activities.CodeActivity() ' ' WhileLoop ' Me.WhileLoop.Activities.Add(Me.Parallel) AddHandler codecondition1.Condition, AddressOf Me.WhileCondition Me.WhileLoop.Condition = codecondition1 Me.WhileLoop.Name = "WhileLoop" ' ' Parallel ' Me.Parallel.Activities.Add(Me.Sequence1) Me.Parallel.Activities.Add(Me.Sequence2) Me.Parallel.Name = "Parallel"
System.Workflow.ComponentModel.DependencyObject
System.Workflow.ComponentModel.Activity
System.Workflow.Activities.SetStateActivity
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.