Workflow entry step.6-building a console application-For-WF4.0

Source: Internet
Author: User
Opening

Previously, we talked about the basis of the control flow and wf4.0. Next, let's take a look at how to use wf4.0 in the form of a console, for example, how to useCode

To build the wf4.0 application.ProgramThis may help us with custom workflow designer. Let's get started.

Summary

Workflow is a popular technology recently. In fact, WF originated from the office automation field in the mid-S. Since its establishment in, WfMC (Workflow Management Alliance) formulated

Series of workflow standards. More and more scholars are paying attention to the workflow in the 21st century, and the technology is becoming more and more mature. Of course, I also have to keep up with the times, so I also joined the workflow army, hoping

Enough to keep up with our predecessors. Of course, I also hope that interested friends can join the workflow discussion group. Specific Group Number:120661978.

At present, we have made a sequent in the agileeas platform. The content of the interface designer + workflow, of course, the workflow is not very mature yet, and it is not convenient to release it. This article is just a reference, but alsoHope

You pay more attention to the content of workflows.

Outline

I. Opening

Ii. Summary

3. Console program of wf4.0

Console Program

Previous articlesArticle, We have already completed the basic control flow information in WF. We will describe the specific application later. For more information, see the previous article 《

Workflow getting started step.5-adding procedural Elements-For-WF4.0-(coming soon)

"

Next, let's take a look at how to create a workflow flow in the form of code to achieve the same goal as the designer.

1. Create a winform console application.

2. Add the Assembly reference "system. Activities ":

3. Add the following code to the main function:

4. Modify the "createworkflow method" above ":

5. Run the above program and view the running result.

Next let's build an activity with if control flow in this code to see how it is built.

1. On the basis of the above, we will modify the above "content of the createworkflow method ":

Private Static system. Activities. Activity createworkflow ()
{
// Create a new workflow Activity
Variable <datetime> nows = new variable <datetime> ()
{
Name = "datetime ",
Default = datetime. Now
};

Return new sequence ()
{
Displayname = "test ",
Activities =
{
New writeline ()
{
Displayname = "write1 ",
TEXT = "Hello world! "
}
}
};
}

The above is the simple output node of the previous output helloword without complex conditions. We will modify the above Code as follows:

First, define a variable "contion1" condition variable within the range of the sequential control flow as the if condition judgment.

Variable <int> contion1 = new variable <int> ()
{
Name = "int1 ",
Default = 1
};

Returns an ordered control flow.

Return new sequence ()
{
Variables =
{
Contion1
},
Displayname = "test ",
Activities =
{
// Output the workflow execution start date
New writeline ()
{
Displayname = "write1 ",
TEXT = system. datetime. Now. tostring ()
},

New if ()
{
Displayname = "Test2", condition = expressionservices. Convert <bool> (ENV => contion1.get (ENV)> 0 ),
Then = new writeline (){
Displayname = "then ",
TEXT = "then"
}, Else = new writeline (){
Displayname = "else ",
TEXT = "else"
}
},
// Output the workflow execution completion date
New writeline ()
{
Displayname = "write2 ",
TEXT = system. datetime. Now. tostring ()
}
}
};

2. Let's explain the preceding definition description:

3. Other content:

4. view the following results after running:

5. The statement in the IF condition and the condition parsing are described below :,

 

Based on the above form, we can write all the code we have completed based on the designer. Of course, we have mastered this form of console. When we combine some relevant development platforms or business code,

It is more convenient and easy. It may be difficult to write in the console.

For example, we complete the value assignment operation in then based on the above.

We assign the variable contion1 to 2 in then.

And print it out.

1. modify the code in the above sequece:

The above completes the modification of the internal process of the IF activity.

2. Check the running effect after running:

Source code download

More communication

Official blog: http://www.smarteas.net/

Http://www.agilelab.cn/

If you have any questions about using the agileeas. NET development platform, use the following contact methods or communication methods.

1. Telephone-Email:

He gozhou: hegezhou_hot@163.com mobile phone: 18691480181 blog: http://www.cnblogs.com/hegezhou_hot/

2. QQ chat group:

QQ: 308961614 Network Name: h.o. t

Communication Group on the agileeas. NET platform: 120661978 (super group) [New]

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.