开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜