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

📄 class1.cs

📁 应用框架的设计与实现的源代码(SAF) 《应用框架的设计与实现》随书源码
💻 CS
字号:
using System;
using TestDocumentLayer;
using SAF.Application.Configuration;
using System.Configuration;
using SAF.Application.DocumentLayer;
using System.IO;
using System.Security.Principal;

namespace TestConsole
{
	/// <summary>
	/// Summary description for Class1.
	/// </summary>
	class Class1
	{
		/// <summary>
		/// The demo shows how to use DocumentLayer in the application.
		/// </summary>
		[STAThread]
		static void Main(string[] args)
		{
			StreamReader sr = null;
			string content=null;
			try
			{
				//load the order xml.
				sr = new StreamReader("..\\..\\OrderSample.xml");
				content = sr.ReadToEnd();
			}
			finally
			{
				sr.Close();
			}
			
			GenericIdentity gi = new GenericIdentity("CustomerA");
			GenericPrincipal gp = new GenericPrincipal(gi,null);
			//create a new document object
			Document doc = new Document(gp,content,null);

			SAF.Application.Configuration.ConfigurationManager cm =null;
			cm = (SAF.Application.Configuration.ConfigurationManager)ConfigurationSettings.GetConfig("MyApplication");
			//get the initial document layer object
			IDocumentLayer layer = (IDocumentLayer)cm.DocumentLayerConfig.GetDocumentLayerByName("Special");
			//start processing the document.
			IDocument response = layer.ProcessDocument(doc);
			Console.WriteLine(">>>>>>>>>>>>>Repsonse document from " + response.Sender.Identity.Name + " has arrived <<<<<<<<<<<<"); 
			Console.WriteLine("Response Document is: \n " + response.Content + "\n");

		}
	}
}

⌨️ 快捷键说明

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