This API is now obsolete.
Represents a state in a StateMachineWorkflowActivity.
public ref class StateActivity : System::Workflow::ComponentModel::CompositeActivity
[System.Drawing.ToolboxBitmap(typeof(System.Workflow.Activities.StateActivity), "Resources.StateActivity.png")] [System.Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")] [System.Runtime.InteropServices.ComVisible(false)] [System.Workflow.ComponentModel.Compiler.ActivityValidator(typeof(System.Workflow.Activities.StateActivityValidator))] public class StateActivity : System.Workflow.ComponentModel.CompositeActivity
type StateActivity = class inherit CompositeActivity
Public Class StateActivity Inherits CompositeActivity
The following code example shows how to create a new instance of the StateActivity 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.
this.WhileLoop = new System.Workflow.Activities.WhileActivity(); this.Parallel = new System.Workflow.Activities.ParallelActivity(); this.Sequence1 = new System.Workflow.Activities.SequenceActivity(); this.Sequence2 = new System.Workflow.Activities.SequenceActivity(); this.ConsoleMessage1 = new System.Workflow.Activities.CodeActivity(); this.ConsoleMessage2 = new System.Workflow.Activities.CodeActivity(); // // WhileLoop // this.WhileLoop.Activities.Add(this.Parallel); codecondition1.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.WhileCondition); this.WhileLoop.Condition = codecondition1; this.WhileLoop.Name = "WhileLoop"; // // Parallel // this.Parallel.Activities.Add(this.Sequence1); this.Parallel.Activities.Add(this.Sequence2); this.Parallel.Name = "Parallel";
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"
This material discusses types and namespaces that are obsolete. For more information, see Deprecated Types in Windows Workflow Foundation 4.5.
The StateActivity represents a State in a StateMachineWorkflowActivity. State activities could contain one or more EventDrivenActivity, or StateActivity classes, one StateInitializationActivity class, and one StateFinalizationActivity class. SetState activities are used inside an EventHandlersActivity and StateInitializationActivity to move the state of the workflow.
When a StateActivity is executing, the only events that can be received are the events that can be handled by the EventDrivenActivity activities in the StateActivity and also the EventDrivenActivity activities attached to the enclosing StateActivity activities and the root Activity.
When the StateActivity starts running, the StateActivity will check to see whether a StateInitializationActivity activity is present or not. The StateActivity can have zero or one StateInitializationActivity activity. If a StateInitializationActivity activity is present the StateInitializationActivity will be executed. As soon as the StateInitializationActivity activity finishes, the StateActivity blocks events so that the StateActivity only receives events that can be handled by its EventDrivenActivity activities.
|StateActivity() StateActivity() StateActivity() StateActivity()||
Initializes a new instance of the StateActivity class.
|StateActivity(String) StateActivity(String) StateActivity(String) StateActivity(String)||
Initializes a new instance of the StateActivity class using the name of the activity.
|StateChangeTrackingDataKey StateChangeTrackingDataKey StateChangeTrackingDataKey StateChangeTrackingDataKey||
Holds the string value of the change tracking data key; "StateActivity.StateChange". This field is a constant.
|Canceling Canceling Canceling Canceling||
Occurs when the activity execution is canceled.(Inherited from Activity)
|Closed Closed Closed Closed||
Occurs when an Activity has completed execution.(Inherited from Activity)
|Compensating Compensating Compensating Compensating||
Occurs when running a compensation method on the Activity.(Inherited from Activity)
|Executing Executing Executing Executing||
Occurs when the Activity is run.(Inherited from Activity)
|Faulting Faulting Faulting Faulting||
Occurs when an exception is raised during the running of the instance.(Inherited from Activity)
|IComponent.Disposed IComponent.Disposed IComponent.Disposed IComponent.Disposed||
Represents the method that handles the Disposed event of a component.(Inherited from DependencyObject)
|StatusChanged StatusChanged StatusChanged StatusChanged||Activity)|
|Activities Activities Activities Activities||
Gets the object representing the collection, ActivityCollection, of all child activities.(Inherited from CompositeActivity)
|CanModifyActivities CanModifyActivities CanModifyActivities CanModifyActivities||
Gets or sets a value which controls whether the individual activities within Activities can be modified.(Inherited from CompositeActivity)
|Description Description Description Description||
Gets or sets the user-defined description of the Activity.(Inherited from Activity)
|DesignMode DesignMode DesignMode DesignMode||
Gets the value that indicates whether this instance is in design or run-time mode.(Inherited from DependencyObject)
|Enabled Enabled Enabled Enabled||
Gets or sets a value that indicates whether this instance is enabled for execution and validation.(Inherited from Activity)
|EnabledActivities EnabledActivities EnabledActivities EnabledActivities||
Gets the read-only collection that represents the subset of Activities that are enabled.(Inherited from CompositeActivity)
|ExecutionResult ExecutionResult ExecutionResult ExecutionResult||
Gets the ActivityExecutionResult of the last attempt to run this instance.(Inherited from Activity)
|ExecutionStatus ExecutionStatus ExecutionStatus ExecutionStatus||
Gets the current ActivityExecutionStatus of this instance.(Inherited from Activity)
|IsDynamicActivity IsDynamicActivity IsDynamicActivity IsDynamicActivity||
Gets information about whether the activity is executing within the default ActivityExecutionContext of the workflow instance.(Inherited from Activity)
|Name Name Name Name||
Gets or sets the name of this instance. This name must conform to the variable naming convention of the programming language that is being used in the Workflow project.(Inherited from Activity)
|Parent Parent Parent Parent||Activity)|
|ParentDependencyObject ParentDependencyObject ParentDependencyObject ParentDependencyObject||DependencyObject)|
|QualifiedName QualifiedName QualifiedName QualifiedName||
Gets the qualified name of the activity. Qualified activity names are always unique in a workflow instance.(Inherited from Activity)
|Site Site Site Site||DependencyObject)|
|UserData UserData UserData UserData||
Gets an IDictionary that associates custom data with this class instance.(Inherited from DependencyObject)
|WorkflowInstanceId WorkflowInstanceId WorkflowInstanceId WorkflowInstanceId||
Gets the Guid associated with the instance.(Inherited from Activity)