如何从实施活动访问ActivityBuilder动态属性 [英] How to access ActivityBuilder dynamic properties from implementation activity

查看:54
本文介绍了如何从实施活动访问ActivityBuilder动态属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

托管的工作流设计器会加载带有自定义本机活动的Activity Builder活动.然后,用户继续创建并保存工作流程.

The hosted workflow designer loads an Activity Builder activity with a custom native activity as its implementation. The user then proceeds to create and save workflow.

例如,

designer = new WorkflowDesigner();
ActivityBuilder builder = new ActivityBuilder()
{
    Name = "CustomActivity",
    Implementation = new CustomActivity()
};
m_designer.Load(builder);

工作流应用程序将保存的工作流作为动态活动加载并添加一些动态属性.将使用为动态属性指定的值来调用工作流程.

The workflow application loads the saved workflow as a dynamic activity and adds some dynamic properties. The workflow is invoked with values specified for the dynamic properties.

例如

DynamicActivity job = ActivityXamlServices.Load(@"...job.xaml") as DynamicActivity;
DynamicActivityProperty inTest = new DynamicActivityProperty
{
    Name = "InTest",
    Type = typeof(InArgument<string>)
};
job.Properties.Add(inTest);

Dictionary<string, object> wfParams = new Dictionary<string, object>
{
    {"InTest", "MyInValue"}
};

WorkflowInvoker.Invoke(job, wfParams);

在代码中,用作ActivityBuilder活动的实现的自定义本机活动如何访问动态属性?

How, in code, does the custom native activity used as the implementation for the ActivityBuilder activity access the dynamic properties?

推荐答案

试试

-定义一个public InArgument< string> Foo {得到;放; }关于您的代码活动或本机活动
-在您使用活动的工作流程(活动构建器)中,该参数将设置为例如VisualBasicValue< string>("InTest")
-在活动实现中,您执行Foo.GetValue(context)以检索值

蒂姆

Try

-define a public InArgument<string> Foo { get; set; }on your code activity or native activity
-in the workflow (activity builder) where you use the activity, that argument will be set to e.g. VisualBasicValue<string>("InTest")
-in your activity implemenation you do Foo.GetValue(context) to retrieve the value

Tim


这篇关于如何从实施活动访问ActivityBuilder动态属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆