我有一个名为“BaseActivity”的基类,它来自NativeActivity。我想在基类中拥有所有我的共同行为,并将它们用在被驯服的类中。假设我在基类中有常见的进/出参数。我的派生类有自己的输入/输出参数。我的问题是,我怎么能从我的dervied类传出一个参数到基类,以便基类out参数将消息传回客户端?从本机活动导出工作流活动
BASEACTIVITY CLASS
公共类BaseActivity:NativeActivity的 { #地区的 “公共参数列表” //定义字符串类型的活动输入/输出参数 公共InArgument FirstArgument {获得;组; } public InArgument SecondArgument {get;组; } public OutArgument Result {get;组; }
公共虚拟NativeActivityContext PushContext(NativeActivityContext上下文,词典DictBase) { return context; }
protected override void CacheMetadata(NativeActivityMetadata元数据) base.CacheMetadata(metadata);
}
保护覆盖无效执行(NativeActivityContext上下文) {
// Read context variables to local string variables.
string firstVal= context.GetValue(this.FirstArgument);
string secondVal= context.GetValue(this.SecondArgument);
string OutputResult = context.GetValue(this.Result);
Dictionary<string, object> contextdictionary = new Dictionary<string, object>();
contextdictionary.Add("first", firstVal);
contextdictionary.Add("second", secondVal);
contextdictionary.Add("output", OutputResult);
NativeActivityContext finalContext = PushContext(context, contextdictionary);
}
}
派生类
公共类儿童:BaseActivity { 公共InArgument XsltPath {获得;组; } public OutArgument OutValue {get;组; }
public override NativeActivityContext PushContext(NativeActivityContext上下文,Dictionary DictBase) //对一些字符串进行操作,然后传递它。 OutValue.Set(context,outputStringBuilder.ToString());
}
return context;
}
}
的问题是如何传递的OutValue到基座活动出来的参数。子活动中的值是正确的,但是当我调用工作表时,它返回一个空字符串。 PL。帮我。提前致谢。
你可以更新你的文章,以有更好的格式?因为你的代码格式不正确 – Fabske 2014-11-03 14:30:25