【发布时间】:2017-06-07 16:05:56
【问题描述】:
我正在使用代码(而不是设计时)创建流程图工作流
代码
static Flowchart CreateFlowChart()
{
Variable<string> response = new Variable<string>();
Variable<string> isApproved = new Variable<string>();
FlowStep approved = new FlowStep
{
Action = new Assign
{
To = new OutArgument<string> (isApproved),
Value = new InArgument<string>((context) => response.Get(context))
}
};
FlowStep rejected = new FlowStep
{
Action = new Assign
{
DisplayName = "Approved",
To = new OutArgument<string>(isApproved),
Value = new InArgument<string>((context) => response.Get(context))
}
};
FlowDecision flowDecision = new FlowDecision
{
Condition = ExpressionServices.Convert<bool>((ctx) => response.Get(ctx).ToString() == "approved"),
True = approved,
False = rejected
};
FlowStep LineManagerApproval = new FlowStep
{
Action = new ReadLine
{
BookmarkName = readLineBookmark,
Result = new OutArgument<string>(response)
},
Next = flowDecision
};
Flowchart flowChart = new Flowchart
{
DisplayName = "Line Manager Approval Process",
Variables = { response, isApproved },
StartNode = LineManagerApproval,
Nodes =
{
LineManagerApproval,
flowDecision,
approved,
rejected
}
};
return flowChart;
}
我在我的活动帖子中设置OutArgument<string> 以进行流量决策。
当工作流程完成时,我希望有 e.OutPuts["isApproved"] 但 e.OutPuts 总是给计数 0;
application.Completed = delegate(WorkflowApplicationCompletedEventArgs e)
{
Console.WriteLine("Workflow {0} Completed.", e.InstanceId);
//bool isApproved = (bool)e.Outputs["isApproved"];
};
基本上我正在努力从流程图中返回 OutArgument。 请问有什么帮助吗?
【问题讨论】:
标签: workflow workflow-foundation-4