hi
I am working in a project. Acc. to my scenario, a worker fills a form and then manager approve or reject the worker's request but after the worker fills the form, manager cannot reply the request immediately. The workflow should wait the response of the manager. How to do this break without a problem and how to continue the workflow from that point.
Please help me.

I have a problem..
David J Oldfield
many thanks
I will repeat the second question. In this process(waiting response from manager), will it create a problem. When waiting the response, is the workflow idled or ....
Maxim Michtchenko
Firstly thank you,
I used CallExternalMethod activity to call the form.
will I use HandleExternalEvent activity after the CallExternalMethod activity .
The workflow will wait the event. will this break cause a problem. (think of many request are waiting)
dagfari
Syed Mazhar Hasan
it will work : if you use ExternalDataExchange service, the workflow calls the host by using the CallExternalMethod activity and the Host answers by sending an event which is managed by the HandleExternalEvent activity. This pattern is often used.
Serge
Ayman_Hdaib
yes, the workflow is idled while waiting and it's not a problem at all; by default it will remain in memory; it will be persisted automaticallly if you add the persistence serviceand reloaded when you send an event (approval event here).
Serge
RobLearningVisualBasic
I wrote the following codes but CallExternalMethods activity do not see the interface type. why
second, in izinTalepService, in the raiseFormEvent event, how I reach the instanceID in below code, the compiler give a warning about getting the instanceID.
thanks
namespace
izinService{
[
ExternalDataExchange] public interface IizinTalepService{
event EventHandler<izinEventArgs> raiseFormEvent; void getForm(); void loadForm();}
}
namespace
izinService{
class izinTalepService : IizinTalepService{
public WorkflowInstance instanceID; public void getForm(){
talepFormu.
talepForm myform = new talepFormu.talepForm();myform.Show();
}
public event EventHandler<izinEventArgs> raiseFormEvent; public void loadForm(){
izinEventArgs e = new izinEventArgs(instanceID.InstanceId);raiseFormEvent(
null, e);}
}
}
namespace
izinService{
public class izinEventArgs : ExternalDataEventArgs{
public izinEventArgs(Guid instanceID):base(instanceID){
}
}
}
K.Kong
In you case, one quick & dirty solution is to store the workflow instance in your service; that works , but it's not a good idea because the service is supposed to be used by several workflow instances.
The best solution is to pass the workflow instance id as parameter of you fireEvent method.
To have more details watch this video (bidirectionnal communication) : http://wf.netfx3.com/files/folders/screencasts/entry4999.aspx
Hope this helps
Serge
s.sanya
Here are more explanations :
I've removed the threadpool code which is interesting but not mandatory here. :
public void RequestAdd(int x, int y)
{
Guid instanceID = WorkflowEnvironment.instanceId;
int result=x+y;
// we encapsulate the result in the Event argument; specifying the workflow is important : you will send the event to a workflow instance, you have to specify which one
CalculationResultEventArgs args = new CalculationResultEventArgs (instanceId);
args.Result=result;
// we check to make sure somebody (the workflow here) is listening to our event
if(CalculationReady!=null) // null if nobody is waiting for it
{
// we trigger the event
CalculationReady(this, args);
}
}
Does it help
Serge
EtherealSky
I know that you exhausted due to my question. :)
I have a difficulty not only in WF but also c# essentials.
in your link, there are codes below. I dont understand the meaning of the code especially thread and threadpool.
many thanks
public class CalculationEngine : ICalculationRequest
{
public void RequestAdd(int x, int y)
{
Guid instanceID = WorkflowEnvironment.instanceId;
int result=x+y;
ThreadPool.QueueUserWorkItem(delegate { Thread.Sleep(10000);
CalculationResultEventArgs args = new CalculationResultEventArgs (instanceId);
args.Result=result;
if(CalculationReady!=null)
{
CalculationReady(this, args);
}
} ; )
}
johnd2
Hi,
In your workflow, you can use the HandleExternalEvent Activity.
It's well illustrated in this video : http://wf.netfx3.com/files/folders/screencasts/entry4998.aspx
Serge