As there were a lot of workflows used in previous projects, I was interested in learning the WF knowledge of Ms.
WF definition:A workflow is defined in an activity diagram. It may be a human operation or a system process. An activity is a step in a workflow. It is embodied as an executable unit that can be reused and integrated. After the workflow is designed, it is compiled into a. Net assembly and executed by the workflow runtime and the general language runtime (CLR.
Method for passing parameters to WF:
You must set attributes in the workflow first.
Private string firstname;
Private string message;
Public String firstname
{
Set {firstname = value ;}
}
Public String message
{
Get {return message ;}
}
When other programs call this workflow to create a workflow instance Key-value set for Transmission
Dictionary <string, Object> initpara = new dictionary <string, Object> ();
Initpara. Add ("firstname", "Todd ");
Workflowinstance instance = workflowruntime. createworkflow (typeof (helloworld. workflow1), initpara );
Obtain the parameters returned by WF:
Workflowruntime. workflowcompleted + = delegate (Object sender, workflowcompletedeventargs E)
{
Message = (string) E. outputparameters ["message"];
Waithandle. Set ();
}
Conditional activity can be defined in two ways. One is implemented by code, and the other is implemented by external rules. The Code conditions are as follows:
Private void checkcounter (Object sender, conditionaleventargs E)
{
E. Result = false;
If (counter <10)
{
E. Result = true;
}
}