SetStateEventArgs 类   
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
注意
The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*
表示一个类,该类用作设置 StateMachineWorkflowActivity 状态的一个参数。
public ref class SetStateEventArgs : EventArgs[System.Runtime.InteropServices.ComVisible(false)]
[System.Serializable]
public class SetStateEventArgs : EventArgs[System.Runtime.InteropServices.ComVisible(false)]
[System.Serializable]
[System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")]
public class SetStateEventArgs : EventArgs[<System.Runtime.InteropServices.ComVisible(false)>]
[<System.Serializable>]
type SetStateEventArgs = class
    inherit EventArgs[<System.Runtime.InteropServices.ComVisible(false)>]
[<System.Serializable>]
[<System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")>]
type SetStateEventArgs = class
    inherit EventArgsPublic Class SetStateEventArgs
Inherits EventArgs- 继承
- 属性
注解
注意
本材料讨论的类型和命名空间已废弃不用。 有关详细信息,请参阅 Windows Workflow Foundation 4.5 中弃用的类型。
StateMachineWorkflowActivity 允许从主机应用程序设置状态。 这将使主机应用程序能够重写状态机的当前状态。 为此,可以将 SetStateEventArgs 类的一个实例排入由常量 StateMachineWorkflowActivity.SetStateQueueName 命名的 WorkflowQueue 队列中。
完成此操作的较为简便的方法是使用 SetState 类中的 StateMachineWorkflowInstance 方法。
可以使用 SetState 方法从宿主执行 SetState 操作,或者可以通过将事件排入状态机工作流来亲自执行此操作,如下面的示例所示。
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 的特殊队列来侦听这些特殊事件。
构造函数
| SetStateEventArgs(String) | 
				已过时.
			 初始化 SetStateEventArgs 类的新实例。 | 
属性
| TargetStateName | 
				已过时.
			 获取要将 StateActivity 设置到的状态。 | 
方法
| Equals(Object) | 
		已过时.
	 确定指定对象是否等于当前对象。(继承自 Object) | 
| GetHashCode() | 
		已过时.
	 作为默认哈希函数。(继承自 Object) | 
| GetType() | 
		已过时.
	 获取当前实例的 Type。(继承自 Object) | 
| MemberwiseClone() | 
		已过时.
	 创建当前 Object 的浅表副本。(继承自 Object) | 
| ToString() | 
		已过时.
	 返回表示当前对象的字符串。(继承自 Object) |