Showing posts with label WF. Show all posts
Showing posts with label WF. Show all posts

Friday, August 2, 2013

WorkFlow - Sample Application to Create a workflow and print a value in console screen














        Windows Workflow foundation which provides a model to define and execute processes using a set 
of building blocks called activites. WF provides a Designer, That allows to drag and drop activites from the toolbox on to the design surface to create a custom workflow template.

Let we create a sample application , Start visual studio and create a new project in WF and select WorkFlow Console Application.





Giving the project name and select OK.

Following are the Activities present in the ToolBox of WF.






To execute the workflow we have to create a instance of WorkflowInstance 


WorkflowInvoker.Invoke(newWorkflow1());

Now we see the steps to create a Workflow

Step 1 :

  • Add the Sequence activity from the toolbox
  • Add a new variable as name in string type in sequence scope which is present below the designer
  • Add a Assign activity from the designer inside the Sequence scope and place the name variable in the left side and assign the value in right side.
  • Attach a break point in that activity , by right click on the activity and select break point.




Step 2 :

  • Add a another activity Delay inside the WF of sequence activity and after the assign activity 
  • Select the properties of Delay activity
  • Give the Delay of 10 seconds.



  • Add a WriteLine activity after the delay activity 
  • give the variable name inside that

Now Press F5 and see the program will hit on the break point . now you can debug and see the sequence flow by press F11. you can see the output of workflow




I Hope from this article you will learn the how to create a sample WorkFlow Application.