Schedule Scheduling
Scheduler:
Create a queue so that the work items (the delegate method in the activity, called the scheduler work item) are allocated to the target activity.
Use the invoke <t> method to send the continueat () work item to the scheduler queue, allocate work items, and execute the corresponding delegate method.
Scheduler work queue! = WF program queue,
The former is managed by runtime, and the work item is delegate such as continueat ().
The latter is managed by workflowqueueservice, where the instance of workflowqueue is placed
Active State Machine
Two enumerations
AES, activity execution status
Aer: execution result of the activity
The AEC implements the idispose interface, so the AEC cannot be cached. For example, the execute method and the AEC object are used as parameters. When the method is returned, the AEC object will be destroyed immediately.
Activity services:
In Main (), add the service: runtime. addservice (New service1 () in the WF runtime ());
Use context to obtain the service: context. getservice <service1> ();
---- The service is selected by the host based on the abstract class. For details, see chapter 5th.
Review bookmarks
One example: An activity delegates work to itself
Therefore, when the bookmarks are created, the bookmarks are restored without waiting for the. Execute method. Use the base. Invoke (continueat, systemargs. Empty) method.
At this time, the continueat method must end with context. closeactivity ();, so that the activity status changes to AES. Closed.
Invoke method definition: invoke <t> (eventhandler <t> handler, t e); e is the parameter entrusted by Handler
WF program execution:
First, workflowruntime. createworkflow () returns the WF program instance instence and prepares a scheduler and a work queue for it. At this time, all the activities in the WF program are in the initialized state.
Then instance. Start () runs the WF program instance and runs