简体   繁体   English

WF-如何从XAML工作流获取WorkflowInvoker结果

[英]WF - How to get the WorkflowInvoker result from a XAML workflow

I have a simple workflow in XAML composed by a sequence and a custom activity. 我在XAML中有一个简单的工作流程,由序列和自定义活动组成。 In the future there will be more activities. 将来会有更多活动。 The XAML is the following: XAML如下:

<Activity mc:Ignorable="sap sap2010 sads" 
...
  <Sequence sap2010:WorkflowViewState.IdRef="Sequence_1">
    <local:CoefficientWorkflow sap2010:WorkflowViewState.IdRef="CoefficientWorkflow_1">
    </local:CoefficientWorkflow>
    <sads:DebugSymbol.Symbol>d11DOlxGQU1FMlxQcm9qZWN0MDJcRkJTXFdlYkFwcFxNb2R1bGVzXEZCUy5BTE9cc3JjXEZCUy5BTE8uV29ya2Zsb3dcV29ya2Zsb3dzXEFsb1dvcmtmbG93LnhhbWwDKwM0DgIBASwFMiECAQIvCy9KAgED</sads:DebugSymbol.Symbol>
  </Sequence>
  <sap2010:WorkflowViewState.ViewStateManager>
    <sap2010:ViewStateManager>
      <sap2010:ViewStateData Id="CoefficientWorkflow_1" sap:VirtualizedContainerService.HintSize="200,22" />
      <sap2010:ViewStateData Id="Sequence_1" sap:VirtualizedContainerService.HintSize="222,146">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="FBS.ALO.Workflow.Workflows.AloWorkflow_1" sap:VirtualizedContainerService.HintSize="262,226" />
    </sap2010:ViewStateManager>
  </sap2010:WorkflowViewState.ViewStateManager>
</Activity>

I invoke the workflow with the following code: 我使用以下代码调用工作流程:

WorkflowInvoker invoker = new WorkflowInvoker(workflow1);
var result = invoker.Invoke();

At the moment the result variable contains an empty dictionary after invoking the workflow. 目前,调用工作流后, result变量包含一个空字典。 As the activity contained in the sequence returns a value, I need your help to grab the output of that activity and expose externally as result of the whole workflow. 当序列中包含的活动返回一个值时,我需要您的帮助来获取该活动的输出,并在整个工作流中对外公开。

The result will hold an output dictionary. 结果将保存一个输出字典。

The keys for the dictionary are any OUT Arguments you created in your workflow at the workflow level. 词典的键是您在工作流级别在工作流中创建的任何OUT自变量。

The value returned by the Activity must first be passed from the Activity into a Workflow level OUT Argument. 必须首先将活动返回的值从活动传递到工作流级别的OUT参数中。
You do this by creating an OUT Argument in the Activity and assigning it to the OUT Argument in the Workflow using the Activity Properties dialog in Visual Studio 通过在Activity中创建OUT参数并将其分配给工作流中的OUT参数,可以使用Visual Studio中的“属性”对话框来实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM