SetStateEventArgs 类

定义

警告

此 API 现已过时。

表示一个类,该类用作设置 StateMachineWorkflowActivity 状态的一个自变量。Represents a class that is used as an argument to set the state of a StateMachineWorkflowActivity.

public ref class SetStateEventArgs : EventArgs
[System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")]
[System.Runtime.InteropServices.ComVisible(false)]
[System.Serializable]
public class SetStateEventArgs : EventArgs
type SetStateEventArgs = class
    inherit EventArgs
Public Class SetStateEventArgs
Inherits EventArgs
继承
SetStateEventArgs
属性

注解

备注

本材料讨论的类型和命名空间已废弃不用。This material discusses types and namespaces that are obsolete. 有关详细信息,请参阅 Windows Workflow Foundation 4.5 中弃用的类型For more information, see Deprecated Types in Windows Workflow Foundation 4.5.

StateMachineWorkflowActivity 允许从主机应用程序设置状态。The StateMachineWorkflowActivity allows for setting the state from the host application. 这将使主机应用程序能够重写状态机的当前状态。This enables the host application to override the current state of a state machine. 为此,可以将 SetStateEventArgs 类的一个实例排入由常量 StateMachineWorkflowActivity.SetStateQueueName 命名的 WorkflowQueue 队列中。This can be accomplished by enqueuing an instance of the SetStateEventArgs class to the WorkflowQueue named by the constant StateMachineWorkflowActivity.SetStateQueueName.

完成此操作的较为简便的方法是使用 SetState 类中的 StateMachineWorkflowInstance 方法。A simpler way to accomplish this is to use the SetState method in the StateMachineWorkflowInstance class.

可以使用 SetState 方法从宿主执行 SetState 操作,或者可以通过将事件排入状态机工作流来亲自执行此操作,如下面的示例所示。You can use the SetState method to perform a SetState operation from the host, or you can do it yourself by enqueuing an event to the state machine workflow as shown in the following example.

public void SetState(string targetStateName)  
{  
      if (targetStateName == null)  
      {  
            throw new ArgumentNullException("targetStateName");  
      }  
      SetStateEventArgs args1 = new SetStateEventArgs(targetStateName);  
      this.WorkflowInstance.EnqueueItemOnIdle("SetStateQueue", args1, null, null);  
}  

状态机工作流使用名为 SetStateQueue 的特殊队列来侦听这些特殊事件。The state machine workflow uses a special queue called SetStateQueue to listen to these special events.

构造函数

SetStateEventArgs(String)

初始化 SetStateEventArgs 类的新实例。Initializes a new instance of the SetStateEventArgs class.

属性

TargetStateName

获取要将 StateActivity 设置到的状态。Gets the state to set the StateActivity to.

方法

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

适用于

另请参阅