托管设计师时如何创建空工作流程 [英] How do you create an empty workflow when hosting the designer

查看:118
本文介绍了托管设计师时如何创建空工作流程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当WF设计器托管在VS中并启动新的工作流控制台应用程序"项目时,将创建一个空的工作流,其中包含许多有用的导入内容,而没有其他内容.设计人员似乎很高兴能吞下此工作流程,但是当您向ActivityXamlServices.Load()呈现相同的xaml并将其用作新的工作流程/活动的基础时(WorkflowDesigner.Load()),在托管的设计器中,它会在System.Activities.Presentation.View.ImportDesigner.OnContextChanged()处显示"NullReferenceException".

这里是否包含一些VS魔术,或者我刚刚搞砸了?

注意事项,

奈杰尔

When the WF designer is hosted in VS and you start a new 'Workflow Console Application' project, an empty workflow is created containing a number of useful imports and nothing else. The designer seems quite happy to swallow this workflow, but when you present the same xaml to ActivityXamlServices.Load() and use that as the basis for a new workflow/activity (WorkflowDesigner.Load()) in a hosted designer, it chokes on it with a 'NullReferenceException at System.Activities.Presentation.View.ImportDesigner.OnContextChanged()'.

Is there some VS magic involved here, or have I just screwed up?

Regards,

Nigel

推荐答案

奈杰尔,

可以请尝试使用WorkflowDesigner.Load()直接指定文件名来加载xaml? (或设置wd.Text来保存xaml,然后调用Load()吗?

当活动为空时,设计器尝试通过将其附加到表示xaml定义一个Activity的ActivityBuilder对象上来保留导入,

还请确保您使用上下文项

AssemblyContextControlItem(您可以通过wd.Context.Items来获得它)

Nigel,

Can you please try loading the xaml using WorkflowDesigner.Load() directly specifying the file name ? ( or setup wd.Text to hold xaml and then call Load() ?

The designer tries to preserve the imports when the activity is empty by attaching it to the ActivityBuilder object that represensts the xaml defining an Activity type.

Also make sure you have the correct reference assemblies setup in your rehosting app using the context item

AssemblyContextControlItem ( you can get to this through wd.Context.Items)


这篇关于托管设计师时如何创建空工作流程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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