Getting started with Microsoft workflow WWF <Article 1>

Source: Internet
Author: User

What is a workflow? It is not quite clear yet.

What problems does a workflow solve? For the moment, it is just a vague concept that cannot be described in languages.

I. Example

Take vs2008 as an example to create a WWF program.

  

Drag a code in the toolbox to "activity ".

  

Open the attribute panel of codeactivity1, double-click in executecode, and enter, type the following code:

Namespace workflowconsoleapplication1 {public sealed partial class workflow1: sequentialworkflowactivity {public workflow1 () {initializecomponent ();} private void codeexecute (Object sender, eventargs e) {console. writeline ("Hello World -- workflow started! "); Console. readkey ();}}}

Startup, project, output as follows:

  

2. Create an application project

WWF workflows are all console programs. To better demonstrate them, create a Windows application as itsHost.

Create a Windows form application and reference the following controls.

  

As before, in the winform program, create a workflow project with the following structure:

  

Code in the winform Program (winform references the workflow project ):

Public partial class form1: FORM {// defines the runtime container private workflowruntime when the workflow is running; // defines the workflow instance private workflowinstance; Public form1 () {initializecomponent (); // The container workflowruntime = new workflowruntime (); workflowruntime when the workflow is started. startruntime ();} private void button1_click (Object sender, eventargs e) {// specify the workflow name to be referenced type = typeof (workflowconsoleapplication1.workflow1 ); // register a workflow instance workflowinstance = workflowruntime In the runtime container when the workflow is running. createworkflow (type); // start workflowinstance of the workflow instance. start ();}}

The workflow code console. Write () is changed to MessageBox. Show ();

Private void codeactivityincluexecutecode (Object sender, eventargs e) {MessageBox. Show ("Hello World -- workflow started! ");}

Click the button and the output is as follows:

  

Getting started with Microsoft workflow WWF <Article 1>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.