Visual Workflow Tracking
This sample demonstrates how to write a visual workflow tracking application using the debug functionality available through the .NET Framework 4.5.
The application executes a simple flowchart workflow (defined in Workflow.xaml) and re-hosts the workflow designer to display the currently executing workflow. As the workflow is executed, the currently executing activity is shown with a yellow outline and debug arrow. In addition, tracking records generated by the workflow are also displayed in the application window. For more information about workflow tracking, see Workflow Tracking and Tracing. For more information about re-hosting the workflow designer, see Rehosting the Workflow Designer.
The workflow simulator works by keeping two dictionaries. One contains a mapping between the currently executing activity object and the XAML line number in which the activity is instantiated. The other contains a mapping between the activity instance ID and the activity object. When tracking records are emitted using a custom tracking profile, the application determines the instance ID of the currently executing activity and maps it back to the XAML file that instantiated it. The rehosted workflow designer is then instructed to highlight the activity on the designer surface and use the same method as the workflow debugger, specifically drawing a yellow border around the activity and displaying a yellow arrow along the left side of the designer.
To use this sample
Open the WorkflowSimulator.sln file from the sample directory in Visual Studio 2010.
Press CTRL+SHIFT+B to build the solution.
Press CTRL + F5 to run the sample. This displays the Workflow.xaml file in a rehosted workflow designer window.
Click the File menu and select Run Workflow....
Notice the currently executing activity is highlighted as described previously and the tracking records are displayed on the right side of the application window.
When the workflow has completed, you can click any of the tracking records to inspect which activity it corresponds to.
The samples may already be installed on your machine. Check for the following (default) directory before continuing.