If an attribute is defined in workflow, how can this attribute be modified after the workflow is created?
Today, I 've been tossing around for a day, and I don't have any effect. I only got half of it. I wrote it first, but I didn't understand it. I figured it out and wrote it again.
When creating a workflow, you can use createworkflow (typeof (WF), Dictionary <string, Object>) to pass the parameter values to the workflow. However, if the workflow has been created, the host Program How can we pass the value into the workflow?
You need to use externaldataeventargs to inherit a class like this. [Serializable]
Public Class Billexternaldataeventargs: externaldataeventargs {
Private Decimal _ mycash;
Public Decimal cash {
Get {Return_ Mycash ;}
Set {_ Mycash=Value ;}
}
Public Billexternaldataeventargs (guid instanceid, decimal deccash ): Base (Instanceid) {
_ Mycash=Deccash;
}
}
Then adjust the corresponding interface [Externaldataexchange]
Public Interface Ibillworkflow
{
Decimal getcash (decimal deccash );
EventEventhandler<Billexternaldataeventargs>Billsubmit;
EventEventhandler<Billexternaldataeventargs>Billok;
}
[Serializable]
Public Class Mybillworkflow: ibillworkflow {
Public Mybillworkflow () {
System. Diagnostics. Debug. writeline ("Mybillworkflow init");
}
Dictionary < String , Eventhandler < Billexternaldataeventargs > _ Eventlist = New Dictionary < String , Eventhandler < Billexternaldataeventargs > ();
Public Void Raisevent ( String Strname, guid guidinstanceid, decimal deccash) {
If (_ Eventlist [strname] ! = Null )
{
Try
{
Eventhandler < Billexternaldataeventargs > Evehandler = _ Eventlist [strname];
Billexternaldataeventargs Ede = New Billexternaldataeventargs (guidinstanceid, deccash );
Evehandler ( This , Ede );
}
Catch {
}
}
}
Public Decimal getcash (decimal deccash)
{
ReturnDeccash;
}
Public Event Eventhandler < Billexternaldataeventargs > Billsubmit
{
Add {
System. Diagnostics. Debug. writeline ("Add billsubmit event");
_ Eventlist. Add ("Billsubmit", Value );
}
Remove {_ Eventlist. Remove ("Billsubmit");}
}
Public Event Eventhandler < Billexternaldataeventargs > Billok
{
Add {_ Eventlist. Add ("Billok", Value );}
Remove {_ Eventlist. Remove ("Billok");}
}
}
Then define in the workflowPublicBilldayone. billexternaldataeventargs _ cash= Default(Billdayone. billexternaldataeventargs );
This _ cash is an important attribute passed between the host and the workflow.
You only need to call
Raisevent (string strname, guid guidinstanceid, decimal deccash) // decimal deccash is the parameter passed by the host to the workflow and will be passed to _ cash. Cash
In this way, the host Passes parameters to the workflow.
However, I have not figured out how to obtain the attribute values in the workflow. Still learning... I still don't know what to do ?...