Export (0) Print
Expand All

Visual Workflow Tracking

This topic applies to Windows Workflow Foundation 4 (WF4).

This sample demonstrates how to write a visual workflow tracking application using the debug functionality available through the .NET Framework 4.

Sample Details

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

  1. Open the WorkflowSimulator.sln file from the sample directory in Visual Studio 2010.

  2. Press CTRL+SHIFT+B to build the solution.

  3. Press CTRL + F5 to run the sample. This displays the Workflow.xaml file in a rehosted workflow designer window.

  4. Click the File menu and select Run Workflow....

  5. Notice the currently executing activity is highlighted as described previously and the tracking records are displayed on the right side of the application window.

  6. When the workflow has completed, you can click any of the tracking records to inspect which activity it corresponds to.

Ee624139.Important(en-us,VS.100).gif Note:
The samples may already be installed on your computer. Check for the following (default) directory before continuing.

<InstallDrive>:\WF_WCF_Samples

If this directory does not exist, go to Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4 to download all Windows Communication Foundation (WCF) and WF samples. This sample is located in the following directory.

<InstallDrive>:\WF_WCF_Samples\WF\Application\VisualWorkflowTracking

Community Additions

ADD
Show:
© 2014 Microsoft