1. What is a workflow
I've shed such a definition for work that workflow is a process that produces certain results.
In fact, in the OA system, the approval flow is one of our most common workflows.
In addition, simple to say, in fact, we are drawing a flow chart is one of the most simple workflow, the most characteristic of the workflow is graphical. Workflows are driven in order or event-driven to trigger the next step, resulting in a result.
In fact, we can also understand him as a process of responsibility chain.
2. Types of Workflows
Workflows are roughly divided into two categories, sequential workflows and event-driven workflows.
Sequential workflows are a common workflow that we go through in a predetermined order, and the steps they take cannot be changed at all.
Event-driven workflow, which we also call a finite state machine, is a change in state that is triggered by a particular event.
Examples are as follows:
Sequential workflow: Approval flow is actually a typical sequential workflow, an approval object step-by-Step examination and approval, take an interview process, the first personnel resume screening, and then the technical Manager interview, and then the general Manager interview, this is according to the process.
Event-driven workflows: Think about our software engineering process:
3. First example: Hello world
Learning any program, the first example is always Hello world, this time is no exception.
Let's start by building a simple WF applet.
The environment I use is the visual Studio 2008 +. NET Framework 3.5 SP1 to build the project:
First, let's familiarize ourselves with the environment:
Open VS2008 and select New--> item:
Then select the Workflow--> sequential Workflow console application. Then click OK to enter our WF project.
In the project, we can see Program.cs and Workflow1.cs. Workflow1 I don't say much, this is certainly our workflow program.
Then take a look at Program.cs:
4. The host
Windows Workflow Foundation is not a stand-alone product and needs to be run in a hosted environment.
This host can be a console application, a WinForm program, or it can be a asp.net program.
WF runs through the Run-time engine of the workflow. In fact, the workflow runtime engine and the host application are in the same process.
5. Continue Hello World
In the Toolbox, drag out a code control.
Then a meaningful name for CodeActivity1 is Codeactivityhello.
Then, to implement the Excutecode event, the runtime will automatically call this method.
Implemented as follows:
private void Codeactivityhello_executecode (object sender, EventArgs e)
{
Console.WriteLine ("Hello World");
}
Okay, let's run this program:
Continue >> Next [1th] [page 2nd]