Windows Workflow Foundation (WWF) Study Notes (1)

Source: Internet
Author: User
Windows Workflow Foundation (wwf) Study Notes (1)

1,InstallWindows Workflow Foundation.

The latest version released by Microsoft is:Visual Studio 2005 Extensions for Windows Workflow Foundation Beta 1.2.exe.

Microsoft's WebCast instructor said that WWF should be installed and VS2005 should be installed before Workflow Foundation can be used normally. if the process is the opposite, VS 2005 will not be able to create a project. I also encountered this problem, but fortunately, I just cannot create a Workflow Project, because there is no WWF Project in the root of the new Project, and other projects can still be used normally. After searching, project Templates and Item Templates of WWF are not registered in VS 2005.

Solution:

Locate the location of the Workflow template:

D:/Program Files/Microsoft Visual Studio 8/Common7/IDE/ProjectTemplates/CSharp/Workflow/1033

D:/Program Files/Microsoft Visual Studio 8/Common7/IDE/ItemTemplates/CSharp/1033

Open the options in the VS 2005 tool menu, such:

 


Specify the location of the user template to the directory of the Workflow template, and create a new template. You can see the Workflow project.

 

 

2,Simple Sequential Workflow

After successfully installing WWF, We can find Windows Workflow Foundation simples in its help document, which is a Simples provided by Microsoft for developers and covers almost all the technical applications in WWF, even the demo used by Microsoft webcast lecturers originated from this.

Start with simple learning: sequential Workflow

 


This is a workflow that only uses one ifelse activity. It is easy to have only one selection path.

Unfortunately, the design code and program code in this example are not separated.

Run workflow ::

Let's see how workflow is started.

Static AutoResetEvent waitHandle = new AutoResetEvent (false); // used to control the thread

Static void Main (String [] args)

{

// Create a WorkflowRuntime object

WorkflowRuntime workflowRuntime = new WorkflowRuntime ();

Console. WriteLine ("Runtime Started .");

// Obtain the type of the workflow in this example.

Type type = typeof (SimpleSequentialWorkflow );

// Add an event and run it after workflow runs.

WorkflowRuntime. WorkflowCompleted + = new EventHandler <WorkflowCompletedEventArgs> (OnWorkflowCompleted );

// Start this workflow

WorkflowRuntime. StartWorkflow (type );

Console. WriteLine ("Workflow Started .");

// Stop this thread until it is started when WorkflowCompleted

WaitHandle. WaitOne ();

Console. WriteLine ("Program Complete .");

}

Static void OnWorkflowCompleted (object sender, WorkflowCompletedEventArgs instance)

{

MessageBox. Show ("workflowRuntime Complete .");

WaitHandle. Set ();

}

 

Ifelse activity is a very important attribute of condition, which determines the final returned results of if else.

 

3,Simple state machine

Sequential workflow works in a certain sequence. The state machine determines whether to execute the next activty based on the status of each activity. For example, in the approval process, if the activity status value is 0 or, it means yes, 0 means no, if it is 1, execute the next activity, and if it is 0, return.

 

There are three State activities in this case. For a state machine workflow, there must be an initialstate and completedstate to indicate where the behavior starts and ends. For a State activity, to execute a specific behavior, you must add an Event Driven Object to the object to drive this state behavior, double-click the eventdriven object to go to the specific design process of a State action, as shown in figure

 

For an internal process of a State action, we can define it like executing the sequential process, and end it with the set state object. The targetstate attribute of the set state object is used to indicate that the State action jumps out, jump to the object specified by targetstate.

 

Posted on Andersen's Fairy TaleReading (746) Comment (4) Edit  Favorites Reference Network Abstract

Comment
  • Wu
    Posted @
    1.2.exe: it should be beta2.2.
    In C #, there will be a series of templates after installation. I am also learningReplyMore Comments

  • # Re: Windows Workflow Foundation (WWF) Study Notes (1)

    Oo
    Posted @
    Is the Operating System 2003 required?ReplyMore Comments

  • # Re: Windows Workflow Foundation (WWF) Study Notes (1)

    Quark
    Posted @
    Hello everyone, I have just started WFF and applied for a QQ group. I hope the author and other friends can join the group:
    21218704

    Everyone learns and communicates with each otherReplyMore Comments

  • # Re: Windows Workflow Foundation (WWF) Study Notes (1)

    Cainiao [anonymous]
    Posted @
    After learning Microsoft's workflow for half a month, I haven't found a clue yet. I don't know how to start it, how can I create a complete process, how can I create a task, and how can I hook up the executor, microsoft's workflow cannot work, how can we pause the timing, how can the state machine be moved, and whether the state machine can be output concurrently .....ReplyMore Comments

# Re: Windows Workflow Foundation (WWF) Study Notes (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.