- Added ShortPath Property to ItemInfo
- Added MacroList Added CheckOff data Added CheckOff and ChangeBar Fixed inheritance
This commit is contained in:
		@@ -1172,6 +1172,22 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		public string ShortPath
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				string number = (MyContent.Type >= 20000 ? Ordinal.ToString() + "." : ((DisplayNumber ?? "") == "" ? DisplayText : DisplayNumber));
 | 
			
		||||
				ItemInfo parent = this;
 | 
			
		||||
				while (parent.MyPrevious != null) parent = parent.MyPrevious;
 | 
			
		||||
				if (parent.ItemPartCount == 0)
 | 
			
		||||
					return number;
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					PartInfo partInfo = parent.ItemParts[0];
 | 
			
		||||
					return partInfo.MyContent.ContentItems.Items[0].ShortPath + "." + ((E_FromType)partInfo.FromType).ToString().Substring(0,1) +  number;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		public ContentInfo ParentContent
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
@@ -1880,6 +1896,49 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		#endregion
 | 
			
		||||
		#region Macro List
 | 
			
		||||
		[NonSerialized]
 | 
			
		||||
		protected List<Macro> _MyMacros;
 | 
			
		||||
		protected bool _MacrosSetup = false;
 | 
			
		||||
		public List<Macro> MyMacros
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				if (!_MacrosSetup) SetupMacros();
 | 
			
		||||
				return _MyMacros;
 | 
			
		||||
			}
 | 
			
		||||
			set
 | 
			
		||||
			{
 | 
			
		||||
				_MyMacros = value;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		private void SetupMacros()
 | 
			
		||||
		{
 | 
			
		||||
			// see if each macro should be printed based on its attributes and the item we're on.
 | 
			
		||||
			// Attributes to check are NotInRNO, i.e. only add this macro to the result list if 
 | 
			
		||||
			// the item is not in the RNO column.  Also, Groupings is used to only have the macro if
 | 
			
		||||
			// there are N or more of the type in the grouping.
 | 
			
		||||
			List<Macro> tmp = new List<Macro>();
 | 
			
		||||
			foreach (Macro macro in ActiveFormat.PlantFormat.FormatData.StepDataList[FormatStepType].TabData.MacroList)
 | 
			
		||||
			{
 | 
			
		||||
				bool addToList = true;
 | 
			
		||||
				if (macro.NotInRNO && IsInRNO) addToList = false;
 | 
			
		||||
				if (macro.Grouping != null && macro.Grouping > 0)
 | 
			
		||||
				{
 | 
			
		||||
					int count = 0;
 | 
			
		||||
					ItemInfo ii = FirstSibling;
 | 
			
		||||
					while (ii != null)
 | 
			
		||||
					{
 | 
			
		||||
						if (ii.MyContent.Type == MyContent.Type) count++;
 | 
			
		||||
						ii = ii.NextItem;
 | 
			
		||||
					}
 | 
			
		||||
					if (count < macro.Grouping) addToList = false;
 | 
			
		||||
				}
 | 
			
		||||
				if (addToList) tmp.Add(macro);
 | 
			
		||||
			}
 | 
			
		||||
			if (tmp.Count > 0) _MyMacros = tmp;
 | 
			
		||||
		}
 | 
			
		||||
		#endregion
 | 
			
		||||
	}
 | 
			
		||||
	#endregion ItemInfo
 | 
			
		||||
	#region Tab
 | 
			
		||||
 
 | 
			
		||||
@@ -94,6 +94,18 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		#endregion
 | 
			
		||||
		#region UseCheckOffs
 | 
			
		||||
		[Category("Miscellaneous")]
 | 
			
		||||
		[Description("Section Uses Checkoffs")]
 | 
			
		||||
		private LazyLoad<bool> _UseCheckOffs;
 | 
			
		||||
		public bool UseCheckOffs
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return LazyLoad(ref _UseCheckOffs, "@UseCheckOffs");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		#endregion
 | 
			
		||||
		#region Oldtonew
 | 
			
		||||
		[Category("Miscellaneous")]
 | 
			
		||||
		[Description("Convert from old to new")]
 | 
			
		||||
 
 | 
			
		||||
@@ -777,14 +777,6 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
	public class CheckOffData : vlnFormatItem
 | 
			
		||||
	{
 | 
			
		||||
		public CheckOffData(XmlNode xmlNode) : base(xmlNode) { }
 | 
			
		||||
		private RightCheckOffBoxList _RightCheckOffBoxList;
 | 
			
		||||
		public RightCheckOffBoxList RightCheckOffBoxList
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return _RightCheckOffBoxList == null? _RightCheckOffBoxList = new RightCheckOffBoxList(SelectNodes("RightCheckOffBoxList/RightCheckOffBox"),MyFormat):_RightCheckOffBoxList;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		private CheckOffList _CheckOffList;
 | 
			
		||||
		public CheckOffList CheckOffList
 | 
			
		||||
		{
 | 
			
		||||
@@ -801,12 +793,28 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
				return _CheckOffHeaderList == null? _CheckOffHeaderList = new CheckOffHeaderList(SelectNodes("CheckOffHeaderList/CheckOffHeader"),MyFormat):	_CheckOffHeaderList;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		private LazyLoad<int?> _UseCheckOffsIn;
 | 
			
		||||
		public int? UseCheckOffsIn
 | 
			
		||||
		private LazyLoad<string> _Menu;
 | 
			
		||||
		public string Menu
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return LazyLoad(ref _UseCheckOffsIn, "@UseCheckOffsIn");
 | 
			
		||||
				return LazyLoad(ref _Menu, "@Menu");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		private LazyLoad<bool> _AllowSectEdit;
 | 
			
		||||
		public bool AllowSectEdit
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return LazyLoad(ref _AllowSectEdit, "@AllowSectEdit");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		private LazyLoad<bool> _AllowStepEdit;
 | 
			
		||||
		public bool AllowStepEdit
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return LazyLoad(ref _AllowStepEdit, "@AllowStepEdit");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		private LazyLoad<int?> _CheckOffAdjustment;
 | 
			
		||||
@@ -817,6 +825,14 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
				return LazyLoad(ref _CheckOffAdjustment, "@CheckOffAdjustment");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		private LazyLoad<int?> _CheckOffXtraLines;
 | 
			
		||||
		public int? CheckOffXtraLines
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return LazyLoad(ref _CheckOffXtraLines, "@CheckOffXtraLines");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		private LazyLoad<bool> _DropCheckOff;
 | 
			
		||||
		public bool DropCheckOff
 | 
			
		||||
		{
 | 
			
		||||
@@ -833,60 +849,67 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
				return LazyLoad(ref _CheckOffOnHLSOnly, "@CheckOffOnHLSOnly");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	#endregion
 | 
			
		||||
	#region RightCheckOffBox
 | 
			
		||||
	[TypeConverter(typeof(ExpandableObjectConverter))]
 | 
			
		||||
	public class RightCheckOffBox : vlnFormatItem, IVlnIndexedFormatItem
 | 
			
		||||
	{
 | 
			
		||||
		public RightCheckOffBox(XmlNode xmlNode) : base(xmlNode) { }
 | 
			
		||||
		public RightCheckOffBox() : base() { }
 | 
			
		||||
		private LazyLoad<int?> _Index;
 | 
			
		||||
		public int? Index
 | 
			
		||||
		private LazyLoad<bool> _SkipSpaces;
 | 
			
		||||
		public bool SkipSpaces
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return LazyLoad(ref _Index, "@Index");
 | 
			
		||||
				return LazyLoad(ref _SkipSpaces, "@SkipSpaces");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		private LazyLoad<int?> _RightCheckOffBoxChar;
 | 
			
		||||
		public int? RightCheckOffBoxChar
 | 
			
		||||
		{ 
 | 
			
		||||
			get 
 | 
			
		||||
			{
 | 
			
		||||
				return LazyLoad(ref _RightCheckOffBoxChar, "@RightCheckOffBoxChar");
 | 
			
		||||
			} 
 | 
			
		||||
		}
 | 
			
		||||
		public override string GetPDDisplayName()
 | 
			
		||||
		{ return string.Format("[{0}]", Index); }
 | 
			
		||||
		public override string GetPDDescription()
 | 
			
		||||
		{ return string.Format("[{0}] - {1}", Index, RightCheckOffBoxChar); }
 | 
			
		||||
		public override string GetPDCategory()
 | 
			
		||||
		{ return "RightCheckOffBox Data"; }
 | 
			
		||||
		public override string ToString()
 | 
			
		||||
		{
 | 
			
		||||
			return RightCheckOffBoxChar.ToString();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	#endregion
 | 
			
		||||
	#region RightCheckOffBoxList
 | 
			
		||||
	[TypeConverter(typeof(vlnIndexedListConverter<RightCheckOffBoxList, RightCheckOffBox>))]
 | 
			
		||||
	public class RightCheckOffBoxList : vlnIndexedFormatList<RightCheckOffBox>
 | 
			
		||||
	{
 | 
			
		||||
		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 RightCheckOffBox
 | 
			
		||||
	//[TypeConverter(typeof(ExpandableObjectConverter))]
 | 
			
		||||
	//public class RightCheckOffBox : vlnFormatItem, IVlnIndexedFormatItem
 | 
			
		||||
	//{
 | 
			
		||||
	//    public RightCheckOffBox(XmlNode xmlNode) : base(xmlNode) { }
 | 
			
		||||
	//    public RightCheckOffBox() : base() { }
 | 
			
		||||
	//    private LazyLoad<int?> _Index;
 | 
			
		||||
	//    public int? Index
 | 
			
		||||
	//    { 
 | 
			
		||||
	//        get 
 | 
			
		||||
	//        {
 | 
			
		||||
	//            return LazyLoad(ref _Index, "@Index");
 | 
			
		||||
	//        } 
 | 
			
		||||
	//    }
 | 
			
		||||
	//    private LazyLoad<int?> _RightCheckOffBoxChar;
 | 
			
		||||
	//    public int? RightCheckOffBoxChar
 | 
			
		||||
	//    { 
 | 
			
		||||
	//        get 
 | 
			
		||||
	//        {
 | 
			
		||||
	//            return LazyLoad(ref _RightCheckOffBoxChar, "@RightCheckOffBoxChar");
 | 
			
		||||
	//        } 
 | 
			
		||||
	//    }
 | 
			
		||||
	//    public override string GetPDDisplayName()
 | 
			
		||||
	//    { return string.Format("[{0}]", Index); }
 | 
			
		||||
	//    public override string GetPDDescription()
 | 
			
		||||
	//    { return string.Format("[{0}] - {1}", Index, RightCheckOffBoxChar); }
 | 
			
		||||
	//    public override string GetPDCategory()
 | 
			
		||||
	//    { return "RightCheckOffBox Data"; }
 | 
			
		||||
	//    public override string ToString()
 | 
			
		||||
	//    {
 | 
			
		||||
	//        return RightCheckOffBoxChar.ToString();
 | 
			
		||||
	//    }
 | 
			
		||||
	//}
 | 
			
		||||
	//#endregion
 | 
			
		||||
	//#region RightCheckOffBoxList
 | 
			
		||||
	//[TypeConverter(typeof(vlnIndexedListConverter<RightCheckOffBoxList, RightCheckOffBox>))]
 | 
			
		||||
	//public class RightCheckOffBoxList : vlnIndexedFormatList<RightCheckOffBox>
 | 
			
		||||
	//{
 | 
			
		||||
	//    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,IVlnIndexedFormatItem
 | 
			
		||||
@@ -901,12 +924,12 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
				return LazyLoad(ref _Index, "@Index");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		private LazyLoad<int?> _RightCheckOffChars;
 | 
			
		||||
		public int? RightCheckOffChars
 | 
			
		||||
		private LazyLoad<int?> _UIMark;
 | 
			
		||||
		public int? UIMark
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return LazyLoad(ref _RightCheckOffChars, "@RightCheckOffChars");
 | 
			
		||||
				return LazyLoad(ref _UIMark, "@UIMark");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		private LazyLoad<int?> _CheckOffWidAdjust;
 | 
			
		||||
@@ -917,23 +940,31 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
				return LazyLoad(ref _CheckOffWidAdjust, "@CheckOffWidAdjust");
 | 
			
		||||
			} 
 | 
			
		||||
		}
 | 
			
		||||
		private LazyLoad<string> _RightCheckOffPrompt;
 | 
			
		||||
		public string RightCheckOffPrompt
 | 
			
		||||
		private LazyLoad<string> _MenuItem;
 | 
			
		||||
		public string MenuItem
 | 
			
		||||
		{ 
 | 
			
		||||
			get 
 | 
			
		||||
			{
 | 
			
		||||
				return LazyLoad(ref _RightCheckOffPrompt, "@RightCheckOffPrompt");
 | 
			
		||||
				return LazyLoad(ref _MenuItem, "@MenuItem");
 | 
			
		||||
			} 
 | 
			
		||||
		}
 | 
			
		||||
		private LazyLoad<string> _Macro;
 | 
			
		||||
		public string Macro
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return LazyLoad(ref _Macro, "@Macro");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		public override string GetPDDisplayName()
 | 
			
		||||
		{ return string.Format("[{0}]",Index); }
 | 
			
		||||
		public override string GetPDDescription()
 | 
			
		||||
		{ return string.Format("[{0}] - {1}", Index, RightCheckOffPrompt); }
 | 
			
		||||
		{ return string.Format("[{0}] - {1}", Index, MenuItem); }
 | 
			
		||||
		public override string GetPDCategory()
 | 
			
		||||
		{ return "Checkoff Data"; }
 | 
			
		||||
		public override string ToString()
 | 
			
		||||
		{
 | 
			
		||||
			return RightCheckOffPrompt;
 | 
			
		||||
			return MenuItem;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	#endregion
 | 
			
		||||
@@ -1019,6 +1050,14 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
	public class ChangeBarData : vlnFormatItem
 | 
			
		||||
	{
 | 
			
		||||
		public ChangeBarData(XmlNode xmlNode) : base(xmlNode) { }
 | 
			
		||||
		private LazyLoad<string> _DefaultCBLoc;
 | 
			
		||||
		public string DefaultCBLoc
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return LazyLoad(ref _DefaultCBLoc, "@DefaultCBLoc");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		private LazyLoad<string> _ChangeBarMessage;
 | 
			
		||||
		public string ChangeBarMessage
 | 
			
		||||
		{ 
 | 
			
		||||
@@ -3946,6 +3985,14 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
			: base(xmlNode)
 | 
			
		||||
		{
 | 
			
		||||
		}
 | 
			
		||||
		private MacroList _MacroList;
 | 
			
		||||
		public MacroList MacroList
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return _MacroList == null ? _MacroList = new MacroList(SelectNodes("TabData/MacroList/Macro")) : _MacroList;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		private LazyLoad<string> _IdentEdit;
 | 
			
		||||
		public string IdentEdit
 | 
			
		||||
		{
 | 
			
		||||
@@ -3994,14 +4041,14 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
				return LazyLoad(ref _Justify, "TabData/@Justify");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		private LazyLoad<string> _CheckOff;
 | 
			
		||||
		public string CheckOff
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return LazyLoad(ref _CheckOff, "TabData/@CheckOff");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		//private LazyLoad<string> _CheckOff;
 | 
			
		||||
		//public string CheckOff
 | 
			
		||||
		//{
 | 
			
		||||
		//    get
 | 
			
		||||
		//    {
 | 
			
		||||
		//        return LazyLoad(ref _CheckOff, "TabData/@CheckOff");
 | 
			
		||||
		//    }
 | 
			
		||||
		//}
 | 
			
		||||
		private LazyLoad<bool> _UsePreviousStyle;
 | 
			
		||||
		public bool UsePreviousStyle
 | 
			
		||||
		{
 | 
			
		||||
@@ -4019,8 +4066,91 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
				return (_Font == null ? _Font = new VE_Font(xn) : _Font);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	#endregion
 | 
			
		||||
	#region MacroList
 | 
			
		||||
	[TypeConverter(typeof(vlnListConverter<MacroList, Macro>))]
 | 
			
		||||
	public class MacroList : vlnNamedFormatList<Macro>
 | 
			
		||||
	{
 | 
			
		||||
		public MacroList(XmlNodeList xmlNodeList) : base(xmlNodeList, null) { }
 | 
			
		||||
		public override vlnNamedFormatList<Macro> InheritedList
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
 | 
			
		||||
				return null;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	#endregion
 | 
			
		||||
	#region Macro
 | 
			
		||||
	[TypeConverter(typeof(ExpandableObjectConverter))]
 | 
			
		||||
	public class Macro : vlnFormatItem, IVlnNamedFormatItem
 | 
			
		||||
	{
 | 
			
		||||
		public Macro(XmlNode xmlNode) : base(xmlNode) { }
 | 
			
		||||
		public Macro() : base() { }
 | 
			
		||||
		private LazyLoad<string> _Name;
 | 
			
		||||
		public string Name
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return LazyLoad(ref _Name, "@Name");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		private LazyLoad<string> _MacroDef;
 | 
			
		||||
		public string MacroDef
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				if (_Inherited == null) SetupStepInheritance();
 | 
			
		||||
				return LazyLoad(ref _MacroDef, "@Macro");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		private LazyLoad<int?> _Grouping;
 | 
			
		||||
		public int? Grouping
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				if (_Inherited == null) SetupStepInheritance();
 | 
			
		||||
				return LazyLoad(ref _Grouping, "@Grouping");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		private LazyLoad<bool> _NotInRNO;
 | 
			
		||||
		public bool NotInRNO
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				if (_Inherited == null) SetupStepInheritance();
 | 
			
		||||
				return LazyLoad(ref _NotInRNO, "@NotInRNO");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		private bool? _Inherited;
 | 
			
		||||
		public bool Inherited
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				if (_Inherited == null)	SetupStepInheritance();
 | 
			
		||||
				return (bool) _Inherited;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		private void SetupStepInheritance()
 | 
			
		||||
		{
 | 
			
		||||
			if (_Inherited != null) return;
 | 
			
		||||
			LazyLoad<string> macroName = null;
 | 
			
		||||
			_Inherited = (LazyLoad(ref macroName, "@Macro") == null);
 | 
			
		||||
			// No MacroName, Find parent that has data
 | 
			
		||||
			string path = string.Format("TabData/MacroList/Macro[@Name='{0}' and @Macro]", Name);
 | 
			
		||||
			XmlNode xn = vlnFormatDocument.LookupSingleStepNode(XmlNode.ParentNode.ParentNode.ParentNode, path);
 | 
			
		||||
			if (xn != null)
 | 
			
		||||
			{
 | 
			
		||||
				_MacroDef = new LazyLoad<string>(RetrieveString(xn.SelectSingleNode("@Macro")));
 | 
			
		||||
				_Grouping = new LazyLoad<int?>(RetrieveInt("@Grouping" ,xn.SelectSingleNode("@Grouping")));
 | 
			
		||||
				_NotInRNO = new LazyLoad<bool>(RetrieveBool( xn.SelectSingleNode("@NotInRNO")));
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
#endregion
 | 
			
		||||
	#endregion
 | 
			
		||||
	#region BoxDataAll
 | 
			
		||||
	#region Box
 | 
			
		||||
 
 | 
			
		||||
@@ -322,20 +322,27 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
			if (ll == null)
 | 
			
		||||
			{
 | 
			
		||||
				XmlNode xn = SelectSingleNode(xPath);
 | 
			
		||||
				string tstr = xn != null ? xn.InnerText : "FALSE";
 | 
			
		||||
				ll = new LazyLoad<bool>(tstr.ToUpper() == "TRUE" ? true : false);
 | 
			
		||||
				ll = new LazyLoad<bool>(RetrieveBool(xn));
 | 
			
		||||
			}
 | 
			
		||||
			return ll.Value;
 | 
			
		||||
		}
 | 
			
		||||
		protected static bool RetrieveBool(XmlNode xn)
 | 
			
		||||
		{
 | 
			
		||||
			return xn != null && xn.InnerText.ToUpper() == "TRUE";
 | 
			
		||||
		}
 | 
			
		||||
		public string LazyLoad(ref LazyLoad<string> ll, string xPath)
 | 
			
		||||
		{
 | 
			
		||||
			if (ll == null)
 | 
			
		||||
			{
 | 
			
		||||
				XmlNode xn = SelectSingleNode(xPath);
 | 
			
		||||
				ll = new LazyLoad<string>(xn != null ? xn.InnerText : null);
 | 
			
		||||
				ll = new LazyLoad<string>(RetrieveString(xn));
 | 
			
		||||
			}
 | 
			
		||||
			return ll.Value;
 | 
			
		||||
		}
 | 
			
		||||
		protected static string RetrieveString(XmlNode xn)
 | 
			
		||||
		{
 | 
			
		||||
			return xn != null ? xn.InnerText : null;
 | 
			
		||||
		}
 | 
			
		||||
		public string MyPath
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
@@ -356,23 +363,26 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
		{
 | 
			
		||||
			if (ll == 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);
 | 
			
		||||
				XmlNode xn = SelectSingleNode(xPath);
 | 
			
		||||
				ll = new LazyLoad<int?>(RetrieveInt(xPath, xn));
 | 
			
		||||
			}
 | 
			
		||||
			return ll.Value;
 | 
			
		||||
		}
 | 
			
		||||
		protected int? RetrieveInt(string xPath, XmlNode xn)
 | 
			
		||||
		{
 | 
			
		||||
			int? value = null;
 | 
			
		||||
			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;
 | 
			
		||||
			}
 | 
			
		||||
			return value;
 | 
			
		||||
		}
 | 
			
		||||
		public Nullable<T> LazyLoad<T>(ref LazyLoad<Nullable<T>> ll, string xPath)
 | 
			
		||||
			where T:struct
 | 
			
		||||
		{
 | 
			
		||||
@@ -405,6 +415,13 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
		int? Index { get; }
 | 
			
		||||
	}
 | 
			
		||||
	#endregion
 | 
			
		||||
	#region IVlnNamedFormatItem
 | 
			
		||||
	public partial interface IVlnNamedFormatItem
 | 
			
		||||
	{
 | 
			
		||||
		string Name { get; }
 | 
			
		||||
		bool Inherited { get; }
 | 
			
		||||
	}
 | 
			
		||||
	#endregion
 | 
			
		||||
	#region LazyLoad
 | 
			
		||||
	public class LazyLoad<T>
 | 
			
		||||
	{
 | 
			
		||||
@@ -595,6 +612,95 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
		#endregion
 | 
			
		||||
	}
 | 
			
		||||
	#endregion
 | 
			
		||||
	#region vlnNamedFormatList
 | 
			
		||||
	public class vlnNamedFormatList<T> : vlnFormatList<T>, ICustomTypeDescriptor
 | 
			
		||||
		where T : vlnFormatItem, IVlnNamedFormatItem, new()
 | 
			
		||||
	{
 | 
			
		||||
		public vlnNamedFormatList(XmlNodeList xmlNodeList, IFormatOrFormatInfo myFormat)
 | 
			
		||||
			: base(xmlNodeList)
 | 
			
		||||
		{
 | 
			
		||||
			MyFormat = myFormat;
 | 
			
		||||
		}
 | 
			
		||||
		public vlnNamedFormatList() : base() { }
 | 
			
		||||
		public virtual vlnNamedFormatList<T> InheritedList { get { return null; } }
 | 
			
		||||
		public new T this[string name]
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				foreach (T tmp in this)
 | 
			
		||||
				{
 | 
			
		||||
					if (tmp.Name == name)
 | 
			
		||||
						return tmp;
 | 
			
		||||
				}
 | 
			
		||||
				vlnNamedFormatList<T> ttlParent = InheritedList; //Check Inherited Value
 | 
			
		||||
				if (ttlParent != null)
 | 
			
		||||
					return ttlParent[name];
 | 
			
		||||
				return null;
 | 
			
		||||
				// None found - Can I find it in another format?
 | 
			
		||||
				return null;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		public new T this[int index]
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				if(base.Count > index)
 | 
			
		||||
					return base[index];
 | 
			
		||||
				vlnNamedFormatList<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
 | 
			
		||||
			{
 | 
			
		||||
				return base.Count;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		#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 vlnListConverter
 | 
			
		||||
	internal class vlnListConverter<T, C> : ExpandableObjectConverter
 | 
			
		||||
		where T : vlnFormatList<C>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user