Use Case:
After the state machine workflow is defined, the problem arises:
1. How to define the events contained in each status?
2. How to run this process?
3. What changes do I need to modify when my process (status flow) changes?
Wait, there are many problems. Let's solve them one by one!
Question 1:
Each State (except the termination state) must provide at least one event (system. workflow. activities. eventdrivenactivity). Each eventdrivenactivity contains a handleexternalevent and a setstate. setstate has the targetstatename member attribute to control the target flow state, while handleexternalevent must specify the interface type (interfacetype) and event name (eventname, from the event object provided by interfacetype). The event definition is as follows:
Here, interfacetype is an interface that needs to be defined by ourselves. Currently, it is called localservices. imywfservice. The interface also defines event campaigncreated.
Using System;
Using System. workflow. Activities;
Namespace Localservices
{
[Externaldataexchange]
Public Interface Imywfservice
{
EventEventhandler<Mywfeventargs>Campaigncreated;
EventEventhandler<Mywfeventargs>Campaignsubmited;
}
}
<To be continued...>