WorkflowApplication output
In ord开发者_StackOverflow中文版er to get output from Workflowinvoker we have to use
var output = WorkflowInvoker.Invoke(new Activity1() { str = night });
HttpContext.Current.Response.Write(output["res"]);
but what do we have to use for the WorkflowApplication command? I tried the same as Workflowinvoker but it doesnt works.
You need to set the Completed callback. The WorkflowApplication executes the workflow asynchronously, whereas the WorkflowInvoker blocks until it completes.
var flag = new ManualResetEvent();
var app = new WorkflowApplication(activity);
Dictionary<string,object> results = null;
app.Completed = x =>
{
results = x.Outputs;
flag.Set();
};
app.Run();
// run the application, wait for it to complete
flag.WaitOne(Timeout.Infinite);
// Completed has executed at this point
精彩评论