다음을 통해 공유


TrackingService 생성자

정의

파생 클래스에서 구현되는 경우에는 TrackingService 클래스의 새 인스턴스를 초기화합니다.

protected:
 TrackingService();
protected TrackingService ();
Protected Sub New ()

예제

다음 예제에서는 해당 형식이 TerminationTrackingService에서 파생된 TrackingService 개체의 새 인스턴스를 만드는 방법을 보여 줍니다. 이 샘플은 Termination Tracking Service SDK 샘플에 포함되어 있습니다. 자세한 내용은 종료 추적 서비스 샘플합니다.

using (WorkflowRuntime workflowRuntime = new WorkflowRuntime())
{
    AutoResetEvent waitHandle = new AutoResetEvent(false);
    NameValueCollection parameters = new NameValueCollection();
    parameters.Add("EventSource", eventSource);

    workflowRuntime.AddService(new TerminationTrackingService(parameters));
    workflowRuntime.WorkflowCompleted += delegate(object sender, WorkflowCompletedEventArgs e) { waitHandle.Set(); };
    workflowRuntime.WorkflowTerminated += delegate(object sender, WorkflowTerminatedEventArgs e)
    {
        Console.WriteLine(e.Exception.Message);
        waitHandle.Set();
    };

    WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(SampleWorkflow));
    instance.Start();

    waitHandle.WaitOne();
}
Using workflowRuntime As New WorkflowRuntime()

    Dim waitHandle As New AutoResetEvent(False)
    Dim parameters As New NameValueCollection()
    parameters.Add("EventSource", eventSource)

    workflowRuntime.AddService(New TerminationTrackingService(parameters))
    AddHandler workflowRuntime.WorkflowCompleted, AddressOf WorkflowRuntime_WorkflowCompleted
    AddHandler workflowRuntime.WorkflowTerminated, AddressOf WorkflowRuntime_WorkflowTerminated

    Dim instance As WorkflowInstance = workflowRuntime.CreateWorkflow(GetType(SampleWorkflow))
    instance.Start()

    waitHandle.WaitOne()
End Using

적용 대상