78 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			78 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.ComponentModel;
 | |
| using System.Data;
 | |
| using System.Drawing;
 | |
| using System.Linq;
 | |
| using System.Text;
 | |
| using System.Windows.Forms;
 | |
| using System.Xml;
 | |
| using System.IO;
 | |
| using System.Xml.Xsl;
 | |
| 
 | |
| namespace VEPROMS
 | |
| {
 | |
| 	public partial class dlgUCFDetail : Form
 | |
| 	{
 | |
| 		private string MyFormatConfig;
 | |
| 		private string UCFName;
 | |
| 		private string Description;
 | |
| 		// This brings up the dialog for displaying the details of what is contained in this User Control of Format
 | |
| 		// as defined by the formatConfig.  It uses XSL to display the xml. The XSL can be found in UCFDetails.xsl.
 | |
| 		// The result is displayed in a web browser control on the dialog.
 | |
| 		public dlgUCFDetail(string formatConfig, string name, string desc)
 | |
| 		{
 | |
| 			MyFormatConfig = formatConfig;
 | |
| 			UCFName = name;
 | |
| 			Description = desc;
 | |
| 			InitializeComponent();
 | |
| 		}
 | |
| 		private void AddAttribute(XmlNode xn, string name, object value)
 | |
| 		{
 | |
| 			XmlAttribute xa = xn.OwnerDocument.CreateAttribute(name);
 | |
| 			xa.Value = value.ToString();
 | |
| 			xn.Attributes.Append(xa);
 | |
| 		}
 | |
| 		private void dlgUCFDetail_Load(object sender, EventArgs e)
 | |
| 		{
 | |
| 			try
 | |
| 			{
 | |
| 				//need to add the UCF name & description to this:
 | |
| 				XmlDocument xd = new XmlDocument();
 | |
| 				xd.LoadXml(MyFormatConfig);
 | |
| 				XmlNodeList xnl = xd.GetElementsByTagName("FormatConfig");
 | |
| 				if (xnl != null && xnl.Count > 0)
 | |
| 				{
 | |
| 					AddAttribute(xnl[0], "Name", UCFName);
 | |
| 					AddAttribute(xnl[0], "Description", Description);
 | |
| 				}
 | |
| 
 | |
| 				string sXSLSummary = System.IO.File.ReadAllText(Application.StartupPath + "\\" + "UCFDetails.xsl");
 | |
| 				StringWriter sw = new StringWriter();
 | |
| 				StringWriter xsw = new StringWriter();
 | |
| 				using (XmlReader xrt = XmlReader.Create(new StringReader(sXSLSummary)))
 | |
| 				{
 | |
| 					XmlTextWriter tx = new XmlTextWriter(xsw);
 | |
| 					xd.WriteTo(tx);
 | |
| 					string tmp = sw.ToString();
 | |
| 					tmp = xd.InnerXml;
 | |
| 					using (XmlReader xri = XmlReader.Create(new StringReader(tmp)))
 | |
| 					{
 | |
| 						using (XmlWriter xwo = XmlWriter.Create(sw))
 | |
| 						{
 | |
| 							XslCompiledTransform xsl = new XslCompiledTransform();
 | |
| 							xsl.Load(xrt);
 | |
| 							xsl.Transform(xri, xwo); // Perform Transform
 | |
| 						}
 | |
| 						this.wbBrDet.DocumentText = sw.ToString();
 | |
| 					}
 | |
| 				}
 | |
| 			}
 | |
| 			catch (Exception ex)
 | |
| 			{
 | |
| 				MessageBox.Show("Problem occurred displaying the details.", "UCF Warning", MessageBoxButtons.OK);
 | |
| 			}
 | |
| 		}
 | |
| 	}
 | |
| }
 |