Tuesday, May 26, 2009

Creating Simple Sequential Workflow in WF 4.0

In this simple WF Application i am going to loop through 1 to 10

First Create new Sequential Workflow  Console Application project.

image

Now Drag and Drop WriteLine  Activity from Tool box .  Press F4 and Edit Text Property (Enter the Text in “”).   Next Drag and Drop While Activity from the Toolbox.

Note: WriteLine Activity is used for to write some text in Console.

image

Inside the while activity now Drag and Drop Sequence activity so that  we can add more then one Activity inside While.  In while activity we need to set the condition so first we need to create Variables called counter, number and use Assign activity  to manipulate the counter variable as shown below.

image

image

Now Drag and Drop If Activity   and edit the condition and Drag and Drop  WriteLine Activity in both  Then  and Else  part as shown. change the DisplayName of the WriteLine Activity as shown below.

image

Here is the XAML  View of the  above Work Flow . the same workflow we can write in C#/VB Code too.

 image

Now Press F5  we should we see the following Result.

image

Nandri( Thanks)

R.SeenivasaRagavan,

1 comment:

Giri said...

Hi,

Can you tell me some "real-world" examples of sequential workflow and state machine workflow?