TrackingService Constructor
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
When implemented in a derived class, initializes a new instance of the TrackingService class.
protected:
TrackingService();
protected TrackingService ();
Protected Sub New ()
Examples
The following example shows how to create a new instance of a TerminationTrackingService
object, of a type that derives from TrackingService
. This sample is from the Termination Tracking Service SDK sample. For more information, see Termination Tracking Service Sample.
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
Applies to
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.