首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

制造自定义工作流(WWF)设计器

2012-10-07 
制作自定义工作流(WWF)设计器May 2006应用于:???Windows Workflow Foundation beta 2.2???Microsoft Visua

制作自定义工作流(WWF)设计器

May 2006

应用于:
???Windows Workflow Foundation beta 2.2
???Microsoft Visual C# Version 2.0
???Visual Studio 2005

demo下载:Download the code sample, WorkflowDesignerControl.exe.

·???????????????????????????{
·??????????????????????????????protected?override?void?PerformLoad(IDesignerSerializationManager?serializationManager)
·?????????????????????????????????{
·????????????????????????????????????base.PerformLoad(serializationManager);
·????????????????????????????????????//?Implement?the?logic?to?read?from?the?serialized?state,
·????????????????????????????????????//?create?the?activity?tree?and?the?corresponding?designer
·????????????????????????????????????//?tree?and?add?it?to?the?designer?host
·?????????????????????????????????}
·????????????????????????????
·??????????????????????????????protected?override?void?PerformFlush(IDesignerSerializationManager?manager)
·?????????????????????????????????{
·????????????????????????????????????//?Implement?the?logic?to?save?the?activity?tree?to?a
·????????????????????????????????????//?serialized?state?along?with?any?code?beside?elements?
·?????????????????????????????????}
·???????????????????????????}

·???????????????????????????{
·??????????????????????????????//?Get?the?designer?associated?with?the?root?component
·??????????????????????????????IRootDesigner?rootDesigner?=????designerHost.GetDesigner(designerHost.RootComponent)?as?IRootDesigner;
·??????????????????????????????if?(rootDesigner?!=?null)
·??????????????????????????????{
·?????????????????????????????????this.designSurface?=?designSurface;
·?????????????????????????????????this.loader?=?loader;
·??????????????????????????????
·????????????????????????????????????//?Assign?the?default?view?of?the?rootdesigner?to?WorkflowView
·????????????????????????????????????this.workflowView?=?rootDesigner.GetView(ViewTechnology.Default)?as??????????WorkflowView;
·????????????????????????????
·????????????????????????????????????//?Add?the?workflow?view?control?to?winforms?app
·????????????????????????????????????this.workflowViewSplitter.Panel1.Controls.Add(this.workflowView);
·????????????????????????????????????this.workflowView.Focus();
·????????????????????????????????????this.propertyGrid.Site?=?designerHost.RootComponent.Site;
·??????????????????????????????}
·????????????????????????????}

·???????????????{
·?????????????????????MenuCommand?command?=?FindCommand(id);
·?????????????????????if?(command?!=?null)
·??????????????????????{
·????????????????????????//?For?each?command?create?a?new?menu?item?and?add?an
·????????????????????????MenuItem?menuItem?=?new?MenuItem(selectionCommands[id],?new??????????EventHandler(OnMenuClicked));
·????????????????????????menuItem.Tag?=?command;
·????????????????????????contextMenu.MenuItems.Add(menuItem);
·?????????????????????}
·???????????????}
·????????????????
·???????????????//?Handle?the?event?when?the?MenuItem?is?clicked
·???????????????private?void?OnMenuClicked(object?sender,?EventArgs?e)
·???????????????{
·????????????????//?Retrieve?the?menu?item?that?was?clicked
·????????????????MenuItem?menuItem?=?sender?as?MenuItem;
·????????????????if?(menuItem?!=?null?&&?menuItem.Tag?is?MenuCommand)
·?????????????????????{
·????????????????????????//?invoke?the?command?corresponding?to?the?menu?item?clicked
·????????????????????????MenuCommand?command?=?menuItem.Tag?as?MenuCommand;
·????????????????????????command.Invoke();
·?????????????????????}
·???????????????}

·??????????????????{
·?????????????????????IMenuCommandService?menuService?=
·?????????????????????GetService(typeof(IMenuCommandService))?as?IMenuCommandService;
·?????????????????????if?(menuService?!=?null)
·?????????????????????menuService.GlobalInvoke(cmd);
·??????????????????}


2:生成后台代码MemberCreationService,和EventBindingService

·???????????????{
·???????????????????????private?void?EventHandler(object?sender,?System.EventArgs?e)
·???????????????????????{
·???????????????????????}
·???????????????}


4:显示组件属性的ActivityBind Dialog: IPropertyValueUIService


5:Rules Dialog:用来编辑各种Rule。

12.??????????????????????????{
13.?????????????????????????????IList?loaderrors?=?null;
14.??????????????????????

热点排行