O'Reilly logo

Microsoft Windows Workflow Foundation 4.0 Cookbook by Andrew Zhu

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Running a WF program asynchronously

In the previous tasks, we used the WorkflowInvoker.Invoke method to start a workflow instance on the same thread as the main program. It is easy to use; however, in most real applications, a workflow should run on an independent thread. In this task, we will use WorkflowApplication to run a workflow instance.

How to do it...

  1. Create a workflow project:

    Create a new Workflow Console Application under the Chapter01 solution and name the project as UseWorkflowApplication.

  2. Author a workflow:

    In the opening Workflow1.xaml designer, click on Arguments, create two Int32 InArguments for Number1 and Number2. Create an Int32 OutArgument for Result. Add an Assign activity to the workflow designer panel. In the Assign activity, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required