WF essence 2 WF Program

Source: Internet
Author: User

1. activity. The statement component can be restored. A group of activities constitute the WF workflow.
All activities are derived from the system. workflow. componentmodel. Activity Class. The execute () method must be overloaded to define the execution logic of the activity.
Activity is derived from dependobject (the latter provides the Dependency Property, see Chapter 7th)
The enabled attribute of the activity, indicating whether the activity is disabled (you can think that several statements are marked ). This attribute determines the enabledactivities attribute of compositeactivity.
The activity name attribute is the identifier of the activity.
The parent attribute of the activity specifies the composite activity at the upper level.

The overloaded AES execute (AEC context) method is very important, and the execution logic is all encapsulated here. Execute the logic of the current activity based on the information transmitted through the context, and return a status: No bookmarks (I .e., no callback method continueat). Then, AES is returned. closed; otherwise, AES is returned. executing, indicating that the asynchronous execution result is still waiting. Also, this is a protected internal method, so only context. executeactivity (activity) can indirectly call this method.

Asynchronous callback continueat (Object sender, queueeventargs E );
Note that the sub-activity uses queueeventargs (this class has only one queuename attribute)

The workflowqueuingservice class and workflowqueue class are actually the bookmarkmanager and bookmark in the previous chapter. Workflowqueuingservice maintains the workflowqueue set, while workflowqueue is used to access data,

The queueitemavailable event of workflowqueue is the bookmarklocation in the previous chapter, indicating that an external signal is received-I guess, because workflowqueue has an enqueue (Object item) method, this queueitemavailable event is triggered during the process of entering the queue (that is, external input), and asynchronous continueat callback is triggered.

The printkey activity and Readline activity show the two WF programming models: No bookmarks and no bookmarks.

The role of AEC here:Provides the Mgr bookmarks manager.

2. compositeactivity
All activities form a tree, and each sub-activity can only belong to one compound activity, with the active parent = NULL

Observe the sequence, which is the function reproduction. The closed event of the activity is used here: And the asynchronous continueat is bound to it. With context. executeactivity (activity) after executing the sub-activity, the closed event will be triggered in this method at the same time (the activity is passed to the onclosed parameter E. activity) to restore the bookmarks. This logic is repeated in the bookmarks continueat, so the iteration continues until the end.

Also, this asynchronous callback continueat (Object sender, aeschangedeventargs E); uses the aeschangedeventargs class, which has three parameters. Currently, we only use the activity attribute.

The role of AEC here:Indirectly execute the activity method to promote its status changes

3. XAML representation of WF
Use xoml as the extension

<Sequence xmlns = "http: // essentialwf/Activities">
<Print/>
<Print/>
</Sequence>

It is equivalent:

Using system. workflow. componentmodel. serialization;

[Assembly: xmlnsdefinition ("http: // essentialwf/activities", "essentialwf. Activities")]
Namespace workflowconsoleapplication9
{
Class Program
{
Static void main ()
{
Sequence S = new sequence ();
S. activies. Add (New printkey ());
S. activies. Add (New printkey ());
}
}
}

 

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.