Loading...
1. Introduction

Microsoft has provided a sample to show the visual tracking in the workflow rehosted designer. This makes the designer really impressive because it makes the backend system also visible to the business. However, the standard WF activities are more developers friendly, it is important to expose the BPM visibility to the business.


2. Sample Background

In this sample, it is going to show how to get the visual workflow tracking work with BPM4Net. The reason we provide this sample is because WF only highlights activities inheriting from System.Activities.Activity. Activities like Decision in FlowChart, State in StateMachine cannot be highlighted because they are not System.Activities.Activity.

The reason of that is because the FlowChart and the StateMachine implements IActivityTemplateFactory so the Decision or the State can be added into those containers at the design time but cannot be added to other standard activities i.e. Sequence.


3. Attached Property

The Designer of each BPM4Net activity binds to ModelItem.IsHighlighted. This is a Boolean field. To pass the flag to the designer, WPF has given a good way of doing that through AttachedProperty.

The attached property is added to the AttachedPropertiesService before the WorkflowDesigner loads any workflow activity.


4. Show Debug

The ShowDebug function from the Microsoft Sample highlights the standard WF activities. This function is going to highlight the Process activity as well.


5. Highlight

The previous method does not cover other BPM activities because they are not System.Activities.ActivityS三. However, this method does select the activity as PrimarySelection. This means we can subscribe to the Selection and try to highlight the activity via the attached property.

The method HighlightSelectionForBPMActivities sets the IsHighlighted value of the ModelItem to true.


6. Downplay

We have achieved our goal to highlight the activities in BPM, however, when we start to run the sample, we noticed it did not remove the highlighted status after the BPM activity showed the closed status. What we can do it before we highlight any activity, we are going to iterate through all the activities in the current WorkflowDesigner to find the current completed activity and downplay it via the attached property.


7.Completion

See the following screenshots for the completion of the visual tracking sample.


8. Summary

You may find there are some other logics in the sample we have not covered here. This is because we also want to support the manual selection on the right panel after the execution but they are pretty much the same concepts we explained above.

Find the resources of this sample below: