⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 overtakingaction.cs

📁 工作流的基本资料(文档资料
💻 CS
字号:
using System;
using NetBpm.Workflow.Delegation;
using NetBpm.Workflow.Execution;
using NetBpm.Workflow.Execution.EComp;
using NetBpm.Workflow.Definition;
using NetBpm.Util.Client;

namespace NetBpm.Example.Delegate
{
	public class OvertakingAction : IActionHandler
	{
		private static readonly ServiceLocator serviceLocator = ServiceLocator.Instance;
		
		public void Run(IActionContext actionContext)
		{
			IFlow flow = actionContext.GetFlow();
			INode currentNode = flow.Node;
			
			if ("do bloody thing".Equals(currentNode.Name))
			//'do bloody thing' hasn't been performed
			{
				IExecutionSessionLocal executionComponent = (IExecutionSessionLocal) serviceLocator.GetService(typeof(IExecutionSessionLocal));
				try
				{
					//ae is a robot. Human (in) is incapable. Let robot replace him.
					executionComponent.DelegateActivity(flow.Id, "ae");
					
					//call external component (robot web service) to act on the flow
					System.Console.Out.WriteLine("calling robot web service to act on the flow... [ok]");
					
					//Now, revenge time: director fires originally assigned executor
					System.Console.Out.WriteLine("Isaac, you're fired!");
				}
				catch (ExecutionException e)
				{
					throw new System.SystemException("failed executing task: " + typeof(OvertakingAction) + " " + e.Message);
				}
				finally
				{
					serviceLocator.Release(executionComponent);
				}
			}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -