如何正确地将参数添加到工作流程中?
我正在尝试将一个简单的参数添加到我的一个活动中,该参数是序列中的openbrowser,之后,我创建了一个具有该序列的简单工作流,然后我运行它。
尽管变量已添加到序列中,但字典是正确创建的,并且正确命名的变量以及传递到工作流的字典,但它仍然使我在帖子底部的错误。
我一直在尝试弄清楚几天,但没有成功,应该如何写这件事?
private void Button_Click(object sender, RoutedEventArgs e)
{
Variable<String> myVariable = new Variable<string>(Name = "Hehe");
Dictionary<string, object> mainInputs = new Dictionary<string, object>();
mainInputs.Add("Hehe","www.youtube.com");
OpenBrowser samsungPortalBrowser = new OpenBrowser();
samsungPortalBrowser.NewSession = true;
samsungPortalBrowser.BrowserType = BrowserType.Chrome;
samsungPortalBrowser.Url = myVariable;
Sequence createSequence = new Sequence();
createSequence.Activities.Add(samsungPortalBrowser);
createSequence.Variables.Add(myVariable);
WorkflowApplication app = new WorkflowApplication(createSequence, mainInputs);
app.Run();
}
System.ArgumentException: 'The values provided for the root activity's arguments did not satisfy the root activity's requirements:
'Sequence': The following keys from the input dictionary do not map to arguments and must be removed: Hehe. Please note that argument names are case sensitive.
Parameter name: rootArgumentValues'
I am trying to add a simple argument to one of my activities which is OpenBrowser in a sequence, afterwards I create a simple workflow that has owns that sequence, then I run it.
Although the variables are added to the Sequence, the dictionary is properly created and the variables named properly as well as the dictionary being passed to the workflow, it still gives me the error at the bottom of the post.
I have been trying to figure this out for a few days now with no success, how should this be written?
private void Button_Click(object sender, RoutedEventArgs e)
{
Variable<String> myVariable = new Variable<string>(Name = "Hehe");
Dictionary<string, object> mainInputs = new Dictionary<string, object>();
mainInputs.Add("Hehe","www.youtube.com");
OpenBrowser samsungPortalBrowser = new OpenBrowser();
samsungPortalBrowser.NewSession = true;
samsungPortalBrowser.BrowserType = BrowserType.Chrome;
samsungPortalBrowser.Url = myVariable;
Sequence createSequence = new Sequence();
createSequence.Activities.Add(samsungPortalBrowser);
createSequence.Variables.Add(myVariable);
WorkflowApplication app = new WorkflowApplication(createSequence, mainInputs);
app.Run();
}
System.ArgumentException: 'The values provided for the root activity's arguments did not satisfy the root activity's requirements:
'Sequence': The following keys from the input dictionary do not map to arguments and must be removed: Hehe. Please note that argument names are case sensitive.
Parameter name: rootArgumentValues'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
无需发表评论,请自己尝试剪!
No need for comments, try the snip by yourself!