Add Activities to the Workflow Designer Toolbox(向工作流设计器工具箱添加活动)

By default, the Workflow Module allows you to create workflow activities at runtime using the re-hosted Workflow Designer. However, you can also use custom activities created in Visual Studio using the standard approach. This topic describes how to add these activities into the Workflow Designer toolbox.
默认情况下,工作流模块允许你使用重新承载的工作流设计器在运行时创建工作流活动。不过,你也可以使用通过标准方法在Visual Studio中创建的自定义活动。本主题介绍如何将这些活动添加到工作流设计器工具箱中。

Note
You can use the same approach to register standard ot third-party activities. The complete example is available in the WorkflowDemo.NETFramework.XPO demo application, installed in the %PUBLIC%\Documents\DevExpress Demos 24.1\Components\XAF\WorkflowDemo.NETFramework.XPO, by default.

你可以使用相同的方法来注册标准活动或第三方活动。完整示例可在WorkflowDemo.NETFramework.XPO演示应用程序中找到,默认安装在 %PUBLIC%\Documents\DevExpress Demos 24.1\Components\XAF\WorkflowDemo.NETFramework.XPO 中。

To add an extra workflow activity, handle the WorkflowWindowsFormsModule.QueryAvailableActivities event in your WinForms application’s Program.cs file. The following code snippet adds the CreateTask activity to the Code Activities toolbox group and associates the “CreateTask” icon with this activity.
若要添加额外的工作流活动,请在 WinForms 应用程序的 Program.cs 文件中处理 WorkflowWindowsFormsModule.QueryAvailableActivities 事件。以下代码段将“创建任务”活动添加到“代码活动”工具箱组,并将“创建任务”图标与此活动相关联。

C#
static class Program {        
    static void Main(string[] arguments) {
        //...
        MySolutionWindowsFormsApplication winApplication = new MySolutionWindowsFormsApplication();
        //...
        winApplication.Modules.FindModule<WorkflowWindowsFormsModule>().QueryAvailableActivities +=
            delegate(object sender, ActivitiesInformationEventArgs e) {
            e.ActivitiesInformation.Add(new ActivityInformation(typeof(CreateTask),
            "Code Activities", "Create Task",
            ImageLoader.Instance.GetImageInfo("CreateTask").Image));
        };
    }
}
Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐