imagecontroller.cs

来自「工作流的基本资料(文档资料」· CS 代码 · 共 44 行

CS
44
字号
using System;
using log4net;
using NetBpm.Util.Client;
using NetBpm.Workflow.Definition;
using NetBpm.Workflow.Definition.EComp;

namespace NetBpm.Web.Presentation.Controllers
{
	public class ImageController : AbstractSecureController
	{
		private static readonly ILog log = LogManager.GetLogger(typeof (ImageController));

		public ImageController()
		{
		}

		public void ProcessImage(Int64 processDefinitionId)
		{
			IDefinitionSessionLocal definitionComponent = null;
			try
			{
				definitionComponent = ServiceLocator.Instance.GetService(typeof (IDefinitionSessionLocal)) as IDefinitionSessionLocal;
				Context.Response.ContentType = "image/gif";
				if (log.IsDebugEnabled)
				{
					log.Debug("show ProcessImage processDefinitionId:"+processDefinitionId);
				}
				IProcessDefinition processDefinition = definitionComponent.GetProcessDefinition(processDefinitionId);
				byte[] gifContents = processDefinition.Image;
					
				if (gifContents != null)
				{
					Context.Response.OutputStream.Write(gifContents,0,gifContents.Length);
				}
			} 
			finally
			{
				ServiceLocator.Instance.Release(definitionComponent);	
			}

		}
	}
}

⌨️ 快捷键说明

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