现在的位置: 首页 > 综合 > 正文

Rehosting WWF 设计器

2012年11月08日 ⁄ 综合 ⁄ 共 1774字 ⁄ 字号 评论关闭
  有关Hosting Workflow Designers的话题在ms-help://MS.MSSDK.1033/MS.NETFX30SDK.1033/WF_GettingStarted/html/185cc192-b19d-463c-80db-6c2d488419e7.htm中有下面的内容:

The primary classes that you must use when you host a workflow designer are as follows:

·           The .NET DesignSurface class, which implements what the user perceives as a designer by providing a completely self-contained design surface.

·           The WorkflowView class, which displays a visual representation of a workflow that is described in workflow markup.

·           The WorkflowDesignerLoader class, which supports custom loading of a workflow designer and workflow designer components.

·           The WorkflowDesignerMessageFilter class, which creates message filters to respond to workflow designer events, such as drag operations, layout and paint operations, and other designer events.

并且提供了一个例子Basic Designer Hosting。我们可以照这个例子可以加载一个Sequential Workflow的设计器,当然这个例子是非常简单了。这也被很多人所引用和翻译,根据我在开发试验过程中的验证,我想阐述一下我对Hosting Workflow Designers的一些看法。

DesignSurface:对设计时进行支持的一个重要的类,虽然名字中有Surface一词,但他去不能显示。他所侧重的是“服务”的添加与获取。这些服务如:工具箱、菜单、设计时的宿主、类型描述、选择等。

WorkflowView:这个类不像Windows SDK Documentation上说的那样,它不是必须的。这里所说的不是必须的是指不用我们去显示的去“new”一个出来,如果不用消息过滤的话,甚至连“WorkflowView”这个类名也不用。在DesignSurface中有一个View属性,这个属性就是我们的设计器的可视的界面。我们只要把它放在我们自己的容器上就可以了。

WorkflowDesignerLoader:没有它我们照样可以把设计器显示出来,并且可以用代码对设计器里的内容进行设计。但如果想要Workflow 设计器直接响应用户的鼠标和键盘事件,则必须使用它。还有如果想要对设计的东西进行持久化的话,则最好在这里面进行。

WorkflowDesignerMessageFilter:如果想要禁止用户对Workflow设计器的某些交互事件,或做一些特殊的事情,则可以使用这个类;且此类是和WorkflowDesignerLoader一块使用的,否则不起作用。也就是说通常情况下我们可以不关心这个类,这个类是可选的而不是必须的。

  如果想做出像VS集成环境那样的设计器,还有许多的工作要做。比如工具箱、属性窗口等。这里面还有很多的技术点,尤其是支持鼠标从工具箱上拖活动到设计器上,让我走了不少的弯路,但最终还是实现了。因为工作烦忙的原因,等我有时间再写吧。
  有关Rehosting WWF Designer的文章请参阅我的另外几篇文章:
  WWF的一些技术细节与应用体会(一)
  WWF的一些技术细节与应用体会(二)
  Rehosting WWF 设计器 之运行时定制活动的外观
  Rehosting WWF Designer 之定制活动的外观
  
Rehosting WWF Designerp之从工具箱拖动活动到设计器上
  Rehosting WWF 设计器

抱歉!评论已关闭.