|
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.Workflow.Runtime.Tracking;
namespace CustomTrackingService
{
/// <summary>
/// The workflow runtime engine requests a tracking channel from each tracking
/// service that has provided a TrackingProfile for a workflow instance.This class
/// implements the TrackingChannel class
/// </summary>
class MyTrackingChannel : TrackingChannel
{
/// <summary>
/// When implemented in a derived class, notifies a receiver of data on the
/// tracking channel that the workflow instance associated with the tracking
/// channel has either completed or terminated.
/// We in our case , don't require it.
/// </summary>
protected override void InstanceCompletedOrTerminated()
{
}
/// <summary>
/// The runtime tracking infrastructure calls Send to deliver a TrackingRecord on
/// the TrackingChannel when it matches a track point in a TrackingProfile.
/// You can treat the tracking information sent on the TrackingChannel in whatever manner the requirements of your application dictate.
/// In our case we are using the output window.
/// </summary>
/// <param name="record"></param>
protected override void Send(TrackingRecord record)
{
// These are three different types of tracking records available.
ActivityTrackingRecord atr = record as ActivityTrackingRecord;
WorkflowTrackingRecord wtr = record as WorkflowTrackingRecord;
UserTrackingRecord utr = record as UserTrackingRecord;
Debug.WriteLine(string.Format("Received an tracking record [{0}]" , record.EventDateTime.ToShortDateString()));
if( atr!= null)
{
Debug.WriteLine("\tReceived an activity tracking record");
Debug.WriteLine(string.Format("\t\tName[{0}],Status[{1}]",atr.QualifiedName,atr.ExecutionStatus));
}
else if (wtr!= null)
{
Debug.WriteLine("\tReceived an workflow tracking record");
Debug.WriteLine(string.Format("\t\tName[{0}]",wtr.TrackingWorkflowEvent.ToString()));
}
else if (utr!= null)
{
Debug.WriteLine("\tReceived an user tracking record");
Debug.WriteLine(string.Format("\t\tName[{0}]",utr.UserData));
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Akshay loves exploring new technologies. C# is his preferred mode of expression.