Rolex logo design using the replica watches crown icon and letter design would like to combine, which also positioned Rolex in the breitling replica watch industry status of the king, while the entire Swiss watch industry in the swiss replica watches folk has a good reputation.
WF 4.0 – Part 2. The Flowchart Workflow & Designer | John's Corner

Blog

WF 4.0 – Part 2. The Flowchart Workflow & Designer

UPDATE – Now Beta 1 Friendly!

The following is based on Beta 1 of WF 4.0 and as such might change or be missing in futures releases.

In Part 1 of this series of articles on WF 4.0 we started by looking at the new Sequential Workflow Designer, and creating a basic Sequential Workflow that added greeted a User. In this second part we will be looking at the new Flowchart Workflow and its designer.

So whats a Flowchart Workflow?

The Flowchart Workflow is a new hybrid of the Sequential and State Machine Workflows that we are already familiar with from 3.x. Even though WF was designed to be extensible so that people could extend it with their own custom Workflows, Microsoft found that a very large percentage of their customers using WF were bending over backwards to crowbar their Workflows into either the Sequential or State Machine types when neither were appropriate. From this Microsoft identified the need for a hybrid type, and this is the result.

So what do you use it for? This is easier to follow if we define when you’d want to use a Sequential and State Machine Workflow first.

So when do you use a Sequential Workflow?

The Sequential Workflow is ideal when you want to model a process that has a defined start and end points and follows a defined (linear) path through a number of Activities. Here’s an example:

As you can see even though we have branches in the Workflow, we always go through the same activities and end at our defined point. The Sequential is ideal for modelling Processes.

So when do you use a State Machine Workflow?

The State Machine Workflow is ideal when you want to model a process that doesn’t have a defined path and could be one of many paths that will be taken through the Activities. A State Machine does not necessarily need an End Point. Here’s an example we’re all familiar with.

The State Machine was for Version Control, and as we all know there is no definite path as to how we perform our check in/check outs. One of the best uses for the State Machine Workflow is for Lifecycles of objects, where we have a defined number of States an object can be, in but the direction of state changes comes from an external source.

What about this new Flowchart Workflow?

So hopefully you’ve now got some idea as to what the original Workflows could do and where they might be used. We can now take a look at the Flowchart Workflow. One of the biggest differences between 3.x and 4.0 is that there is no longer any restriction on which kind of Workflow an Activity can be used on, so our Flowchart Workflow can use exactly the same activities as we did on the Sequential example.

So first off the designer.


As you can see we have the same features as before from the Sequential designer, but this time we have different rules as to how the Activities interact. First off we no longer get connections for free between activities. This is of course down to the nature of the Workflow type, as the designer can’t guess what Activities we want to join together and how. So to join Activities together we select the start Activity and then drag one of the edge connectors to the target Activity’s edge connector.

http://content.screencast.com/users/ImajiWolfshead/folders/Jing/media/f9373624-cb21-41d6-8d31-ff695a2e1f86/jingswfplayer.swf

Again Variable and Arguments are used in exactly the same way as we did with the Sequential Designer. The Flowchart Workflow currently comes with 3 extra Items (not Activities) that allow us to add decision logic into the Workflow. The first is the FlowDecision which acts as a simple If statement in the logic.



This is actually a very simple Item to use, again dragging from either the green True connector or red False connector to another Activity will give you the path when either a True or False result comes from the Condition you set. The Condition is something that evaluates and returns a boolean result. So far I’ve been using things like VariableName.Equals(“StringToMatch”) for the condition. I suspect that in future releases this may have some sort of Expression Editor to it (but this is just my speculation).

The second new item is the FlowSwitch, and looks very similar to the FlowDecision.


OK, so lets put this altogether. I’m going to create a simple Workflow for Pizza management at User Group talks. It’s going to ask us our location, if its the home region of Southampton then it’ll tell me I need to order Pizza. If it’s not Southampton, I’m doing a WF talk somewhere else so I remind the User Group leader. Then because I could in theory be doing a marathon number of talks in one day, it’ll ask if my location has changed and if it has we go back to the beginning, otherwise the flow end.

Using the custom Readline and Writeline Activities that were also used on the Sequential Workflow, this is the result. For details as to how to bind to Variables and create them, see Part 1.


A screen cast with the construction of the Pizza Flowchart, will follow shortly.

In Part 3, we will be looking at creating a custom Activity.

Posted in .Net, .Net 4.0, Visual Studio 2010, VS, VS2010, WF, WF 4.0, Workflow | 1 Comment

One Response to WF 4.0 – Part 2. The Flowchart Workflow & Designer

  1. Will be there parallel activity on FlowChart (fork)?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>