TrackingService 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
在衍生類別中實作時,初始化 TrackingService 類別的新執行個體。
protected:
TrackingService();
protected TrackingService ();
Protected Sub New ()
範例
下列範例示範如何建立 TerminationTrackingService
物件的新執行個體,這個物件的型別衍生自 TrackingService
。 這個範例來自<終止追蹤服務 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