Windows Workflow Foundation (wwf) Study Notes (2)

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

4, Sequential Workflow With ParametersThe Workflow can contain parameters. In this way, the flow code selects and judges the subsequent execution based on the values of external parameters. In this example, select the SequentialWorkflow object and you can see that the object has the Parameters attribute. Click this attribute to find the form. Multiple Parameter objects can be defined here, includes attributes such as the object Name and Type. Direction is used to indicate whether the parameter is an input parameter or an output parameter. In this example, the amount input parameters and status output parameters are defined. In this example, the Condition attribute of ifelsebranching is executed as follows: private bool IsApproved (object sender, EventArgs e) {if (Convert. toInt32 (this. parameters ["amount"]. value) <500) return true; else return false;} Here, the final path of ifElse is determined based on the Value of the amount parameter passed by the outside world. In Code1: private void Approved (object sender, EventArgs e) {this. parameters ["status"]. value = "approved";} In Code2: private void Rejected (object sender, EventArgs e) {this. parameters ["status"]. value = "rejected";} Code1 and Code2 provide the output parameter values for the two paths respectively. Look at Program. in cs, how does one call the Dictionary <string, object> parameters = new Dictionary <string, object> (); parameters of the workflow with parameters. add ("amount", Convert. toInt32 (args [0]); // Load the workflow typeType type = typeof (SequentialWorkflowWithParameters); // Create and start an instance of the workflowworkflowRuntime. startWorkflow (type, parameters); in the workflow end event, the output parameter status value is obtained through the OutputParameters attribute. Static void OnWorkflowCompleted (object sender, WorkflowCompletedEventArgs workflowCompletedEventArgs) {// The order status is stored in the "status" "in" parameter string orderStatus = workflowCompletedEventArgs. outputParameters ["status"]. toString (); Console. writeLine ("Order was" + orderStatus); waitHandle. set ();}

Posted on Andersen's Fairy Tale reading (1152) Comments (2) EDIT favorites

Comment
  • Xia Lin
    Posted @
    At the top, I need to study this part of my work and discuss it together.

    Xu hui replied to more comments

  • # Re: Windows Workflow Foundation (wwf) Study Notes (2)

    See the wind
    Posted @
    Join the WinFX team to study WinFX and reply to more comments.

# Re: Windows Workflow Foundation (wwf) Study Notes (2)

 

Related Article

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.