WF handlexternalevent transmits parameters to custom Properties

Source: Internet
Author: User
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 ?...

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.