共用方式為


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 檔案中<檔案監看員活動 SDK>範例的一部分。 如需詳細資訊,請參閱 文件系統監看員活動

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

適用於