IEventActivity.Subscribe 方法

定义

创建 Activity 对事件的订阅。

public:
 void Subscribe(System::Workflow::ComponentModel::ActivityExecutionContext ^ parentContext, System::Workflow::ComponentModel::IActivityEventListener<System::Workflow::ComponentModel::QueueEventArgs ^> ^ parentEventHandler);
public void Subscribe (System.Workflow.ComponentModel.ActivityExecutionContext parentContext, System.Workflow.ComponentModel.IActivityEventListener<System.Workflow.ComponentModel.QueueEventArgs> parentEventHandler);
abstract member Subscribe : System.Workflow.ComponentModel.ActivityExecutionContext * System.Workflow.ComponentModel.IActivityEventListener<System.Workflow.ComponentModel.QueueEventArgs> -> unit
Public Sub Subscribe (parentContext As ActivityExecutionContext, parentEventHandler As IActivityEventListener(Of QueueEventArgs))

参数

parentContext
ActivityExecutionContext

表示 ActivityExecutionContext 的执行环境的 Activity

parentEventHandler
IActivityEventListener<QueueEventArgs>

父事件的 EventHandler

示例

下面的代码示例说明如何使用 Subscribe 方法。 此代码示例摘自 FileSystemEvent.cs 文件中的“FileWatcher”SDK 示例。 有关详细信息,请参阅 文件系统观察程序活动

// Create EventHandlers for the WorkflowRuntime
workflowRuntime.WorkflowTerminated += new EventHandler<WorkflowTerminatedEventArgs>(WorkflowRuntime_WorkflowTerminated);
' Create EventHandlers for the WorkflowRuntime
AddHandler workflowRuntime.WorkflowTerminated, AddressOf WorkflowRuntime_WorkflowTerminated

适用于