Udostępnij za pośrednictwem


TrackingService Konstruktor

Definicja

Po zaimplementowaniu w klasie pochodnej inicjuje nowe wystąpienie TrackingService klasy.

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

Przykłady

W poniższym przykładzie pokazano, jak utworzyć nowe wystąpienie TerminationTrackingService obiektu typu pochodzącego z klasy TrackingService. Ten przykład pochodzi z przykładowego zestawu SDK usługi Termination Tracking Service. Aby uzyskać więcej informacji, zobacz Przykład usługi śledzenia zakończenia.

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

Dotyczy