format logic from Rich
This commit is contained in:
		@@ -21,7 +21,15 @@ using System.ComponentModel;
 | 
			
		||||
 | 
			
		||||
namespace VEPROMS.CSLA.Library
 | 
			
		||||
{
 | 
			
		||||
	public partial class Format
 | 
			
		||||
	public partial interface IFormatOrFormatInfo
 | 
			
		||||
	{
 | 
			
		||||
		PlantFormat PlantFormat { get;}
 | 
			
		||||
		IFormatOrFormatInfo MyIParent { get;}
 | 
			
		||||
		string Data { get; }
 | 
			
		||||
		string ToString();
 | 
			
		||||
		string FullName { get; }
 | 
			
		||||
	}
 | 
			
		||||
	public partial class Format:IFormatOrFormatInfo
 | 
			
		||||
	{
 | 
			
		||||
		#region PlantFormat
 | 
			
		||||
		[NonSerialized]
 | 
			
		||||
@@ -29,6 +37,7 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
		public PlantFormat PlantFormat
 | 
			
		||||
		{ get { return (_PlantFormat != null ? _PlantFormat : _PlantFormat = new PlantFormat(this)); } }
 | 
			
		||||
		#endregion
 | 
			
		||||
		public IFormatOrFormatInfo MyIParent { get { return MyParent; } }
 | 
			
		||||
		public override string ToString()
 | 
			
		||||
		{
 | 
			
		||||
			//return Name;
 | 
			
		||||
@@ -44,14 +53,15 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	public partial class FormatInfo
 | 
			
		||||
	public partial class FormatInfo : IFormatOrFormatInfo
 | 
			
		||||
	{
 | 
			
		||||
		#region PlantFormat
 | 
			
		||||
		[NonSerialized]
 | 
			
		||||
		private PlantFormat _PlantFormat;
 | 
			
		||||
		public PlantFormat PlantFormat
 | 
			
		||||
		{ get { return (_PlantFormat != null ? _PlantFormat : _PlantFormat = new PlantFormat(this.Get())); } }
 | 
			
		||||
		{ get { return (_PlantFormat != null ? _PlantFormat : _PlantFormat = new PlantFormat(this)); } }
 | 
			
		||||
		#endregion
 | 
			
		||||
		public IFormatOrFormatInfo MyIParent { get { return MyParent; } }
 | 
			
		||||
		public override string ToString()
 | 
			
		||||
		{
 | 
			
		||||
			//return Name;
 | 
			
		||||
 
 | 
			
		||||
@@ -11,12 +11,12 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
	[TypeConverter(typeof(ExpandableObjectConverter))]
 | 
			
		||||
	public class PlantFormat
 | 
			
		||||
	{
 | 
			
		||||
		public PlantFormat(Format format)
 | 
			
		||||
		public PlantFormat(IFormatOrFormatInfo format)
 | 
			
		||||
		{
 | 
			
		||||
			_MyFormat = format;
 | 
			
		||||
		}
 | 
			
		||||
		private Format _MyFormat;
 | 
			
		||||
		public Format MyFormat
 | 
			
		||||
		private IFormatOrFormatInfo _MyFormat;
 | 
			
		||||
		public IFormatOrFormatInfo MyFormat
 | 
			
		||||
		{
 | 
			
		||||
			get { return _MyFormat; }
 | 
			
		||||
			set { _MyFormat = value; }
 | 
			
		||||
@@ -209,7 +209,7 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return _BoxList == null? _BoxList = new BoxList(SelectNodes("BoxData/Box")):_BoxList;
 | 
			
		||||
				return _BoxList == null? _BoxList = new BoxList(SelectNodes("BoxData/Box"),MyFormat):_BoxList;
 | 
			
		||||
			}
 | 
			
		||||
			set { _BoxList = value; }
 | 
			
		||||
		}
 | 
			
		||||
@@ -226,7 +226,7 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return _StepDataList == null? _StepDataList = new StepDataList(SelectNodes("StepData/Step")):_StepDataList;
 | 
			
		||||
				return _StepDataList == null? _StepDataList = new StepDataList(SelectNodes("StepData/Step"),MyFormat):_StepDataList;
 | 
			
		||||
			}
 | 
			
		||||
			set { _StepDataList = value; }
 | 
			
		||||
		}
 | 
			
		||||
@@ -770,7 +770,7 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return _RightCheckOffBoxList == null? _RightCheckOffBoxList = new RightCheckOffBoxList(SelectNodes("RightCheckOffBoxList/RightCheckOffBox")):_RightCheckOffBoxList;
 | 
			
		||||
				return _RightCheckOffBoxList == null? _RightCheckOffBoxList = new RightCheckOffBoxList(SelectNodes("RightCheckOffBoxList/RightCheckOffBox"),MyFormat):_RightCheckOffBoxList;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		private CheckOffList _CheckOffList;
 | 
			
		||||
@@ -778,7 +778,7 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return _CheckOffList == null? _CheckOffList = new CheckOffList(SelectNodes("CheckOffList/CheckOff")):_CheckOffList;
 | 
			
		||||
				return _CheckOffList == null? _CheckOffList = new CheckOffList(SelectNodes("CheckOffList/CheckOff"),MyFormat):_CheckOffList;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		private CheckOffHeaderList _CheckOffHeaderList;
 | 
			
		||||
@@ -786,7 +786,7 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return _CheckOffHeaderList == null? _CheckOffHeaderList = new CheckOffHeaderList(SelectNodes("CheckOffHeaderList/CheckOffHeader")):	_CheckOffHeaderList;
 | 
			
		||||
				return _CheckOffHeaderList == null? _CheckOffHeaderList = new CheckOffHeaderList(SelectNodes("CheckOffHeaderList/CheckOffHeader"),MyFormat):	_CheckOffHeaderList;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		private LazyLoad<int?> _UseCheckOffsIn;
 | 
			
		||||
@@ -825,7 +825,7 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
	#endregion
 | 
			
		||||
	#region RightCheckOffBox
 | 
			
		||||
	[TypeConverter(typeof(ExpandableObjectConverter))]
 | 
			
		||||
	public class RightCheckOffBox : vlnFormatItem
 | 
			
		||||
	public class RightCheckOffBox : vlnFormatItem, IVlnIndexedFormatItem
 | 
			
		||||
	{
 | 
			
		||||
		public RightCheckOffBox(XmlNode xmlNode) : base(xmlNode) { }
 | 
			
		||||
		public RightCheckOffBox() : base() { }
 | 
			
		||||
@@ -858,15 +858,26 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
	}
 | 
			
		||||
	#endregion
 | 
			
		||||
	#region RightCheckOffBoxList
 | 
			
		||||
	[TypeConverter(typeof(vlnListConverter<RightCheckOffBoxList, RightCheckOffBox>))]
 | 
			
		||||
	public class RightCheckOffBoxList : vlnFormatList<RightCheckOffBox>
 | 
			
		||||
	[TypeConverter(typeof(vlnIndexedListConverter<RightCheckOffBoxList, RightCheckOffBox>))]
 | 
			
		||||
	public class RightCheckOffBoxList : vlnIndexedFormatList<RightCheckOffBox>
 | 
			
		||||
	{
 | 
			
		||||
		public RightCheckOffBoxList(XmlNodeList xmlNodeList) : base(xmlNodeList) { }
 | 
			
		||||
		public RightCheckOffBoxList(XmlNodeList xmlNodeList,IFormatOrFormatInfo myFormat) : base(xmlNodeList,myFormat) { }
 | 
			
		||||
		public override vlnIndexedFormatList<RightCheckOffBox> InheritedList
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				IFormatOrFormatInfo parentFormat = MyFormat.MyIParent;
 | 
			
		||||
				if (parentFormat != null)
 | 
			
		||||
					return parentFormat.PlantFormat.FormatData.ProcData.CheckOffData.RightCheckOffBoxList;
 | 
			
		||||
				return null;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	#endregion
 | 
			
		||||
	#region CheckOff
 | 
			
		||||
	[TypeConverter(typeof(ExpandableObjectConverter))]
 | 
			
		||||
	public class CheckOff : vlnFormatItem
 | 
			
		||||
	public class CheckOff : vlnFormatItem,IVlnIndexedFormatItem
 | 
			
		||||
	{
 | 
			
		||||
		public CheckOff(XmlNode xmlNode) : base(xmlNode) { }
 | 
			
		||||
		public CheckOff() : base() { }
 | 
			
		||||
@@ -915,15 +926,25 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
	}
 | 
			
		||||
	#endregion
 | 
			
		||||
	#region CheckOffList
 | 
			
		||||
	[TypeConverter(typeof(vlnListConverter<CheckOffList, CheckOff>))]
 | 
			
		||||
	public class CheckOffList : vlnFormatList<CheckOff>
 | 
			
		||||
	[TypeConverter(typeof(vlnIndexedListConverter<CheckOffList, CheckOff>))]
 | 
			
		||||
	public class CheckOffList : vlnIndexedFormatList<CheckOff>
 | 
			
		||||
	{
 | 
			
		||||
		public CheckOffList(XmlNodeList xmlNodeList) : base(xmlNodeList) { }
 | 
			
		||||
		public CheckOffList(XmlNodeList xmlNodeList,IFormatOrFormatInfo myFormat) : base(xmlNodeList,myFormat) { }
 | 
			
		||||
		public override vlnIndexedFormatList<CheckOff> InheritedList
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				IFormatOrFormatInfo parentFormat = MyFormat.MyIParent;
 | 
			
		||||
				if (parentFormat != null)
 | 
			
		||||
					return parentFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffList;
 | 
			
		||||
				return null;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	#endregion
 | 
			
		||||
	#region CheckOffHeader
 | 
			
		||||
	[TypeConverter(typeof(ExpandableObjectConverter))]
 | 
			
		||||
	public class CheckOffHeader : vlnFormatItem
 | 
			
		||||
	public class CheckOffHeader : vlnFormatItem,IVlnIndexedFormatItem
 | 
			
		||||
	{
 | 
			
		||||
		public CheckOffHeader(XmlNode xmlNode) : base(xmlNode) { }
 | 
			
		||||
		public CheckOffHeader() : base() { }
 | 
			
		||||
@@ -964,10 +985,20 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
	}
 | 
			
		||||
		#endregion
 | 
			
		||||
	#region CheckOffHeaderList
 | 
			
		||||
	[TypeConverter(typeof(vlnListConverter<CheckOffHeaderList, CheckOffHeader>))]
 | 
			
		||||
	public class CheckOffHeaderList : vlnFormatList<CheckOffHeader>
 | 
			
		||||
	[TypeConverter(typeof(vlnIndexedListConverter<CheckOffHeaderList, CheckOffHeader>))]
 | 
			
		||||
	public class CheckOffHeaderList : vlnIndexedFormatList<CheckOffHeader>
 | 
			
		||||
	{
 | 
			
		||||
		public CheckOffHeaderList(XmlNodeList xmlNodeList) : base(xmlNodeList) { }
 | 
			
		||||
		public CheckOffHeaderList(XmlNodeList xmlNodeList,IFormatOrFormatInfo myFormat) : base(xmlNodeList,myFormat) { }
 | 
			
		||||
		public override vlnIndexedFormatList<CheckOffHeader> InheritedList
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				IFormatOrFormatInfo parentFormat = MyFormat.MyIParent;
 | 
			
		||||
				if (parentFormat != null)
 | 
			
		||||
					return parentFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList;
 | 
			
		||||
				return null;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	#endregion
 | 
			
		||||
	#endregion
 | 
			
		||||
@@ -1130,7 +1161,7 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				if (_MetaSectionList == null) _MetaSectionList = new MetaSectionList(SelectNodes("MetaSectionData/MetaSection"));
 | 
			
		||||
				if (_MetaSectionList == null) _MetaSectionList = new MetaSectionList(SelectNodes("MetaSectionData/MetaSection"),MyFormat);
 | 
			
		||||
				return _MetaSectionList;
 | 
			
		||||
			}
 | 
			
		||||
			set { _MetaSectionList = value; }
 | 
			
		||||
@@ -1447,7 +1478,7 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return (_SeqTabFmtList == null) ? _SeqTabFmtList = new SeqTabFmtList(SelectNodes("SequentialTabFormat/SeqTabFmt")) : _SeqTabFmtList;
 | 
			
		||||
				return (_SeqTabFmtList == null) ? _SeqTabFmtList = new SeqTabFmtList(SelectNodes("SequentialTabFormat/SeqTabFmt"),MyFormat) : _SeqTabFmtList;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		private StepSectionPrintData _StepSectionPrintData;
 | 
			
		||||
@@ -2751,7 +2782,7 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
	#region SeqTabFmtAll
 | 
			
		||||
	#region SeqTabFmt
 | 
			
		||||
	[TypeConverter(typeof(ExpandableObjectConverter))]
 | 
			
		||||
	public class SeqTabFmt : vlnFormatItem
 | 
			
		||||
	public class SeqTabFmt : vlnFormatItem,IVlnIndexedFormatItem
 | 
			
		||||
	{
 | 
			
		||||
		public SeqTabFmt() : base() { }
 | 
			
		||||
		private LazyLoad<int?> _Index;  //not included - is it needed?
 | 
			
		||||
@@ -2792,19 +2823,20 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
	}	
 | 
			
		||||
	#endregion
 | 
			
		||||
	#region SeqTabFmtList
 | 
			
		||||
	[TypeConverter(typeof(vlnListConverter<SeqTabFmtList, SeqTabFmt>))]
 | 
			
		||||
	public class SeqTabFmtList : vlnFormatList<SeqTabFmt>
 | 
			
		||||
	[TypeConverter(typeof(vlnIndexedListConverter<SeqTabFmtList, SeqTabFmt>))]
 | 
			
		||||
	public class SeqTabFmtList : vlnIndexedFormatList<SeqTabFmt>
 | 
			
		||||
	{
 | 
			
		||||
		public new SeqTabFmt this[int index]
 | 
			
		||||
		public SeqTabFmtList(XmlNodeList xmlNodeList,IFormatOrFormatInfo myFormat) : base(xmlNodeList,myFormat) { }
 | 
			
		||||
		public override vlnIndexedFormatList<SeqTabFmt> InheritedList
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				foreach (SeqTabFmt seqTabFmt in this)
 | 
			
		||||
					if (seqTabFmt.Index == index) return seqTabFmt;
 | 
			
		||||
				IFormatOrFormatInfo parentFormat = MyFormat.MyIParent;
 | 
			
		||||
				if (parentFormat != null)
 | 
			
		||||
					return parentFormat.PlantFormat.FormatData.SectData.StepSectionData.SeqTabFmtList;
 | 
			
		||||
				return null;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		public SeqTabFmtList(XmlNodeList xmlNodeList) : base(xmlNodeList) { }
 | 
			
		||||
	}
 | 
			
		||||
	#endregion
 | 
			
		||||
	#endregion
 | 
			
		||||
@@ -2899,7 +2931,7 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
	#region MetaSectionAll
 | 
			
		||||
	#region MetaSection
 | 
			
		||||
	[TypeConverter(typeof(ExpandableObjectConverter))]
 | 
			
		||||
	public class MetaSection : vlnFormatItem
 | 
			
		||||
	public class MetaSection : vlnFormatItem,IVlnIndexedFormatItem
 | 
			
		||||
	{
 | 
			
		||||
		public MetaSection(XmlNode xmlNode) : base(xmlNode) { }
 | 
			
		||||
		public MetaSection() : base() { }
 | 
			
		||||
@@ -2963,10 +2995,22 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
 | 
			
		||||
	#endregion
 | 
			
		||||
	#region MetaSectionList
 | 
			
		||||
	[TypeConverter(typeof(vlnListConverter<MetaSectionList, MetaSection>))]
 | 
			
		||||
	public class MetaSectionList : vlnFormatList<MetaSection>
 | 
			
		||||
	[TypeConverter(typeof(vlnIndexedListConverter<MetaSectionList, MetaSection>))]
 | 
			
		||||
	public class MetaSectionList : vlnIndexedFormatList<MetaSection>
 | 
			
		||||
	{
 | 
			
		||||
		public MetaSectionList(XmlNodeList xmlNodeList) : base(xmlNodeList) { }
 | 
			
		||||
		public MetaSectionList(XmlNodeList xmlNodeList,IFormatOrFormatInfo myFormat) : base(xmlNodeList,myFormat) { }
 | 
			
		||||
		public override vlnIndexedFormatList<MetaSection> InheritedList
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				IFormatOrFormatInfo parentFormat = MyFormat.MyIParent;
 | 
			
		||||
				if (parentFormat != null)
 | 
			
		||||
					return parentFormat.PlantFormat.FormatData.SectData.MetaSectionList;
 | 
			
		||||
				return null;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	#endregion
 | 
			
		||||
	#endregion
 | 
			
		||||
@@ -2974,7 +3018,7 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
	#region StepDataAll
 | 
			
		||||
	#region Step
 | 
			
		||||
	[TypeConverter(typeof(ExpandableObjectConverter))]
 | 
			
		||||
	public class StepData : vlnFormatItem
 | 
			
		||||
	public class StepData : vlnFormatItem,IVlnIndexedFormatItem
 | 
			
		||||
	{
 | 
			
		||||
		public StepData() : base() { }
 | 
			
		||||
		private LazyLoad<int?> _Index;
 | 
			
		||||
@@ -3554,15 +3598,25 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
	}
 | 
			
		||||
	#endregion
 | 
			
		||||
	#region StepDataList
 | 
			
		||||
	[TypeConverter(typeof(vlnListConverter<StepDataList, StepData>))]
 | 
			
		||||
	public class StepDataList : vlnFormatList<StepData>
 | 
			
		||||
	[TypeConverter(typeof(vlnIndexedListConverter<StepDataList, StepData>))]
 | 
			
		||||
	public class StepDataList : vlnIndexedFormatList<StepData>
 | 
			
		||||
	{
 | 
			
		||||
		public new StepData this[int index]
 | 
			
		||||
		//public new StepData this[int index]
 | 
			
		||||
		//{
 | 
			
		||||
		//  get
 | 
			
		||||
		//  {
 | 
			
		||||
		//    foreach (StepData stepData in this)
 | 
			
		||||
		//      if (stepData.Index == index) return stepData;
 | 
			
		||||
		//    return null;
 | 
			
		||||
		//  }
 | 
			
		||||
		//}
 | 
			
		||||
		public override vlnIndexedFormatList<StepData> InheritedList
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				foreach (StepData stepData in this)
 | 
			
		||||
					if (stepData.Index == index) return stepData;
 | 
			
		||||
				IFormatOrFormatInfo parentFormat = MyFormat.MyIParent;
 | 
			
		||||
				if (parentFormat != null)
 | 
			
		||||
					return parentFormat.PlantFormat.FormatData.StepDataList;
 | 
			
		||||
				return null;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
@@ -3575,7 +3629,7 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
				return null;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		public StepDataList(XmlNodeList xmlNodeList) : base(xmlNodeList) { }
 | 
			
		||||
		public StepDataList(XmlNodeList xmlNodeList,IFormatOrFormatInfo myFormat) : base(xmlNodeList,myFormat) { }
 | 
			
		||||
		private StepData _HLS;
 | 
			
		||||
		public StepData HLS
 | 
			
		||||
		{
 | 
			
		||||
@@ -3933,7 +3987,7 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
	#region BoxDataAll
 | 
			
		||||
	#region Box
 | 
			
		||||
	[TypeConverter(typeof(ExpandableObjectConverter))]
 | 
			
		||||
	public class Box : vlnFormatItem
 | 
			
		||||
	public class Box : vlnFormatItem,IVlnIndexedFormatItem
 | 
			
		||||
	{
 | 
			
		||||
		public Box(XmlNode xmlNode) : base(xmlNode) { }
 | 
			
		||||
		public Box() : base() { }
 | 
			
		||||
@@ -4117,10 +4171,21 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
	}
 | 
			
		||||
	#endregion
 | 
			
		||||
	#region BoxList
 | 
			
		||||
	[TypeConverter(typeof(vlnListConverter<BoxList, Box>))]
 | 
			
		||||
	public class BoxList : vlnFormatList<Box>
 | 
			
		||||
	[TypeConverter(typeof(vlnIndexedListConverter<BoxList, Box>))]
 | 
			
		||||
	public class BoxList : vlnIndexedFormatList<Box>
 | 
			
		||||
	{
 | 
			
		||||
		public BoxList(XmlNodeList xmlNodeList) : base(xmlNodeList) { }
 | 
			
		||||
		public BoxList(XmlNodeList xmlNodeList, IFormatOrFormatInfo myFormat) : base(xmlNodeList, myFormat) { }
 | 
			
		||||
		public override vlnIndexedFormatList<Box> InheritedList
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				IFormatOrFormatInfo parentFormat = MyFormat.MyIParent;
 | 
			
		||||
				if (parentFormat != null)
 | 
			
		||||
					return parentFormat.PlantFormat.FormatData.BoxList;
 | 
			
		||||
				return null;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	#endregion
 | 
			
		||||
	#endregion
 | 
			
		||||
@@ -4134,7 +4199,7 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return(_TransTypeList == null || _TransTypeList.Count==0)? _TransTypeList = new TransTypeList(SelectNodes("TransTypeData/TransTypes")): _TransTypeList;
 | 
			
		||||
				return(_TransTypeList == null || _TransTypeList.Count==0)? _TransTypeList = new TransTypeList(SelectNodes("TransTypeData/TransTypes"),MyFormat): _TransTypeList;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		public TransData(XmlNode xmlNode) : base(xmlNode) { }
 | 
			
		||||
@@ -4278,7 +4343,7 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
	#endregion
 | 
			
		||||
	#region TransType
 | 
			
		||||
	[TypeConverter(typeof(ExpandableObjectConverter))]
 | 
			
		||||
	public class TransType : vlnFormatItem
 | 
			
		||||
	public class TransType : vlnFormatItem,IVlnIndexedFormatItem
 | 
			
		||||
	{
 | 
			
		||||
		public TransType(XmlNode xmlNode) : base(xmlNode) { }
 | 
			
		||||
		public TransType() : base() { }
 | 
			
		||||
@@ -4333,10 +4398,20 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
	}
 | 
			
		||||
	#endregion
 | 
			
		||||
	#region TransTypeList
 | 
			
		||||
	[TypeConverter(typeof(vlnListConverter<TransTypeList, TransType>))]
 | 
			
		||||
	public class TransTypeList : vlnFormatList<TransType>
 | 
			
		||||
	[TypeConverter(typeof(vlnIndexedListConverter<TransTypeList, TransType>))]
 | 
			
		||||
	public class TransTypeList : vlnIndexedFormatList<TransType>
 | 
			
		||||
	{
 | 
			
		||||
		public TransTypeList(XmlNodeList xmlNodeList) : base(xmlNodeList) { }
 | 
			
		||||
		public TransTypeList(XmlNodeList xmlNodeList, IFormatOrFormatInfo myFormat) : base(xmlNodeList,myFormat) { }
 | 
			
		||||
		public override vlnIndexedFormatList<TransType> InheritedList
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				IFormatOrFormatInfo parentFormat = MyFormat.MyIParent;
 | 
			
		||||
				if (parentFormat != null)
 | 
			
		||||
					return parentFormat.PlantFormat.FormatData.TransData.TransTypeList;
 | 
			
		||||
				return null;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	#endregion
 | 
			
		||||
	#region RoData
 | 
			
		||||
 
 | 
			
		||||
@@ -10,14 +10,14 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
	public class vlnFormatDocument:XmlDocument
 | 
			
		||||
	{
 | 
			
		||||
		private static XmlElement mydocele;
 | 
			
		||||
		public vlnFormatDocument(Format myFormat)
 | 
			
		||||
		public vlnFormatDocument(IFormatOrFormatInfo myFormat)
 | 
			
		||||
		{
 | 
			
		||||
			_MyFormat = myFormat;
 | 
			
		||||
			LoadXml(MyFormat.Data);
 | 
			
		||||
			mydocele = this.DocumentElement;
 | 
			
		||||
		}
 | 
			
		||||
		private Format _MyFormat;
 | 
			
		||||
		public Format MyFormat
 | 
			
		||||
		private IFormatOrFormatInfo _MyFormat;
 | 
			
		||||
		public IFormatOrFormatInfo MyFormat
 | 
			
		||||
		{
 | 
			
		||||
			get { return _MyFormat; }
 | 
			
		||||
			set { _MyFormat = value; }
 | 
			
		||||
@@ -32,7 +32,7 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
			//if (xn != null) return xn;
 | 
			
		||||
			//if (path.StartsWith("Font")) return LookupSingleFontNode(xmlNode, path);
 | 
			
		||||
			//return InheritLookup(xmlNode, path);
 | 
			
		||||
 | 
			
		||||
/* RHM 20090821 - 
 | 
			
		||||
			if (path.StartsWith("Font"))
 | 
			
		||||
			{
 | 
			
		||||
				XmlNode xn = null;
 | 
			
		||||
@@ -47,18 +47,21 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
				{
 | 
			
		||||
					xmlNode = LookupSingleNode(mydocele.FirstChild, "/PlantFormat/FormatData");
 | 
			
		||||
				}
 | 
			
		||||
				if (path.Contains("Font")) Console.WriteLine("vlnFormatDocument.LookupSingleNode {0},{1}", xmlNode.Name == "Step" ? "Step." + xmlNode.Attributes["Type"].Value : xmlNode.Name, path);
 | 
			
		||||
				return LookupSingleFontNode(xmlNode, path);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
 */
 | 
			
		||||
				if (xmlNode == null) return null;
 | 
			
		||||
				XmlNode xn = xmlNode.SelectSingleNode(path);
 | 
			
		||||
				if (xn != null) return xn;
 | 
			
		||||
				if (xmlNode.Name == "Step") xn = LookupSingleStepNode(xmlNode, path);
 | 
			
		||||
				//if (path.Contains("Font")) Console.WriteLine("vlnFormatDocument.LookupSingleNode {0},{1}", xmlNode.Name == "Step" ? "Step." + xmlNode.Attributes["Type"].Value : xmlNode.Name, path);
 | 
			
		||||
				if (xmlNode.Name == "Step") xn = LookupSingleStepNode(xmlNode, path); // Check for Step Inheritance
 | 
			
		||||
				if (xn != null) return xn;
 | 
			
		||||
				if (path.StartsWith("Font")) return LookupSingleFontNode(xmlNode, path);
 | 
			
		||||
				if (path.StartsWith("Font")) return LookupSingleFontNode(xmlNode, path); // Then do Font Inheritance
 | 
			
		||||
				return InheritLookup(xmlNode, path, false);
 | 
			
		||||
			}
 | 
			
		||||
//			}
 | 
			
		||||
		}
 | 
			
		||||
		public static XmlNode LookupSingleFontNode(XmlNode xmlNode, string path)
 | 
			
		||||
		{
 | 
			
		||||
@@ -70,7 +73,8 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
			{
 | 
			
		||||
				if (xmlNode.NodeType == XmlNodeType.Document)
 | 
			
		||||
				{
 | 
			
		||||
					return LookupSingleNode(tmpNode, "/PlantFormat/FormatData/" + path);
 | 
			
		||||
					//if (path.Contains("Font")) Console.WriteLine("vlnFormatDocument.LookupSingleFontNode {0},{1}", tmpNode.Name == "Step" ? "Step." + tmpNode.Attributes["Type"].Value : tmpNode.Name, path);
 | 
			
		||||
					return LookupSingleNode(tmpNode.OwnerDocument.DocumentElement, "/PlantFormat/FormatData/" + path);
 | 
			
		||||
				}
 | 
			
		||||
				xmlNode = xmlNode.ParentNode;
 | 
			
		||||
				xn = xmlNode.SelectSingleNode(path);
 | 
			
		||||
@@ -79,17 +83,29 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
		}
 | 
			
		||||
		public static XmlNode LookupSingleStepNode(XmlNode xmlNode, string path)
 | 
			
		||||
		{
 | 
			
		||||
			
 | 
			
		||||
			if (xmlNode == null) return null;
 | 
			
		||||
			XmlNode xn = xmlNode.SelectSingleNode(path);
 | 
			
		||||
			XmlNode tmpNode = xmlNode;
 | 
			
		||||
			XmlNode tmpNode2 = xmlNode;
 | 
			
		||||
			while (xn == null)  //Walk-up the format tree to find a step node
 | 
			
		||||
			{
 | 
			
		||||
				//if (path.Contains("Font")) Console.WriteLine("vlnFormatDocument.LookupSingleStepNode -> Loop {0},{1}", xmlNode.Name == "Step" ? "Step." + xmlNode.Attributes["Type"].Value : xmlNode.Name, path);
 | 
			
		||||
				tmpNode = xmlNode;
 | 
			
		||||
				xmlNode = xmlNode.ParentNode.SelectSingleNode(string.Format("Step[@Type='{0}']",xmlNode.Attributes["ParentType"].InnerText));
 | 
			
		||||
				if (xmlNode == null && path.StartsWith("Font")) return LookupSingleFontNode(tmpNode, path);
 | 
			
		||||
				XmlAttribute attr = xmlNode.Attributes["ParentType"];
 | 
			
		||||
				if (attr == null) // Cannot find ParentType so do an InheritanceLookup
 | 
			
		||||
					return InheritLookup(xmlNode, path, false);
 | 
			
		||||
				xmlNode = xmlNode.ParentNode.SelectSingleNode(string.Format("Step[@Type='{0}']", xmlNode.Attributes["ParentType"].InnerText));
 | 
			
		||||
				if (xmlNode == null && path.StartsWith("Font"))
 | 
			
		||||
				{
 | 
			
		||||
					//if (path.Contains("Font")) Console.WriteLine("vlnFormatDocument.LookupSingleStepNode -> Font {0},{1}", tmpNode.Name == "Step" ? "Step." + tmpNode.Attributes["Type"].Value : tmpNode.Name, path);
 | 
			
		||||
					return LookupSingleFontNode(tmpNode, path);
 | 
			
		||||
				}
 | 
			
		||||
				if (xmlNode == null)
 | 
			
		||||
				{
 | 
			
		||||
					//if (path.Contains("Font")) Console.WriteLine("vlnFormatDocument.LookupSingleStepNode -> Font {0},{1}", tmpNode2.Name == "Step" ? "Step." + tmpNode2.Attributes["Type"].Value : tmpNode2.Name, path);
 | 
			
		||||
					return InheritLookup(tmpNode2, path, true);
 | 
			
		||||
				}
 | 
			
		||||
				xn = xmlNode.SelectSingleNode(path);
 | 
			
		||||
			}
 | 
			
		||||
			return xn;
 | 
			
		||||
@@ -158,10 +174,10 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
			//stepLookup = false;   // 8/2 change for inheritance
 | 
			
		||||
			if (xmlNode == null) return null;// No path to match
 | 
			
		||||
			string xPath = Path(xmlNode);// Build xPath from xmlNode
 | 
			
		||||
			vlnFormatDocument fd = (vlnFormatDocument)(xmlNode.OwnerDocument);//First Get the vlnFormatDocument 
 | 
			
		||||
			while(fd.MyFormat.MyParent != null)
 | 
			
		||||
			vlnFormatDocument fd = (vlnFormatDocument)(xmlNode.OwnerDocument);//First Get the vlnFormatDocument  - This also ties it to a FormatInfo object
 | 
			
		||||
			while(fd.MyFormat.MyIParent != null)
 | 
			
		||||
			{
 | 
			
		||||
				fd = fd.MyFormat.MyParent.PlantFormat.XmlDoc;// Get the parents vlnFormatDocument
 | 
			
		||||
				fd = fd.MyFormat.MyIParent.PlantFormat.XmlDoc;// Get the parents vlnFormatDocument
 | 
			
		||||
				if (fd != null)
 | 
			
		||||
				{
 | 
			
		||||
					XmlNode xp;
 | 
			
		||||
@@ -171,7 +187,10 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
					{
 | 
			
		||||
						XmlNode xn = null;
 | 
			
		||||
						if (stepLookup)
 | 
			
		||||
						{
 | 
			
		||||
							//if (path.Contains("Font")) Console.WriteLine("vlnFormatItem.SelectSingleNode {0},{1}", xp.Name == "Step" ? "Step." + xp.Attributes["Type"].Value : xp.Name, path);
 | 
			
		||||
							xn = LookupSingleStepNode(xp, path);
 | 
			
		||||
						}
 | 
			
		||||
						else
 | 
			
		||||
							xn = xp.SelectSingleNode(path);
 | 
			
		||||
						if(xn != null) return xn;
 | 
			
		||||
@@ -184,17 +203,18 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
		{
 | 
			
		||||
			if (xmlNode == null) return null;// No path to match
 | 
			
		||||
			string xPath = Path(xmlNode);// Build xPath from xmlNode
 | 
			
		||||
			vlnFormatDocument fd = (vlnFormatDocument)(xmlNode.OwnerDocument);//First Get the vlnFormatDocument 
 | 
			
		||||
			while (fd.MyFormat.MyParent != null)
 | 
			
		||||
			vlnFormatDocument fd = (vlnFormatDocument)(xmlNode.OwnerDocument);//First Get the vlnFormatDocument - This also ties it to a FormatInfo object
 | 
			
		||||
			while (fd.MyFormat.MyIParent != null)
 | 
			
		||||
			{
 | 
			
		||||
				fd = fd.MyFormat.MyParent.PlantFormat.XmlDoc;// Get the parents vlnFormatDocument
 | 
			
		||||
				fd = fd.MyFormat.MyIParent.PlantFormat.XmlDoc;// Get the parents vlnFormatDocument
 | 
			
		||||
				if (fd != null)
 | 
			
		||||
				{
 | 
			
		||||
					XmlNode xp = fd.SelectSingleNode(xPath);// Get the related node
 | 
			
		||||
					if (xp != null)
 | 
			
		||||
					{
 | 
			
		||||
						XmlNodeList xl = xp.SelectNodes(path);
 | 
			
		||||
						if (xl != null) return xl;
 | 
			
		||||
						if (xl != null)
 | 
			
		||||
							return xl;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
@@ -217,6 +237,21 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
			get { return _XmlNode; }
 | 
			
		||||
			set { _XmlNode = value; }
 | 
			
		||||
		}
 | 
			
		||||
		private IFormatOrFormatInfo _MyFormat;
 | 
			
		||||
		public IFormatOrFormatInfo MyFormat
 | 
			
		||||
		{
 | 
			
		||||
			get 
 | 
			
		||||
			{
 | 
			
		||||
				if (_MyFormat == null)
 | 
			
		||||
				{
 | 
			
		||||
					vlnFormatDocument doc = (XmlNode.OwnerDocument) as vlnFormatDocument;
 | 
			
		||||
					if(doc != null)
 | 
			
		||||
						_MyFormat = doc.MyFormat;
 | 
			
		||||
				}
 | 
			
		||||
				return _MyFormat;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public virtual string GetPDDisplayName()
 | 
			
		||||
		{ return ToString(); }
 | 
			
		||||
		public virtual string GetPDName()
 | 
			
		||||
@@ -231,8 +266,24 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
		}
 | 
			
		||||
		public XmlNode SelectSingleNode(string path)
 | 
			
		||||
		{
 | 
			
		||||
			//AdjustLookup(_XmlNode, path);
 | 
			
		||||
			//if(path.Contains("Font")) Console.WriteLine("vlnFormatItem.SelectSingleNode {0},{1}", _XmlNode.Name == "Step" ? "Step." + _XmlNode.Attributes["Type"].Value : _XmlNode.Name, path);
 | 
			
		||||
			return vlnFormatDocument.LookupSingleNode(_XmlNode, path);
 | 
			
		||||
		}
 | 
			
		||||
		//public static string _LookUpNode;
 | 
			
		||||
		//private static void AdjustLookup(XmlNode xmlNode,string path)
 | 
			
		||||
		//{
 | 
			
		||||
		//  if (xmlNode.Name == "Step")
 | 
			
		||||
		//  {
 | 
			
		||||
		//    XmlAttribute attr = xmlNode.Attributes["Type"];
 | 
			
		||||
		//    if (attr != null) _LookUpNode = attr.Value;
 | 
			
		||||
		//    //Console.WriteLine("AdjustLookup Type = {0}/{1}", _LookUpNode, path);
 | 
			
		||||
		//  }
 | 
			
		||||
		//  else
 | 
			
		||||
		//  {
 | 
			
		||||
		//    //Console.WriteLine("AdjustLookup {0}", xmlNode.Name);
 | 
			
		||||
		//  }
 | 
			
		||||
		//}
 | 
			
		||||
		public XmlNode SelectSingleFontNode(string path)
 | 
			
		||||
		{
 | 
			
		||||
			return vlnFormatDocument.LookupSingleFontNode(_XmlNode, path);
 | 
			
		||||
@@ -280,12 +331,40 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
			}
 | 
			
		||||
			return ll.Value;
 | 
			
		||||
		}
 | 
			
		||||
		public string MyPath
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				StringBuilder sb = new StringBuilder();
 | 
			
		||||
				XmlNode node = _XmlNode;
 | 
			
		||||
				string prefix = "";
 | 
			
		||||
				while (node != null)
 | 
			
		||||
				{
 | 
			
		||||
					sb.Insert(0, node.Name + prefix);
 | 
			
		||||
					prefix = "/";
 | 
			
		||||
					node = node.ParentNode;
 | 
			
		||||
				}
 | 
			
		||||
				return sb.ToString();
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		public int? LazyLoad(ref LazyLoad<int?> ll, string xPath)
 | 
			
		||||
		{
 | 
			
		||||
			if (ll == null)
 | 
			
		||||
			{
 | 
			
		||||
				XmlNode xn = SelectSingleNode(xPath);
 | 
			
		||||
				ll = new LazyLoad<int?>(xn != null ? (int?)int.Parse("0" + xn.InnerText) : null);
 | 
			
		||||
				int? value=null;
 | 
			
		||||
				XmlNode xn = this._XmlNode;
 | 
			
		||||
				xn = SelectSingleNode(xPath);
 | 
			
		||||
				if (xn != null)
 | 
			
		||||
				{
 | 
			
		||||
					int iValue =0;
 | 
			
		||||
					if (!int.TryParse(xn.InnerText, out iValue))
 | 
			
		||||
					{
 | 
			
		||||
						Console.WriteLine(string.Format("'{0}'\r\n'{1}'\r\n'{2}' could not be converted to int?", MyFormat.FullName, MyPath + "/" + xPath, xn.InnerText));
 | 
			
		||||
						throw (new Exception(string.Format("{0} = '{1}' could not be converted to int?",xPath, xn.InnerText)));
 | 
			
		||||
					}
 | 
			
		||||
					value = iValue;
 | 
			
		||||
				}
 | 
			
		||||
				ll = new LazyLoad<int?>(value);
 | 
			
		||||
			}
 | 
			
		||||
			return ll.Value;
 | 
			
		||||
		}
 | 
			
		||||
@@ -294,7 +373,8 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
		{
 | 
			
		||||
			if (ll == null)
 | 
			
		||||
			{
 | 
			
		||||
				XmlNode xn = SelectSingleNode(xPath);
 | 
			
		||||
				XmlNode xn = this._XmlNode;
 | 
			
		||||
				xn = SelectSingleNode(xPath);
 | 
			
		||||
				if (xn == null)
 | 
			
		||||
					ll = new LazyLoad<T?>(null);
 | 
			
		||||
				else if (xn.Value == "")// No value specified - Use zero value if it is defined - GetName returns a null if it is not defined
 | 
			
		||||
@@ -306,6 +386,12 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	#endregion
 | 
			
		||||
	#region IVlnIndexedFormatItem
 | 
			
		||||
	public partial interface IVlnIndexedFormatItem
 | 
			
		||||
	{
 | 
			
		||||
		int? Index { get; }
 | 
			
		||||
	}
 | 
			
		||||
	#endregion
 | 
			
		||||
	#region LazyLoad
 | 
			
		||||
	public class LazyLoad<T>
 | 
			
		||||
	{
 | 
			
		||||
@@ -325,21 +411,135 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
	public class vlnFormatList<T> : List<T>, ICustomTypeDescriptor
 | 
			
		||||
		where T : vlnFormatItem, new()
 | 
			
		||||
	{
 | 
			
		||||
		private XmlNodeList _XmlNodeList;
 | 
			
		||||
		private XmlNodeList _XmlNodeList=null;
 | 
			
		||||
		internal XmlNodeList XmlNodeList
 | 
			
		||||
		{
 | 
			
		||||
			get { return _XmlNodeList; }
 | 
			
		||||
			set { _XmlNodeList = value; }
 | 
			
		||||
			set 
 | 
			
		||||
			{
 | 
			
		||||
				_XmlNodeList = value; 
 | 
			
		||||
				foreach (XmlNode xn in _XmlNodeList)
 | 
			
		||||
				{
 | 
			
		||||
					T tt = new T();
 | 
			
		||||
					tt.XmlNode = xn;
 | 
			
		||||
					Add(tt);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		public vlnFormatList(XmlNodeList xmlNodeList)
 | 
			
		||||
		{
 | 
			
		||||
			if (xmlNodeList == null) return;
 | 
			
		||||
			_XmlNodeList = xmlNodeList;
 | 
			
		||||
			foreach (XmlNode xn in _XmlNodeList)
 | 
			
		||||
			XmlNodeList = xmlNodeList;
 | 
			
		||||
		}
 | 
			
		||||
		public vlnFormatList()
 | 
			
		||||
		{
 | 
			
		||||
		}
 | 
			
		||||
		private IFormatOrFormatInfo _MyFormat;
 | 
			
		||||
		public IFormatOrFormatInfo MyFormat
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				T tt = new T();
 | 
			
		||||
				tt.XmlNode = xn;
 | 
			
		||||
				Add(tt);
 | 
			
		||||
				if (_MyFormat == null)
 | 
			
		||||
				{
 | 
			
		||||
					XmlNode node = _XmlNodeList[0]; // Get the first node in a list
 | 
			
		||||
					vlnFormatDocument doc = null;
 | 
			
		||||
					if (node != null) 
 | 
			
		||||
						doc = (node.OwnerDocument) as vlnFormatDocument; // Get the owner document as a vlnFormatDocument
 | 
			
		||||
					if (doc != null)
 | 
			
		||||
						_MyFormat = doc.MyFormat; // Get the Format associated with the vlnFormatDocument
 | 
			
		||||
				}
 | 
			
		||||
				return _MyFormat;
 | 
			
		||||
			}
 | 
			
		||||
			set
 | 
			
		||||
			{
 | 
			
		||||
				_MyFormat = value;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		#region ICustomTypeDescriptor
 | 
			
		||||
		public String GetClassName()
 | 
			
		||||
		{ return TypeDescriptor.GetClassName(this, true); }
 | 
			
		||||
		public AttributeCollection GetAttributes()
 | 
			
		||||
		{ return TypeDescriptor.GetAttributes(this, true); }
 | 
			
		||||
		public String GetComponentName()
 | 
			
		||||
		{ return TypeDescriptor.GetComponentName(this, true); }
 | 
			
		||||
		public TypeConverter GetConverter()
 | 
			
		||||
		{ return TypeDescriptor.GetConverter(this, true); }
 | 
			
		||||
		public EventDescriptor GetDefaultEvent()
 | 
			
		||||
		{ return TypeDescriptor.GetDefaultEvent(this, true); }
 | 
			
		||||
		public PropertyDescriptor GetDefaultProperty()
 | 
			
		||||
		{ return TypeDescriptor.GetDefaultProperty(this, true); }
 | 
			
		||||
		public object GetEditor(Type editorBaseType)
 | 
			
		||||
		{ return TypeDescriptor.GetEditor(this, editorBaseType, true); }
 | 
			
		||||
		public EventDescriptorCollection GetEvents(Attribute[] attributes)
 | 
			
		||||
		{ return TypeDescriptor.GetEvents(this, attributes, true); }
 | 
			
		||||
		public EventDescriptorCollection GetEvents()
 | 
			
		||||
		{ return TypeDescriptor.GetEvents(this, true); }
 | 
			
		||||
		public object GetPropertyOwner(PropertyDescriptor pd)
 | 
			
		||||
		{ return this; }
 | 
			
		||||
		public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
 | 
			
		||||
		{ return GetProperties(); }
 | 
			
		||||
		public virtual PropertyDescriptorCollection GetProperties()
 | 
			
		||||
		{
 | 
			
		||||
			// Create a collection object to hold property descriptors
 | 
			
		||||
			PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null);
 | 
			
		||||
			// Iterate the list 
 | 
			
		||||
			int i = 0;
 | 
			
		||||
			for (i = 0; i < this.Count; i++)
 | 
			
		||||
			{
 | 
			
		||||
				// Create a property descriptor for the item and add to the property descriptor collection
 | 
			
		||||
				pds.Add(new vlnPropertyDescriptor<vlnFormatList<T>, T>(this, i));
 | 
			
		||||
			}
 | 
			
		||||
			// return the property descriptor collection
 | 
			
		||||
			return pds;
 | 
			
		||||
		}
 | 
			
		||||
		#endregion
 | 
			
		||||
	}
 | 
			
		||||
	#endregion
 | 
			
		||||
	#region vlnIndexedFormatList
 | 
			
		||||
	public class vlnIndexedFormatList<T> : vlnFormatList<T>, ICustomTypeDescriptor
 | 
			
		||||
		where T : vlnFormatItem,IVlnIndexedFormatItem, new()
 | 
			
		||||
	{
 | 
			
		||||
		public vlnIndexedFormatList(XmlNodeList xmlNodeList,IFormatOrFormatInfo myFormat) : base(xmlNodeList) 
 | 
			
		||||
		{
 | 
			
		||||
			MyFormat = myFormat;
 | 
			
		||||
		}
 | 
			
		||||
		public vlnIndexedFormatList() : base() { }
 | 
			
		||||
		public virtual vlnIndexedFormatList<T> InheritedList { get { return null; } }
 | 
			
		||||
		public new T this[int index]
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				foreach (T tmp in this)
 | 
			
		||||
				{
 | 
			
		||||
					if (tmp.Index == index)
 | 
			
		||||
						return tmp;
 | 
			
		||||
				}
 | 
			
		||||
				vlnIndexedFormatList<T> ttlParent = InheritedList; //Check Inherited Value
 | 
			
		||||
				if (ttlParent != null)
 | 
			
		||||
					return ttlParent[index];
 | 
			
		||||
				return null;
 | 
			
		||||
				// None found - Can I find it in another format?
 | 
			
		||||
				return null;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		public new int Count
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				int max = base.Count;
 | 
			
		||||
				foreach (T tmp in this)
 | 
			
		||||
				{
 | 
			
		||||
					if (tmp.Index > max)
 | 
			
		||||
						max = ((int)tmp.Index) + 1;
 | 
			
		||||
				}
 | 
			
		||||
				vlnIndexedFormatList<T> parent = InheritedList; //Check Inherited Value
 | 
			
		||||
				if (parent != null)
 | 
			
		||||
				{
 | 
			
		||||
					int max2 = parent.Count;
 | 
			
		||||
					if (max2 > max)
 | 
			
		||||
						return max2;
 | 
			
		||||
				}
 | 
			
		||||
				return max;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		#region ICustomTypeDescriptor
 | 
			
		||||
@@ -404,6 +604,28 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	#endregion
 | 
			
		||||
	#region vlnIndexedListConverter
 | 
			
		||||
	internal class vlnIndexedListConverter<T, C> : ExpandableObjectConverter
 | 
			
		||||
		where T : vlnIndexedFormatList<C>
 | 
			
		||||
		where C : vlnFormatItem,IVlnIndexedFormatItem, new()
 | 
			
		||||
	{
 | 
			
		||||
		private string Plural(string name)
 | 
			
		||||
		{
 | 
			
		||||
			if (name.EndsWith("y")) return name.Substring(0, name.Length - 1) + "ies";
 | 
			
		||||
			if (name.EndsWith("ss")) return name + "es";
 | 
			
		||||
			else return name + "s";
 | 
			
		||||
		}
 | 
			
		||||
		public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
 | 
			
		||||
		{
 | 
			
		||||
			if (destType == typeof(string) && value is T)
 | 
			
		||||
			{
 | 
			
		||||
				// Return department and department role separated by comma.
 | 
			
		||||
				return ((T)value).Count.ToString() + " " + (((T)value).Count == 1 ? typeof(C).Name : Plural(typeof(C).Name));
 | 
			
		||||
			}
 | 
			
		||||
			return base.ConvertTo(context, culture, value, destType);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	#endregion
 | 
			
		||||
	#region vlnPropertyDescriptor
 | 
			
		||||
	public class vlnPropertyDescriptor<T, C> : PropertyDescriptor
 | 
			
		||||
		where T : vlnFormatList<C>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user