Serves as the root container for state machine workflows. Contains event-driven activities and states.
Assembly: System.Workflow.Activities (in System.Workflow.Activities.dll)
[ToolboxBitmapAttribute(typeof(StateMachineWorkflowActivity), "Resources.StateMachineWorkflowActivity.png")] [ActivityValidatorAttribute(typeof(StateActivityValidator))] [ComVisibleAttribute(false)] [ObsoleteAttribute("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")] public class StateMachineWorkflowActivity : StateActivity
Gets or sets the end StateActivity of the workflow.
Gets the name of the currently executing StateActivity.
Gets the value that indicates whether this instance is in design or run-time mode.(Inherited from DependencyObject.)
Gets or sets an ActivityCondition that determines whether dynamic updates can be made in the workflow, when overridden in a derived class.
Gets or sets a value that indicates whether this instance is enabled for execution and validation.(Inherited from Activity.)
Gets or sets the StateActivity in which the is when an instance of the state machine is created.
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.)
Gets the name of the previously executed StateActivity.
Gets the qualified name of the activity. Qualified activity names are always unique in a workflow instance.(Inherited from Activity.)
The name of the WorkflowQueue that is used to change the state of a . This field is constant.
Occurs when the activity execution is canceled. (Inherited from Activity.)
Occurs when an exception is raised during the running of the instance.(Inherited from Activity.)
This material discusses types and namespaces that are obsolete. For more information, see Deprecated Types in Windows Workflow Foundation 4.5.
Theis an activity container used to create workflows that follow a state machine model.
The CompositeActivity, which means the can contain other activities. The and the EventDrivenActivity activities are the only permitted child activities of the . EventDrivenActivity activities are permitted because the root activity itself behaves like a state. Therefore, you can have EventDrivenActivity activities at the root level that are used by all the State activities in the . EventDrivenActivity activities at this level provide a global mechanism for processing workflow events and automate state transitions. StateActivity activities provide a mechanism to define the various stages in the model.is a
The InitialStateNameProperty of the state machine is the state in which the state machine is when an instance of the state machine is created. The InitialStateNameProperty property is mandatory and must be provided when a is created. The InitialStateNameProperty of the state machine is like any other state activity that is contained within the state machine. The state activity can be a direct child of the root activity and a can have only one InitialStateNameProperty.
The CompletedStateNameProperty of the is a StateActivity activity that is designated as the end state of the . When a transition is made to the CompletedStateNameProperty, the workflow execution is completed. The CompletedStateNameProperty is not mandatory. This means that you can have a that is not completed. This does not mean that the state machine workflow is always active in memory. The might be unloaded as it waits for an event.
activities that never complete are especially useful in processing long running business transactions, as in the case of a purchase order received by a supplier. The fact that the purchase order was fulfilled does not mean that the purchase order process is over. The goods that are part of the purchase order might be returned or the purchase order might be amended and have additional items added to it after the fulfillment. Sometimes there might be a requirement to keep the purchase order records for an extended period of time for legal or other purposes. The fact that a workflow does not finish just means that the workflow remains in an unloaded state. There may be a case for retiring the workflows, which means that after a set period of time the workflow instance may be forced to shut down.
The following code example shows how to create a new instance of the 1974edbd-253d-4e01-9095-38ff9c3e749eclass and use it to implement a basic state machine to transition between three states. This code example is part of the SimpleStateMachineWorkflow SDK sample from the StateMachineWorkflow.cs file. For more information, see.
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";
Available since 3.0
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.