我使用代码(而不是设计时间)创建流程图工作流程
代码
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。 有什么帮助吗?
答案 0 :(得分:0)
应将IsApproved设置为工作流级别的outArgument。您似乎将其设置为变量。