微软推出的工作流引擎:Windows Workflow Foudation
来源:互联网 发布:mysql默认端口3306 编辑:程序博客网 时间:2024/05/29 16:18
这是原文:
https://msdn.microsoft.com/windowsvista/building/workflow/default.aspx?pull=/library/en-us/dnlong/html/WWFGetStart.asp
这是下载地址
http://www.microsoft.com/downloads/details.aspx?familyid=7096d039-2638-4f63-8654-d2e5d98fa417&displaylang=en
这个开发环境需要安装在vs2005里面。
可以选择你的workflow引擎的Host
他处理的主要有两类工作流:顺序工作流(Sequential Workflow )和状态机工作流(State Machine Workflow ):
A sequential workflow is ideal for operations expressed by a pipeline of steps that execute one after the next until the last activity completes. Sequential workflows, however, are not purely sequential in their execution. They can still receive external events or start parallel tasks, in which case the exact sequence of execution can vary somewhat.
A state machine workflow is made up of a set of states, transitions, and actions. One state is denoted as a start state, and then, based on an event, a transition can be made to another state. The state machine workflow can have a final state that determines the end of the workflow.
有可视化的设计界面,就像设计一个aspx页面一样,把各个活动(activities )当成控件向里拖放。每个工作项就像一个控件,那工作流则一个窗体,可以直接写代码,比如MessageBox.Show.
To continue with the Windows Forms analogy, a workflow is like a form, whereas activities are like controls.
这个窗体也可以保存成xml格式的,但是.cs文件还是那样子。这是他实际做的
this.Activities.Add(this.code1); this.DynamicUpdateCondition = null; this.ID = "Workflow1"; FirstName.Direction = System.Workflow.ComponentModel.ParameterDirection.In; FirstName.Name = "FirstName"; FirstName.Type = typeof(string);
可以设置端点调试工作流。
传递数据:有两种方式Param 和 event 。可以自己设置需要的Param (就是一些共有的属性而以)
数据的提供和处理还是Host要做的,比如,要出低一些参数进来,还一个把Host上的时间联系到workflow上。下边是一个窗体(Host)的一个按钮的事件处理代码
Dictionary parameters = new Dictionary(); parameters.Add("FirstName", txtFirstName.Text); parameters.Add("LastName", txtLastName.Text); // Start the workflow Guid instanceID = Guid.NewGuid(); _wr.StartWorkflow(workflowType, instanceID, parameters);
流程处理上,功能很强大,可以设计诸如 IfElse,while,WaitForData,Suspend,Listen,Delay,EventDriven 等30多种。
开发一个Activity:
public partial class SendMailActivity : System.Workflow.ComponentModel.Activity{ public SendMailActivity() { InitializeComponent(); } protected override Status Execute(ActivityExecutionContext context) { : }}
状态机工作流比较麻烦,这是初始化一个状态机工作流:
private void StartWorkflowRuntime(){ // Create a new Workflow Runtime for this application _runtime = new WorkflowRuntime(); // Register event handlers for the WorkflowRuntime object _runtime.WorkflowTerminated += new EventHandler(WorkflowRuntime_WorkflowTerminated); _runtime.WorkflowCompleted += new EventHandler(WorkflowRuntime_WorkflowCompleted); // Create a new instance of the StateMachineTrackingService class _stateMachineTrackingService = new StateMachineTrackingService(_runtime); // Start the workflow runtime _runtime.StartRuntime(); // Add a new instance of the OrderService to the runtime _orderService = new OrderService(); _runtime.AddService(_orderService);}
在.net2.0里面EventHandler其实做了功能上的扩充
这是其中一步的处理
private Guid StartOrderWorkflow(string orderID){ // Create a new GUID for the WorkflowInstanceId Guid instanceID = Guid.NewGuid(); // Load the OrderWorkflows assembly Assembly asm = Assembly.Load("OrderWorkflows"); // Get a type reference to the OrderWorkflows.Workflow1 class Type workflowType = asm.GetType("OrderWorkflows.Workflow1"); // Start a new instance of the state machine with state tracking support StateMachineInstance stateMachine = _stateMachineTrackingService.RegisterInstance(workflowType, instanceID); stateMachine.StateChanged += new EventHandler(StateMachine_StateChanged); stateMachine.StartWorkflow(); _stateMachineInstances.Add(instanceID.ToString(), stateMachine); // Return the workflow GUID return instanceID;}
- 微软推出的工作流引擎:Windows Workflow Foudation
- 微软推出的工作流引擎:Windows Workflow Foudation
- 微软推出的工作流引擎:Windows Workflow Foudation,简单介绍一下
- workFlow学习总结---------------------常用的工作流引擎
- 和我一起学Windows Workflow Foundation(微软工作流)
- Windows Workflow Foundation 工作流
- 什么是工作流引擎(Workflow Engine
- Windows Workflow Foundation 工作流宿主
- 和我一起学Windows Workflow Foundation(微软工作流) (www.jiedichina.com)
- 什么是工作流引擎(Workflow Engine )
- 什么是工作流引擎(Workflow Engine )
- 工作流引擎WorkFlow开源项目
- 微软推出面向Windows的Docker客户端
- workflow 基于状态的工作流
- 可自管理的分布式工作流(workflow)引擎的设计与实现 (2-1)
- 可自管理的分布式工作流(workflow)引擎的设计与实现 (2-2)
- 基于JAVA的开源工作流引擎(Open Source Workflow Engines Written in Java)
- 工作流(Workflow)
- c#制作自动播放的mp3
- JSF Datatable 大数据集分页
- OpenAPI的使用代码-判断用户名和密码
- 专注于LargeTables,JSF
- JSF 大数据分页和排序研究
- 微软推出的工作流引擎:Windows Workflow Foudation
- 制作自定义工作流(WWF)设计器
- OpenAPI的使用代码-登录CSDN
- 从SAP高层辞职看职业经理人的归属
- C#冒泡排序
- 7.30
- 嵌入式系统与移动数据库技术
- JavaScript 对象简介(二十三)
- 医院HIS软件:门诊+住院+财务接口