CSLA - Format, Minimal, VEObject
This commit is contained in:
@@ -1,40 +1,23 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
public class Comparator
|
public class Comparator
|
||||||
{
|
{
|
||||||
private XmlDocument _ResultsDoc;
|
public XmlDocument ResultsDoc { get; set; }
|
||||||
public XmlDocument ResultsDoc
|
public XmlDocument XDoc1 { get; set; }
|
||||||
{
|
public XmlDocument XDoc2 { get; set; }
|
||||||
get { return _ResultsDoc; }
|
public Comparator(XmlDocument xdoc1, XmlDocument xdoc2)
|
||||||
set { _ResultsDoc = value; }
|
|
||||||
}
|
|
||||||
private XmlDocument _XDoc1;
|
|
||||||
public XmlDocument XDoc1
|
|
||||||
{
|
|
||||||
get { return _XDoc1; }
|
|
||||||
set { _XDoc1 = value; }
|
|
||||||
}
|
|
||||||
private XmlDocument _XDoc2;
|
|
||||||
public XmlDocument XDoc2
|
|
||||||
{
|
|
||||||
get { return _XDoc2; }
|
|
||||||
set { _XDoc2 = value; }
|
|
||||||
}
|
|
||||||
public Comparator(XmlDocument xdoc1, XmlDocument xdoc2)
|
|
||||||
{
|
{
|
||||||
XDoc1 = xdoc1;
|
XDoc1 = xdoc1;
|
||||||
XDoc2 = xdoc2;
|
XDoc2 = xdoc2;
|
||||||
ResultsDoc = new XmlDocument();
|
ResultsDoc = new XmlDocument();
|
||||||
ResultsDoc.LoadXml(@"<PlantFormat></PlantFormat>");
|
ResultsDoc.LoadXml(@"<PlantFormat></PlantFormat>");
|
||||||
}
|
}
|
||||||
public Comparator(string existingFC, string importedFC) //string fName1, string fName2)
|
public Comparator(string existingFC, string importedFC)
|
||||||
{
|
{
|
||||||
XDoc1 = new XmlDocument();
|
XDoc1 = new XmlDocument();
|
||||||
XDoc1.LoadXml(existingFC);
|
XDoc1.LoadXml(existingFC);
|
||||||
@@ -104,12 +87,12 @@ namespace VEPROMS.CSLA.Library
|
|||||||
xnss1.Add(GetKey(xc1), xc1);
|
xnss1.Add(GetKey(xc1), xc1);
|
||||||
foreach (XmlNode xc2 in xns2.Values)
|
foreach (XmlNode xc2 in xns2.Values)
|
||||||
if (xnss1.ContainsKey(GetKey(xc2)))
|
if (xnss1.ContainsKey(GetKey(xc2)))
|
||||||
Compare(xnss1[GetKey(xc2)], xc2, path + "/" + GetKey(xc2));
|
Compare(xnss1[GetKey(xc2)], xc2, $"{path}/{GetKey(xc2)}");
|
||||||
else
|
else
|
||||||
xnss2.Add(GetKey(xc2), xc2);
|
xnss2.Add(GetKey(xc2), xc2);
|
||||||
// element differences, if counts are different. xns1 elements are not found in xns2 and xns2 elements are not found in xns1
|
// element differences, if counts are different. xns1 elements are not found in xns2 and xns2 elements are not found in xns1
|
||||||
if (xns1.Count == 0 && xns2.Count == 0) return;
|
if (xns1.Count == 0 && xns2.Count == 0) return;
|
||||||
Console.WriteLine(" {0} {1} {2}", path + "/" + xn1.Name, xns1.Count, xns2.Count);
|
Console.WriteLine($" {path}/{xn1.Name} {xns1.Count} {xns2.Count}");
|
||||||
foreach (string key in xnss1.Keys)
|
foreach (string key in xnss1.Keys)
|
||||||
{
|
{
|
||||||
if (xnss1[key].Attributes.Count > 0 || xnss1[key].ChildNodes.Count > 0)
|
if (xnss1[key].Attributes.Count > 0 || xnss1[key].ChildNodes.Count > 0)
|
||||||
@@ -210,18 +193,14 @@ namespace VEPROMS.CSLA.Library
|
|||||||
public string GetKey1(XmlNode xn)
|
public string GetKey1(XmlNode xn)
|
||||||
{
|
{
|
||||||
if (xn.Attributes == null) return xn.Name;
|
if (xn.Attributes == null) return xn.Name;
|
||||||
XmlAttribute xi = xn.Attributes.GetNamedItem("Index") as XmlAttribute;
|
if (xn.Attributes.GetNamedItem("Index") is XmlAttribute xi)
|
||||||
if (xi != null)
|
{
|
||||||
{
|
if (xn.Attributes.GetNamedItem("Name") is XmlAttribute xa) return string.Format("{0}[{1}]", xn.Name, xa.Value);
|
||||||
XmlAttribute xa = xn.Attributes.GetNamedItem("Name") as XmlAttribute;
|
return string.Format("{0}[{1}]", xn.Name, xi.Value);
|
||||||
if (xa != null) return string.Format("{0}[{1}]", xn.Name, xa.Value);
|
}
|
||||||
return string.Format("{0}[{1}]", xn.Name, xi.Value);
|
if (xn.Attributes.GetNamedItem("Token") is XmlAttribute xt) return string.Format("{0}[{1}]", xn.Name, xt.Value);
|
||||||
}
|
if (xn.Attributes.GetNamedItem("ReplaceWord") is XmlAttribute xw) return string.Format("{0}[{1}]", xn.Name, xw.Value);
|
||||||
XmlAttribute xt = xn.Attributes.GetNamedItem("Token") as XmlAttribute;
|
return xn.Name;
|
||||||
if(xt != null) return string.Format("{0}[{1}]", xn.Name, xt.Value);
|
|
||||||
XmlAttribute xw = xn.Attributes.GetNamedItem("ReplaceWord") as XmlAttribute;
|
|
||||||
if(xw != null) return string.Format("{0}[{1}]", xn.Name, xw.Value);
|
|
||||||
return xn.Name;
|
|
||||||
}
|
}
|
||||||
static private XmlNode makeXPath(XmlDocument doc, string xpath)
|
static private XmlNode makeXPath(XmlDocument doc, string xpath)
|
||||||
{
|
{
|
||||||
@@ -252,7 +231,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
string name = nextNodeInXPath.Substring(indx, nextNodeInXPath.IndexOf("=",indx)-indx);
|
string name = nextNodeInXPath.Substring(indx, nextNodeInXPath.IndexOf("=",indx)-indx);
|
||||||
XmlAttribute xKeyd = doc.CreateAttribute(name);
|
XmlAttribute xKeyd = doc.CreateAttribute(name);
|
||||||
indx = nextNodeInXPath.IndexOf("='",indx)+2;
|
indx = nextNodeInXPath.IndexOf("='",indx)+2;
|
||||||
string value = nextNodeInXPath.Substring(indx,nextNodeInXPath.IndexOf("'", indx) - indx);
|
|
||||||
xKeyd.Value = nextNodeInXPath.Substring(indx,nextNodeInXPath.IndexOf("'",indx)-indx);
|
xKeyd.Value = nextNodeInXPath.Substring(indx,nextNodeInXPath.IndexOf("'",indx)-indx);
|
||||||
node.Attributes.Append(xKeyd);
|
node.Attributes.Append(xKeyd);
|
||||||
}
|
}
|
||||||
@@ -277,58 +255,56 @@ namespace VEPROMS.CSLA.Library
|
|||||||
// go through attributes in first xml document, see if they exist in the 2nd xml document & are identical attribute
|
// go through attributes in first xml document, see if they exist in the 2nd xml document & are identical attribute
|
||||||
foreach (XmlAttribute xa1 in atts1)
|
foreach (XmlAttribute xa1 in atts1)
|
||||||
{
|
{
|
||||||
XmlAttribute xa2 = atts2.GetNamedItem(xa1.Name) as XmlAttribute;
|
if (!(atts2.GetNamedItem(xa1.Name) is XmlAttribute xa2))
|
||||||
if (xa2 == null)
|
{
|
||||||
{
|
XmlNode xnr = MakeXPathFormat(path);
|
||||||
XmlNode xnr = MakeXPathFormat(path);
|
if (xnr != null)
|
||||||
if (xnr != null)
|
{
|
||||||
{
|
XmlAttribute xKey = ResultsDoc.CreateAttribute(xa1.Name + "Old");
|
||||||
XmlAttribute xKey = ResultsDoc.CreateAttribute(xa1.Name+"Old");
|
xKey.Value = xa1.Value;
|
||||||
xKey.Value = xa1.Value;
|
xnr.Attributes.Append(xKey);
|
||||||
xnr.Attributes.Append(xKey);
|
xKey = ResultsDoc.CreateAttribute("OldKey");
|
||||||
xKey = ResultsDoc.CreateAttribute("OldKey");
|
xKey.Value = GetKey(atts1Par);
|
||||||
xKey.Value = GetKey(atts1Par);
|
if (xKey.Value != null) xnr.Attributes.Append(xKey);
|
||||||
if (xKey.Value != null) xnr.Attributes.Append(xKey);
|
}
|
||||||
}
|
}
|
||||||
}
|
else if (xa2.Value != xa1.Value)
|
||||||
else if (xa2.Value != xa1.Value)
|
{
|
||||||
{
|
XmlNode xnr = MakeXPathFormat(path);
|
||||||
XmlNode xnr = MakeXPathFormat(path);
|
if (xnr != null)
|
||||||
if (xnr != null)
|
{
|
||||||
{
|
XmlAttribute xKey = ResultsDoc.CreateAttribute(xa1.Name + "Old");
|
||||||
XmlAttribute xKey = ResultsDoc.CreateAttribute(xa1.Name + "Old");
|
xKey.Value = xa1.Value;
|
||||||
xKey.Value = xa1.Value;
|
xnr.Attributes.Append(xKey);
|
||||||
xnr.Attributes.Append(xKey);
|
XmlAttribute xKey2 = ResultsDoc.CreateAttribute(xa2.Name + "New");
|
||||||
XmlAttribute xKey2 = ResultsDoc.CreateAttribute(xa2.Name + "New");
|
xKey2.Value = xa2.Value;
|
||||||
xKey2.Value = xa2.Value;
|
xnr.Attributes.Append(xKey2);
|
||||||
xnr.Attributes.Append(xKey2);
|
xKey = ResultsDoc.CreateAttribute("OldKey");
|
||||||
xKey = ResultsDoc.CreateAttribute("OldKey");
|
xKey.Value = GetKey(atts1Par);
|
||||||
xKey.Value = GetKey(atts1Par);
|
if (xKey.Value != null) xnr.Attributes.Append(xKey);
|
||||||
if (xKey.Value != null) xnr.Attributes.Append(xKey);
|
xKey = ResultsDoc.CreateAttribute("NewKey");
|
||||||
xKey = ResultsDoc.CreateAttribute("NewKey");
|
xKey.Value = GetKey(atts2Par);
|
||||||
xKey.Value = GetKey(atts2Par);
|
if (xKey.Value != null) xnr.Attributes.Append(xKey);
|
||||||
if (xKey.Value != null) xnr.Attributes.Append(xKey);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// go through attributes in 2nd xml document to see if they exist in the first xml document & are identical
|
// go through attributes in 2nd xml document to see if they exist in the first xml document & are identical
|
||||||
foreach (XmlAttribute xa2 in atts2)
|
foreach (XmlAttribute xa2 in atts2)
|
||||||
{
|
{
|
||||||
XmlAttribute xa1 = atts1.GetNamedItem(xa2.Name) as XmlAttribute;
|
if (!(atts1.GetNamedItem(xa2.Name) is XmlAttribute))
|
||||||
if (xa1 == null)
|
{
|
||||||
{
|
XmlNode xnr = MakeXPathFormat(path);
|
||||||
XmlNode xnr = MakeXPathFormat(path);
|
if (xnr != null)
|
||||||
if (xnr != null)
|
{
|
||||||
{
|
XmlAttribute xKey = ResultsDoc.CreateAttribute(xa2.Name + "New");
|
||||||
XmlAttribute xKey = ResultsDoc.CreateAttribute(xa2.Name+"New");
|
xKey.Value = xa2.Value;
|
||||||
xKey.Value = xa2.Value;
|
xnr.Attributes.Append(xKey);
|
||||||
xnr.Attributes.Append(xKey);
|
xKey = ResultsDoc.CreateAttribute("NewKey");
|
||||||
xKey = ResultsDoc.CreateAttribute("NewKey");
|
xKey.Value = GetKey(atts2Par);
|
||||||
xKey.Value = GetKey(atts2Par);
|
if (xKey.Value != null) xnr.Attributes.Append(xKey);
|
||||||
if (xKey.Value != null) xnr.Attributes.Append(xKey);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using System.Xml;
|
|
||||||
using System.ComponentModel;
|
|
||||||
|
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -32,54 +31,27 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private LazyLoad<string> _Name;
|
private LazyLoad<string> _Name;
|
||||||
[DisplayName("Name")]
|
[DisplayName("Name")]
|
||||||
[Description("EP Viewer File Name")]
|
[Description("EP Viewer File Name")]
|
||||||
public string Name
|
public string Name => LazyLoad(ref _Name, "@Name");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return LazyLoad(ref _Name, "@Name");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Name of the EP Viewer Format File
|
// Name of the EP Viewer Format File
|
||||||
private LazyLoad<string> _Description;
|
private LazyLoad<string> _Description;
|
||||||
[DisplayName("Description")]
|
[DisplayName("Description")]
|
||||||
[Description("EP Viewer Description")]
|
[Description("EP Viewer Description")]
|
||||||
public string Description
|
public string Description => LazyLoad(ref _Description, "@Description");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return LazyLoad(ref _Description, "@Description");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Id of Annotation Type Associated with this file
|
// Id of Annotation Type Associated with this file
|
||||||
private LazyLoad<int?> _AnnotationTypeID;
|
private LazyLoad<int?> _AnnotationTypeID;
|
||||||
[DisplayName("AnnotationTypeID")]
|
[DisplayName("AnnotationTypeID")]
|
||||||
[Description("Id of Annotation Type Associated with this file")]
|
[Description("Id of Annotation Type Associated with this file")]
|
||||||
public int? AnnotationTypeID
|
public int? AnnotationTypeID => LazyLoad(ref _AnnotationTypeID, "@AnnotationTypeID");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return LazyLoad(ref _AnnotationTypeID, "@AnnotationTypeID");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return Name of Annotation that EP Format File is Attached to
|
// Return Name of Annotation that EP Format File is Attached to
|
||||||
public string AnnotationName()
|
public string AnnotationName() => AnnotationTypeInfo.Get((int)AnnotationTypeID).Name;
|
||||||
{
|
|
||||||
return AnnotationTypeInfo.Get((int) AnnotationTypeID).Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
//if xml value is blank, should element export?
|
//if xml value is blank, should element export?
|
||||||
//defaults to true
|
//defaults to true
|
||||||
private LazyLoad<bool> _exportblank;
|
private LazyLoad<bool> _exportblank;
|
||||||
[DisplayName("exportblank")]
|
[DisplayName("exportblank")]
|
||||||
[Description("if xml value is blank, should element export?")]
|
[Description("if xml value is blank, should element export?")]
|
||||||
public bool exportblank
|
public bool exportblank => LazyLoad(ref _exportblank, "@exportblank");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return LazyLoad(ref _exportblank, "@exportblank");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// returns a list of fields that are defined in the EP format's structure
|
// returns a list of fields that are defined in the EP format's structure
|
||||||
private EPFields _FieldList;
|
private EPFields _FieldList;
|
||||||
public EPFields FieldList
|
public EPFields FieldList
|
||||||
@@ -141,8 +113,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
if (dr.Read())
|
if (dr.Read())
|
||||||
{
|
{
|
||||||
XmlDocument xd = new XmlDocument();
|
XmlDocument xd = new XmlDocument
|
||||||
xd.XmlResolver = null;
|
{
|
||||||
|
XmlResolver = null
|
||||||
|
};
|
||||||
xd.LoadXml(dr.GetString("Data"));
|
xd.LoadXml(dr.GetString("Data"));
|
||||||
return xd;
|
return xd;
|
||||||
}
|
}
|
||||||
@@ -255,21 +229,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
public EPField(XmlNode xmlNode) : base(xmlNode) { }
|
public EPField(XmlNode xmlNode) : base(xmlNode) { }
|
||||||
public EPField() : base() { }
|
public EPField() : base() { }
|
||||||
private LazyLoad<string> _name;
|
private LazyLoad<string> _name;
|
||||||
public string name
|
public string name => LazyLoad(ref _name, "@name");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return LazyLoad(ref _name, "@name");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private LazyLoad<string> _type;
|
private LazyLoad<string> _type;
|
||||||
public string type
|
public string type => LazyLoad(ref _type, "@type");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return LazyLoad(ref _type, "@type");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private LazyLoad<string> _label;
|
private LazyLoad<string> _label;
|
||||||
public string label
|
public string label
|
||||||
{
|
{
|
||||||
@@ -284,22 +246,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
private LazyLoad<string> _text;
|
private LazyLoad<string> _text;
|
||||||
public string text
|
public string text => LazyLoad(ref _text, "@text");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return LazyLoad(ref _text, "@text");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//roid of group item that individual sub-items will be the choices for the list/combobox for ROSINGLE and ROMULTI
|
//roid of group item that individual sub-items will be the choices for the list/combobox for ROSINGLE and ROMULTI
|
||||||
private LazyLoad<string> _rosource;
|
private LazyLoad<string> _rosource;
|
||||||
public string rosource
|
public string rosource => LazyLoad(ref _rosource, "@rosource");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return LazyLoad(ref _rosource, "@rosource");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//the columns in the RO that will be included in the exports
|
//the columns in the RO that will be included in the exports
|
||||||
private LazyLoad<string> _returncols;
|
private LazyLoad<string> _returncols;
|
||||||
public List<string> returncols()
|
public List<string> returncols()
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
|
||||||
@@ -23,44 +20,23 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Business Methods
|
#region Business Methods
|
||||||
// description to associate with a DocStyle
|
// description to associate with a DocStyle
|
||||||
private LazyLoad<string> _Name;
|
private LazyLoad<string> _Name;
|
||||||
[DisplayName("Name")]
|
[DisplayName("Name")]
|
||||||
[Description("Page Style Name")]
|
[Description("Page Style Name")]
|
||||||
public string Name
|
public string Name => LazyLoad(ref _Name, "@Name");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return LazyLoad(ref _Name, "@Name");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// a unuque number that is referenced from the DocStyles
|
// a unuque number that is referenced from the DocStyles
|
||||||
private LazyLoad<int?> _Index;
|
private LazyLoad<int?> _Index;
|
||||||
[DisplayName("Index")]
|
[DisplayName("Index")]
|
||||||
[Description("Page Style Index")]
|
[Description("Page Style Index")]
|
||||||
public int? Index
|
public int? Index => LazyLoad(ref _Index, "@Index");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return LazyLoad(ref _Index, "@Index");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private PageItems _PageItems;
|
private PageItems _PageItems;
|
||||||
public PageItems PageItems
|
public PageItems PageItems => _PageItems ?? (_PageItems = new PageItems(SelectNodes("Item")));
|
||||||
{
|
#endregion
|
||||||
get
|
#region Override ToString
|
||||||
{
|
public override string ToString() => string.Format("{0:D2} - {1}", Index, Name);
|
||||||
return (_PageItems == null)? _PageItems = new PageItems(SelectNodes("Item")): _PageItems;
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
#region Override ToString
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return string.Format("{0:D2} - {1}", Index, Name);
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
#region PageItems
|
#region PageItems
|
||||||
[TypeConverter(typeof(vlnListConverter<PageItems, PageItem>))]
|
[TypeConverter(typeof(vlnListConverter<PageItems, PageItem>))]
|
||||||
@@ -79,192 +55,91 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Business Methods
|
#region Business Methods
|
||||||
private VE_Font _Font;
|
private VE_Font _Font;
|
||||||
[Category("Font")]
|
[Category("Font")]
|
||||||
[DisplayName("Font")]
|
[DisplayName("Font")]
|
||||||
[Description("Font")]
|
[Description("Font")]
|
||||||
public VE_Font Font
|
public VE_Font Font => _Font ?? (_Font = new VE_Font(XmlNode));
|
||||||
{
|
private RelatedItem _RelatedItem;
|
||||||
get
|
public RelatedItem RelatedItem => _RelatedItem ?? (_RelatedItem = new RelatedItem(SelectSingleNode("RelatedItem")));
|
||||||
{
|
|
||||||
return (_Font == null) ?_Font = new VE_Font(XmlNode): _Font;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private RelatedItem _RelatedItem;
|
|
||||||
public RelatedItem RelatedItem
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return (_RelatedItem == null) ? _RelatedItem = new RelatedItem(SelectSingleNode("RelatedItem")) : _RelatedItem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// this can be an actual token, in curly braces, that dynamically gets replaced with information, or just plain text
|
// this can be an actual token, in curly braces, that dynamically gets replaced with information, or just plain text
|
||||||
private LazyLoad<string> _Token;
|
private LazyLoad<string> _Token;
|
||||||
[Category("Content")]
|
[Category("Content")]
|
||||||
[DisplayName("Content")]
|
[DisplayName("Content")]
|
||||||
[Description("Item Content")]
|
[Description("Item Content")]
|
||||||
public string Token
|
public string Token => LazyLoad(ref _Token, "@Token");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return LazyLoad(ref _Token, "@Token");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// the row on the page to place the Item
|
// the row on the page to place the Item
|
||||||
private LazyLoad<float?> _Row;
|
private LazyLoad<float?> _Row;
|
||||||
[Category("Location")]
|
[Category("Location")]
|
||||||
[DisplayName("Vertical Position")]
|
[DisplayName("Vertical Position")]
|
||||||
[Description("Vertical Position")]
|
[Description("Vertical Position")]
|
||||||
public float? Row
|
public float? Row => LazyLoad(ref _Row, "@Row");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return LazyLoad(ref _Row, "@Row");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// the column on the page to place the Item
|
// the column on the page to place the Item
|
||||||
private LazyLoad<float?> _Col;
|
private LazyLoad<float?> _Col;
|
||||||
[Category("Location")]
|
[Category("Location")]
|
||||||
[DisplayName("Horizontal Position")]
|
[DisplayName("Horizontal Position")]
|
||||||
[Description("Horizontal Position")]
|
[Description("Horizontal Position")]
|
||||||
public float? Col
|
public float? Col => LazyLoad(ref _Col, "@Col");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return LazyLoad(ref _Col, "@Col");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// the justification at the Col position in which to print the Token information
|
// the justification at the Col position in which to print the Token information
|
||||||
private LazyLoad<E_Justify?> _Justify;
|
private LazyLoad<E_Justify?> _Justify;
|
||||||
public E_Justify? Justify
|
public E_Justify? Justify => LazyLoad<E_Justify>(ref _Justify, "@Justify");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return LazyLoad<E_Justify>(ref _Justify, "@Justify");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//run the PROMS Replace Words logic on the resulting text of Token
|
//run the PROMS Replace Words logic on the resulting text of Token
|
||||||
private LazyLoad<bool> _RepWords; // F2021-053: Do replace words in page list
|
private LazyLoad<bool> _RepWords; // F2021-053: Do replace words in page list
|
||||||
public bool RepWords
|
public bool RepWords => LazyLoad(ref _RepWords, "@RepWords");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return LazyLoad(ref _RepWords, "@RepWords");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Flag to tell PROMS to get the alarm value information based on the specified Child applicability
|
//Flag to tell PROMS to get the alarm value information based on the specified Child applicability
|
||||||
private LazyLoad<bool> _ROLkUpMatch; // C2021-065 (BNPP Alarms format)
|
private LazyLoad<bool> _ROLkUpMatch; // C2021-065 (BNPP Alarms format)
|
||||||
public bool ROLkUpMatch
|
public bool ROLkUpMatch => LazyLoad(ref _ROLkUpMatch, "@ROLkUpMatch");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return LazyLoad(ref _ROLkUpMatch, "@ROLkUpMatch");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Flag to specify if that PageStyle Item should be used in creating alarm point information
|
// Flag to specify if that PageStyle Item should be used in creating alarm point information
|
||||||
// for viewing in the PROMS step editor
|
// for viewing in the PROMS step editor
|
||||||
// this information is displayed in a Note that it build on the fly when first opening an Alarm Point page
|
// this information is displayed in a Note that it build on the fly when first opening an Alarm Point page
|
||||||
private LazyLoad<bool> _ROLkUpInEditor; // C2021-018 (BNPP Alarms format)
|
private LazyLoad<bool> _ROLkUpInEditor; // C2021-018 (BNPP Alarms format)
|
||||||
public bool ROLkUpInEditor
|
public bool ROLkUpInEditor => LazyLoad(ref _ROLkUpInEditor, "@ROLkUpInEditor");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return LazyLoad(ref _ROLkUpInEditor, "@ROLkUpInEditor");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// defines a maxium width before the resolved PSI token (procedure specific information) text is wrapped
|
// defines a maxium width before the resolved PSI token (procedure specific information) text is wrapped
|
||||||
// on to the next line
|
// on to the next line
|
||||||
private LazyLoad<int?> _MaxWidth;
|
private LazyLoad<int?> _MaxWidth;
|
||||||
public int? MaxWidth
|
public int? MaxWidth => LazyLoad(ref _MaxWidth, "@MaxWidth");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return (LazyLoad(ref _MaxWidth, "@MaxWidth"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// MaxWidth, above, flagged that, if there was more than 1 line, the topmargin would be adjusted by however
|
// MaxWidth, above, flagged that, if there was more than 1 line, the topmargin would be adjusted by however
|
||||||
// many lines the PSI item contained (for wst alarms). The MaxWidthCurPage is used when that adjustment
|
// many lines the PSI item contained (for wst alarms). The MaxWidthCurPage is used when that adjustment
|
||||||
// should not be made, the length of the PSI item is only relevant for the current page.
|
// should not be made, the length of the PSI item is only relevant for the current page.
|
||||||
// (see AdjustTopMarginForMultiLinePageListItems variable and how it is used)
|
// (see AdjustTopMarginForMultiLinePageListItems variable and how it is used)
|
||||||
private LazyLoad<int?> _MaxWidthCurPage;
|
private LazyLoad<int?> _MaxWidthCurPage;
|
||||||
public int? MaxWidthCurPage
|
public int? MaxWidthCurPage => LazyLoad(ref _MaxWidthCurPage, "@MaxWidthCurPage");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return (LazyLoad(ref _MaxWidthCurPage, "@MaxWidthCurPage"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// the resolved pagestype item font size will be reduce in order to fit within the defined width
|
// the resolved pagestype item font size will be reduce in order to fit within the defined width
|
||||||
private LazyLoad<int?> _FontShrinkAftLen; // F2021-066 & 070 (text len before shrinking font)
|
private LazyLoad<int?> _FontShrinkAftLen; // F2021-066 & 070 (text len before shrinking font)
|
||||||
public int? FontShrinkAftLen
|
public int? FontShrinkAftLen => LazyLoad(ref _FontShrinkAftLen, "@FontShrinkAftLen");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return (LazyLoad(ref _FontShrinkAftLen, "@FontShrinkAftLen"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// used in Alarm Point Table page style values with FontShrinkAftLen set, will display this message if the text cannot be shrunk enough (and be readable) to fit within the defined width
|
// used in Alarm Point Table page style values with FontShrinkAftLen set, will display this message if the text cannot be shrunk enough (and be readable) to fit within the defined width
|
||||||
private LazyLoad<string> _FontTooSmallMsg; // F2021-066 message if can't shrink enough
|
private LazyLoad<string> _FontTooSmallMsg; // F2021-066 message if can't shrink enough
|
||||||
public string FontTooSmallMsg
|
public string FontTooSmallMsg => LazyLoad(ref _FontTooSmallMsg, "@FontTooSmallMsg");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return LazyLoad(ref _FontTooSmallMsg, "@FontTooSmallMsg");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// F2023-039 allow to select text color of a pagelist line
|
// F2023-039 allow to select text color of a pagelist line
|
||||||
// sets a text color for the page style Item
|
// sets a text color for the page style Item
|
||||||
private LazyLoad<string> _TextColor;
|
private LazyLoad<string> _TextColor;
|
||||||
public string TextColor
|
public string TextColor => LazyLoad(ref _TextColor, "@TextColor");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return LazyLoad(ref _TextColor, "@TextColor");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// set to a string, will remove the matching string from the end
|
// set to a string, will remove the matching string from the end
|
||||||
// F2023-112 Vogtle Units 3 & Backgrounds - trim the ending "-B" from the procedure number (used in title box of page header)
|
// F2023-112 Vogtle Units 3 & Backgrounds - trim the ending "-B" from the procedure number (used in title box of page header)
|
||||||
private LazyLoad<string> _TrimEnding;
|
private LazyLoad<string> _TrimEnding;
|
||||||
public string TrimEnding
|
public string TrimEnding => LazyLoad(ref _TrimEnding, "@TrimEnding");
|
||||||
{
|
// C2025-033 to specify to print pagestyle item for a specific Child procedure
|
||||||
get
|
private LazyLoad<int?> _ChildNum;
|
||||||
{
|
public int? ChildNum => LazyLoad(ref _ChildNum, "@ChildNum");
|
||||||
return LazyLoad(ref _TrimEnding, "@TrimEnding");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// C2025-033 to specify to print pagestyle item for a specific Child procedure
|
|
||||||
private LazyLoad<int?> _ChildNum;
|
|
||||||
public int? ChildNum
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return (LazyLoad(ref _ChildNum, "@ChildNum"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
#region Override ToString
|
#region Override ToString
|
||||||
public override string ToString()
|
public override string ToString() => Token;
|
||||||
{
|
public override string GetPDDisplayName() => string.Format("({0},{1})", Row, Col);
|
||||||
//return string.Format("({0:D5},{1:D5}) - {2}",Row,Col,Token);
|
#endregion
|
||||||
return Token;
|
}
|
||||||
}
|
|
||||||
public override string GetPDDisplayName()
|
|
||||||
{ return string.Format("({0},{1})",Row,Col); }
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
#region RelatedItem
|
#region RelatedItem
|
||||||
// RelatedItem was added to allow a PSI logical to have an associated PSI item, and if both are
|
// RelatedItem was added to allow a PSI logical to have an associated PSI item, and if both are
|
||||||
@@ -281,53 +156,29 @@ namespace VEPROMS.CSLA.Library
|
|||||||
|
|
||||||
// the name of the PSI logical token to check
|
// the name of the PSI logical token to check
|
||||||
private LazyLoad<string> _Token;
|
private LazyLoad<string> _Token;
|
||||||
[Category("RelatedContent")]
|
[Category("RelatedContent")]
|
||||||
[DisplayName("RelatedContent")]
|
[DisplayName("RelatedContent")]
|
||||||
[Description("Item RelatedContent")]
|
[Description("Item RelatedContent")]
|
||||||
public string Token
|
public string Token => LazyLoad(ref _Token, "@Token");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return LazyLoad(ref _Token, "@Token");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// new Row value to use for PageStyle Item
|
// new Row value to use for PageStyle Item
|
||||||
private LazyLoad<float?> _Row;
|
private LazyLoad<float?> _Row;
|
||||||
[Category("Location")]
|
[Category("Location")]
|
||||||
[DisplayName("Vertical Position")]
|
[DisplayName("Vertical Position")]
|
||||||
[Description("Vertical Position")]
|
[Description("Vertical Position")]
|
||||||
public float? Row
|
public float? Row => LazyLoad(ref _Row, "@Row");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return LazyLoad(ref _Row, "@Row");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// new Col value to use for PageStyle Item
|
// new Col value to use for PageStyle Item
|
||||||
private LazyLoad<float?> _Col;
|
private LazyLoad<float?> _Col;
|
||||||
[Category("Location")]
|
[Category("Location")]
|
||||||
[DisplayName("Horizontal Position")]
|
[DisplayName("Horizontal Position")]
|
||||||
[Description("Horizontal Position")]
|
[Description("Horizontal Position")]
|
||||||
public float? Col
|
public float? Col => LazyLoad(ref _Col, "@Col");
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return LazyLoad(ref _Col, "@Col");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// new Justify value to use for PageStyle Item
|
// new Justify value to use for PageStyle Item
|
||||||
private LazyLoad<E_Justify?> _Justify;
|
private LazyLoad<E_Justify?> _Justify;
|
||||||
public E_Justify? Justify
|
public E_Justify? Justify => LazyLoad<E_Justify>(ref _Justify, "@Justify");
|
||||||
{
|
#endregion
|
||||||
get
|
}
|
||||||
{
|
|
||||||
return LazyLoad<E_Justify>(ref _Justify, "@Justify");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -12,47 +12,14 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private static XmlElement mydocele;
|
private static XmlElement mydocele;
|
||||||
public vlnFormatDocument(IFormatOrFormatInfo myFormat)
|
public vlnFormatDocument(IFormatOrFormatInfo myFormat)
|
||||||
{
|
{
|
||||||
_MyFormat = myFormat;
|
MyFormat = myFormat;
|
||||||
LoadXml(MyFormat.Data);
|
LoadXml(MyFormat.Data);
|
||||||
mydocele = this.DocumentElement;
|
mydocele = DocumentElement;
|
||||||
}
|
}
|
||||||
private IFormatOrFormatInfo _MyFormat;
|
|
||||||
public IFormatOrFormatInfo MyFormat
|
public IFormatOrFormatInfo MyFormat { get; set; }
|
||||||
|
public static XmlNode LookupSingleNode(XmlNode xmlNode, string path)
|
||||||
{
|
{
|
||||||
get { return _MyFormat; }
|
|
||||||
set { _MyFormat = value; }
|
|
||||||
}
|
|
||||||
public static XmlNode LookupSingleNode(XmlNode xmlNode, string path)
|
|
||||||
{
|
|
||||||
//original:
|
|
||||||
//if (xmlNode == null) return null;
|
|
||||||
//XmlNode xn = xmlNode.SelectSingleNode(path);
|
|
||||||
//if (xn != null) return xn;
|
|
||||||
//if (xmlNode.Name == "Step") xn = LookupSingleStepNode(xmlNode, path);
|
|
||||||
//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;
|
|
||||||
if (xmlNode != null)
|
|
||||||
{
|
|
||||||
xn = xmlNode.SelectSingleNode(path);
|
|
||||||
// RHM 2008-12-15 - Added logic to keep looking if a blank attribute is found
|
|
||||||
if (xn != null && xn is XmlAttribute && (xn as XmlAttribute).Value != "") return xn;
|
|
||||||
//if (xn != null) return xn;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
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;
|
if (xmlNode == null) return null;
|
||||||
XmlNode xn = xmlNode.SelectSingleNode(path);
|
XmlNode xn = xmlNode.SelectSingleNode(path);
|
||||||
if (xmlNode.Name == "Box") return xn; // if box, don't do inheritance.
|
if (xmlNode.Name == "Box") return xn; // if box, don't do inheritance.
|
||||||
@@ -72,7 +39,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (xn != null) return xn;
|
if (xn != null) return xn;
|
||||||
if (path.StartsWith("Font")) return LookupSingleFontNode(xmlNode, path); // Then do Font Inheritance
|
if (path.StartsWith("Font")) return LookupSingleFontNode(xmlNode, path); // Then do Font Inheritance
|
||||||
return InheritLookup(xmlNode, path, false);
|
return InheritLookup(xmlNode, path, false);
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
public static XmlNode LookupSingleFontNode(XmlNode xmlNode, string path)
|
public static XmlNode LookupSingleFontNode(XmlNode xmlNode, string path)
|
||||||
{
|
{
|
||||||
@@ -108,29 +74,15 @@ namespace VEPROMS.CSLA.Library
|
|||||||
|
|
||||||
if (xmlNode == null) return null;
|
if (xmlNode == null) return null;
|
||||||
XmlNode xn = xmlNode.SelectSingleNode(path);
|
XmlNode xn = xmlNode.SelectSingleNode(path);
|
||||||
XmlNode tmpNode = xmlNode;
|
XmlNode tmpNode2 = xmlNode;
|
||||||
XmlNode tmpNode2 = xmlNode;
|
|
||||||
while (xn == null) //Walk-up the format tree to find a step node
|
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);
|
//if (path.Contains("Font")) Console.WriteLine("vlnFormatDocument.LookupSingleStepNode -> Loop {0},{1}", xmlNode.Name == "Step" ? "Step." + xmlNode.Attributes["Type"].Value : xmlNode.Name, path);
|
||||||
tmpNode = xmlNode;
|
// RHM 20090831 Try doing a lookup of the parent. If no parent, go back to the original and do an inheritance lookup
|
||||||
// RHM 20090831 Try doing a lookup of the parent. If no parent, go back to the original and do an inheritance lookup
|
XmlAttribute attr = xmlNode.Attributes["ParentType"];
|
||||||
XmlAttribute attr = xmlNode.Attributes["ParentType"];
|
|
||||||
if (attr == null || attr.Value == string.Empty) // Cannot find ParentType so do an InheritanceLookup
|
if (attr == null || attr.Value == string.Empty) // Cannot find ParentType so do an InheritanceLookup
|
||||||
return InheritLookup(tmpNode2, path, true);
|
return InheritLookup(tmpNode2, path, true);
|
||||||
//return InheritLookup(xmlNode, path, false);
|
|
||||||
xmlNode = xmlNode.ParentNode.SelectSingleNode(string.Format("Step[@Type='{0}']", xmlNode.Attributes["ParentType"].InnerText));
|
xmlNode = xmlNode.ParentNode.SelectSingleNode(string.Format("Step[@Type='{0}']", xmlNode.Attributes["ParentType"].InnerText));
|
||||||
// Based upon our current data - the following conditions are never met.
|
|
||||||
//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);
|
xn = xmlNode.SelectSingleNode(path);
|
||||||
}
|
}
|
||||||
return xn;
|
return xn;
|
||||||
@@ -145,38 +97,20 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static string Lookup(XmlNode xmlNode, string path)
|
public static string Lookup(XmlNode xmlNode, string path)
|
||||||
{
|
{
|
||||||
//if (xmlNode == null) return null;
|
|
||||||
XmlNode xn = LookupSingleNode(xmlNode, path);
|
XmlNode xn = LookupSingleNode(xmlNode, path);
|
||||||
//if (xn == null) xn = InheritLookup(xmlNode, path);
|
return xn?.InnerText;
|
||||||
if (xn == null) return null;
|
}
|
||||||
return xn.InnerText;
|
public static T EnumLookup<T>(XmlNode xmlNode, string path)
|
||||||
}
|
|
||||||
//public static string StepLookup(XmlNode xmlNode, string path)
|
|
||||||
//{
|
|
||||||
// //if (xmlNode == null) return null;
|
|
||||||
// XmlNode xn = LookupSingleStepNode(xmlNode, path);
|
|
||||||
// //if (xn == null) xn = InheritLookup(xmlNode, path);
|
|
||||||
// if (xn == null) return null;
|
|
||||||
// return xn.InnerText;
|
|
||||||
//}
|
|
||||||
public static T EnumLookup<T>(XmlNode xmlNode, string path)
|
|
||||||
{
|
{
|
||||||
string str = Lookup(xmlNode,path);
|
string str = Lookup(xmlNode,path);
|
||||||
if (str == null) return default(T);
|
return str == null ? default : (T)Enum.Parse(typeof(T), str);
|
||||||
return (T)Enum.Parse(typeof(T), str);
|
}
|
||||||
}
|
public static int? IntLookup(XmlNode xmlNode, string path)
|
||||||
public static int? IntLookup(XmlNode xmlNode, string path)
|
|
||||||
{
|
{
|
||||||
//if (xmlNode == null) return null;
|
|
||||||
//XmlNode xn = LookupSingleNode(xmlNode, path);
|
|
||||||
//if (xn == null) xn = InheritLookup(xmlNode, path);
|
|
||||||
//if (xn == null) return null;
|
|
||||||
//return int.Parse(xn.InnerText);
|
|
||||||
string str = Lookup(xmlNode, path);
|
string str = Lookup(xmlNode, path);
|
||||||
if (str == null) return null;
|
return str == null ? null : (int?)int.Parse(str);
|
||||||
return int.Parse(str);
|
}
|
||||||
}
|
public static int SiblingCount(XmlNode xmlNode)
|
||||||
public static int SiblingCount(XmlNode xmlNode)
|
|
||||||
{
|
{
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
string nodeName = xmlNode.Name;
|
string nodeName = xmlNode.Name;
|
||||||
@@ -189,7 +123,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
public static string Path(XmlNode xmlNode)
|
public static string Path(XmlNode xmlNode)
|
||||||
{
|
{
|
||||||
// Walk the path
|
// Walk the path
|
||||||
string parentPath = (xmlNode.ParentNode == xmlNode.OwnerDocument ? "" : Path(xmlNode.ParentNode));
|
string parentPath = xmlNode.ParentNode == xmlNode.OwnerDocument ? "" : Path(xmlNode.ParentNode);
|
||||||
// Count Siblings with the Same Name
|
// Count Siblings with the Same Name
|
||||||
int sibCount = SiblingCount(xmlNode);
|
int sibCount = SiblingCount(xmlNode);
|
||||||
return string.Format("{0}/{1}[{2}]", parentPath, xmlNode.Name, sibCount);
|
return string.Format("{0}/{1}[{2}]", parentPath, xmlNode.Name, sibCount);
|
||||||
@@ -204,7 +138,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
string TransIndex = xmlNode.Attributes["Index"].Value;
|
string TransIndex = xmlNode.Attributes["Index"].Value;
|
||||||
xPath = System.Text.RegularExpressions.Regex.Replace(xPath, @"\[[0-9]*\]$", @"[@Index='" + TransIndex + @"']");
|
xPath = System.Text.RegularExpressions.Regex.Replace(xPath, @"\[[0-9]*\]$", @"[@Index='" + TransIndex + @"']");
|
||||||
}
|
}
|
||||||
vlnFormatDocument fd = (vlnFormatDocument)(xmlNode.OwnerDocument);//First Get the vlnFormatDocument - This also ties it to a FormatInfo object
|
vlnFormatDocument fd = (vlnFormatDocument)xmlNode.OwnerDocument;//First Get the vlnFormatDocument - This also ties it to a FormatInfo object
|
||||||
while(fd.MyFormat.MyIParent != null)
|
while(fd.MyFormat.MyIParent != null)
|
||||||
{
|
{
|
||||||
fd = fd.MyFormat.MyIParent.PlantFormat.XmlDoc;// Get the parents vlnFormatDocument
|
fd = fd.MyFormat.MyIParent.PlantFormat.XmlDoc;// Get the parents vlnFormatDocument
|
||||||
@@ -215,8 +149,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
else xp = fd.SelectSingleNode(xPath);// Get the related node
|
else xp = fd.SelectSingleNode(xPath);// Get the related node
|
||||||
if (xp != null)
|
if (xp != null)
|
||||||
{
|
{
|
||||||
XmlNode xn = null;
|
XmlNode xn;
|
||||||
if (stepLookup)
|
if (stepLookup)
|
||||||
{
|
{
|
||||||
//if (path.Contains("Font")) Console.WriteLine("vlnFormatItem.SelectSingleNode {0},{1}", xp.Name == "Step" ? "Step." + xp.Attributes["Type"].Value : xp.Name, path);
|
//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);
|
xn = LookupSingleStepNode(xp, path);
|
||||||
@@ -233,7 +167,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
if (xmlNode == null) return null;// No path to match
|
if (xmlNode == null) return null;// No path to match
|
||||||
string xPath = Path(xmlNode);// Build xPath from xmlNode
|
string xPath = Path(xmlNode);// Build xPath from xmlNode
|
||||||
vlnFormatDocument fd = (vlnFormatDocument)(xmlNode.OwnerDocument);//First Get the vlnFormatDocument - This also ties it to a FormatInfo object
|
vlnFormatDocument fd = (vlnFormatDocument)xmlNode.OwnerDocument;//First Get the vlnFormatDocument - This also ties it to a FormatInfo object
|
||||||
while (fd.MyFormat.MyIParent != null)
|
while (fd.MyFormat.MyIParent != null)
|
||||||
{
|
{
|
||||||
fd = fd.MyFormat.MyIParent.PlantFormat.XmlDoc;// Get the parents vlnFormatDocument
|
fd = fd.MyFormat.MyIParent.PlantFormat.XmlDoc;// Get the parents vlnFormatDocument
|
||||||
@@ -256,100 +190,41 @@ namespace VEPROMS.CSLA.Library
|
|||||||
[TypeConverter(typeof(ExpandableObjectConverter))]
|
[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||||
public class vlnFormatItem
|
public class vlnFormatItem
|
||||||
{
|
{
|
||||||
public vlnFormatItem(XmlNode xmlNode)
|
public vlnFormatItem(XmlNode xmlNode) => XmlNode = xmlNode;
|
||||||
{
|
public vlnFormatItem() { }
|
||||||
_XmlNode = xmlNode;
|
|
||||||
}
|
internal XmlNode XmlNode { get; set; }
|
||||||
public vlnFormatItem() { }
|
private IFormatOrFormatInfo _MyFormat;
|
||||||
XmlNode _XmlNode;
|
|
||||||
internal XmlNode XmlNode
|
|
||||||
{
|
|
||||||
get { return _XmlNode; }
|
|
||||||
set { _XmlNode = value; }
|
|
||||||
}
|
|
||||||
private IFormatOrFormatInfo _MyFormat;
|
|
||||||
public IFormatOrFormatInfo MyFormat
|
public IFormatOrFormatInfo MyFormat
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_MyFormat == null)
|
if (_MyFormat == null)
|
||||||
{
|
{
|
||||||
vlnFormatDocument doc = (XmlNode.OwnerDocument) as vlnFormatDocument;
|
if (XmlNode.OwnerDocument is vlnFormatDocument doc)
|
||||||
if(doc != null)
|
_MyFormat = doc.MyFormat;
|
||||||
_MyFormat = doc.MyFormat;
|
}
|
||||||
}
|
|
||||||
return _MyFormat;
|
return _MyFormat;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private IFormatOrFormatInfo _MyParentFormat;
|
public IFormatOrFormatInfo MyParentFormat => MyFormat.MyIParent;
|
||||||
public IFormatOrFormatInfo MyParentFormat
|
public virtual string GetPDDisplayName() => ToString();
|
||||||
|
public virtual string GetPDName() => ToString();
|
||||||
|
public virtual string GetPDDescription() => ToString();
|
||||||
|
public virtual string GetPDCategory() => ToString();
|
||||||
|
public XmlNodeList SelectNodes(string path) => vlnFormatDocument.LookupNodes(XmlNode, path);
|
||||||
|
public XmlNode SelectSingleNode(string path)
|
||||||
{
|
{
|
||||||
get
|
|
||||||
{
|
|
||||||
return MyFormat.MyIParent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public virtual string GetPDDisplayName()
|
|
||||||
{ return ToString(); }
|
|
||||||
public virtual string GetPDName()
|
|
||||||
{ return ToString(); }
|
|
||||||
public virtual string GetPDDescription()
|
|
||||||
{ return ToString(); }
|
|
||||||
public virtual string GetPDCategory()
|
|
||||||
{ return ToString(); }
|
|
||||||
public XmlNodeList SelectNodes(string path)
|
|
||||||
{
|
|
||||||
return vlnFormatDocument.LookupNodes(_XmlNode, path);
|
|
||||||
}
|
|
||||||
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);
|
//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);
|
return vlnFormatDocument.LookupSingleNode(XmlNode, path);
|
||||||
}
|
}
|
||||||
//public static string _LookUpNode;
|
public XmlNode SelectSingleFontNode(string path) => vlnFormatDocument.LookupSingleFontNode(XmlNode, path);
|
||||||
//private static void AdjustLookup(XmlNode xmlNode,string path)
|
public string Lookup(string path) => vlnFormatDocument.Lookup(XmlNode, path);
|
||||||
//{
|
public string Lookup(string path, ref string local) => local ?? (local = Lookup(path));
|
||||||
// if (xmlNode.Name == "Step")
|
public int? IntLookup(string path) => vlnFormatDocument.IntLookup(XmlNode, path);
|
||||||
// {
|
public int? IntLookup(string path, ref int? local) => local != null ? local : local = IntLookup(path);
|
||||||
// XmlAttribute attr = xmlNode.Attributes["Type"];
|
public T EnumLookup<T>(string path) => vlnFormatDocument.EnumLookup<T>(XmlNode, path);
|
||||||
// if (attr != null) _LookUpNode = attr.Value;
|
public bool LazyLoad(ref LazyLoad<bool> ll, string xPath)
|
||||||
// //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);
|
|
||||||
}
|
|
||||||
public string Lookup(string path)
|
|
||||||
{
|
|
||||||
return vlnFormatDocument.Lookup(_XmlNode, path);
|
|
||||||
}
|
|
||||||
public string Lookup(string path, ref string local)
|
|
||||||
{
|
|
||||||
return (local != null? local : local = Lookup(path));
|
|
||||||
}
|
|
||||||
//public string StepLookup(string path)
|
|
||||||
//{
|
|
||||||
// return vlnFormatDocument.StepLookup(_XmlNode, path);
|
|
||||||
//}
|
|
||||||
public int? IntLookup(string path)
|
|
||||||
{
|
|
||||||
return vlnFormatDocument.IntLookup(_XmlNode, path);
|
|
||||||
}
|
|
||||||
public int? IntLookup(string path, ref int? local)
|
|
||||||
{
|
|
||||||
return (local != null ? local : local = IntLookup(path));
|
|
||||||
}
|
|
||||||
public T EnumLookup<T>(string path)
|
|
||||||
{
|
|
||||||
return vlnFormatDocument.EnumLookup<T>(_XmlNode, path);
|
|
||||||
}
|
|
||||||
public bool LazyLoad(ref LazyLoad<bool> ll, string xPath)
|
|
||||||
{
|
{
|
||||||
if (ll == null)
|
if (ll == null)
|
||||||
{
|
{
|
||||||
@@ -358,12 +233,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
return ll.Value;
|
return ll.Value;
|
||||||
}
|
}
|
||||||
protected static bool RetrieveBool(XmlNode xn)
|
protected static bool RetrieveBool(XmlNode xn) => xn != null && xn.InnerText.ToUpper() == "TRUE";
|
||||||
{
|
// a LazyLoad that allows you to pass in the default setting
|
||||||
return xn != null && xn.InnerText.ToUpper() == "TRUE";
|
public bool LazyLoad(ref LazyLoad<bool> ll, string xPath, bool defaultReturn)
|
||||||
}
|
|
||||||
// a LaxyLoad that allows you to pass in the default setting
|
|
||||||
public bool LazyLoad(ref LazyLoad<bool> ll, string xPath, bool defaultReturn)
|
|
||||||
{
|
{
|
||||||
if (ll == null)
|
if (ll == null)
|
||||||
{
|
{
|
||||||
@@ -372,12 +244,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
return ll.Value;
|
return ll.Value;
|
||||||
}
|
}
|
||||||
// if nothing is set for this node, then use the passed in default value
|
// if nothing is set for this node, then use the passed in default value
|
||||||
protected static bool RetrieveBool(XmlNode xn, bool defaultReturn)
|
protected static bool RetrieveBool(XmlNode xn, bool defaultReturn) => (xn != null) ? xn.InnerText.ToUpper() == "TRUE" : defaultReturn;
|
||||||
{
|
public string LazyLoad(ref LazyLoad<string> ll, string xPath)
|
||||||
return (xn != null) ? xn.InnerText.ToUpper() == "TRUE" : defaultReturn;
|
|
||||||
}
|
|
||||||
public string LazyLoad(ref LazyLoad<string> ll, string xPath)
|
|
||||||
{
|
{
|
||||||
if (ll == null)
|
if (ll == null)
|
||||||
{
|
{
|
||||||
@@ -386,16 +255,13 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
return ll.Value;
|
return ll.Value;
|
||||||
}
|
}
|
||||||
protected static string RetrieveString(XmlNode xn)
|
protected static string RetrieveString(XmlNode xn) => xn?.InnerText;
|
||||||
{
|
public string MyPath
|
||||||
return xn != null ? xn.InnerText : null;
|
|
||||||
}
|
|
||||||
public string MyPath
|
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
XmlNode node = _XmlNode;
|
XmlNode node = XmlNode;
|
||||||
string prefix = "";
|
string prefix = "";
|
||||||
while (node != null)
|
while (node != null)
|
||||||
{
|
{
|
||||||
@@ -429,14 +295,13 @@ namespace VEPROMS.CSLA.Library
|
|||||||
int? value = null;
|
int? value = null;
|
||||||
if (xn != null)
|
if (xn != null)
|
||||||
{
|
{
|
||||||
int iValue = 0;
|
if (!int.TryParse(xn.InnerText, out int iValue))
|
||||||
if (!int.TryParse(xn.InnerText, out iValue))
|
{
|
||||||
{
|
if (xn.InnerText == "") return null;
|
||||||
if (xn.InnerText == "") return null;
|
Console.WriteLine(string.Format("'{0}'\r\n'{1}'\r\n'{2}' could not be converted to int?", MyFormat.FullName, MyPath + "/" + xPath, xn.InnerText));
|
||||||
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));
|
||||||
throw (new Exception(string.Format("{0} = '{1}' could not be converted to int?", xPath, xn.InnerText)));
|
}
|
||||||
}
|
value = iValue;
|
||||||
value = iValue;
|
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@@ -445,13 +310,12 @@ namespace VEPROMS.CSLA.Library
|
|||||||
float? value = null;
|
float? value = null;
|
||||||
if (xn != null)
|
if (xn != null)
|
||||||
{
|
{
|
||||||
float fValue = 0;
|
if (!float.TryParse(xn.InnerText, out float fValue))
|
||||||
if (!float.TryParse(xn.InnerText, out fValue))
|
{
|
||||||
{
|
Console.WriteLine(string.Format("'{0}'\r\n'{1}'\r\n'{2}' could not be converted to float?", MyFormat.FullName, MyPath + "/" + xPath, xn.InnerText));
|
||||||
Console.WriteLine(string.Format("'{0}'\r\n'{1}'\r\n'{2}' could not be converted to float?", MyFormat.FullName, MyPath + "/" + xPath, xn.InnerText));
|
throw new Exception(string.Format("{0} = '{1}' could not be converted to float?", xPath, xn.InnerText));
|
||||||
throw (new Exception(string.Format("{0} = '{1}' could not be converted to float?", xPath, xn.InnerText)));
|
}
|
||||||
}
|
value = fValue;
|
||||||
value = fValue;
|
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@@ -460,9 +324,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
if (ll == null)
|
if (ll == null)
|
||||||
{
|
{
|
||||||
XmlNode xn = this._XmlNode;
|
XmlNode xn = SelectSingleNode(xPath);
|
||||||
xn = SelectSingleNode(xPath);
|
if (xn == null)
|
||||||
if (xn == null)
|
|
||||||
ll = new LazyLoad<T?>(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
|
else if (xn.Value == "")// No value specified - Use zero value if it is defined - GetName returns a null if it is not defined
|
||||||
ll = new LazyLoad<Nullable<T>>(Enum.GetName(typeof(T), 0) != null ? (Nullable<T>) Enum.Parse(typeof(T), "0") : null);
|
ll = new LazyLoad<Nullable<T>>(Enum.GetName(typeof(T), 0) != null ? (Nullable<T>) Enum.Parse(typeof(T), "0") : null);
|
||||||
@@ -497,17 +360,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region LazyLoad
|
#region LazyLoad
|
||||||
public class LazyLoad<T>
|
public class LazyLoad<T>
|
||||||
{
|
{
|
||||||
public LazyLoad(T value)
|
public LazyLoad(T value) => Value = value;
|
||||||
{
|
|
||||||
_Value = value;
|
public T Value { get; set; }
|
||||||
}
|
}
|
||||||
private T _Value;
|
|
||||||
public T Value
|
|
||||||
{
|
|
||||||
get { return _Value; }
|
|
||||||
set { _Value = value; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
#region vlnFormatList, new()
|
#region vlnFormatList, new()
|
||||||
public class vlnFormatList<T> : List<T>, ICustomTypeDescriptor
|
public class vlnFormatList<T> : List<T>, ICustomTypeDescriptor
|
||||||
@@ -522,9 +378,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
_XmlNodeList = value;
|
_XmlNodeList = value;
|
||||||
foreach (XmlNode xn in _XmlNodeList)
|
foreach (XmlNode xn in _XmlNodeList)
|
||||||
{
|
{
|
||||||
T tt = new T();
|
T tt = new T
|
||||||
tt.XmlNode = xn;
|
{
|
||||||
Add(tt);
|
XmlNode = xn
|
||||||
|
};
|
||||||
|
Add(tt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -546,7 +404,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
XmlNode node = _XmlNodeList[0]; // Get the first node in a list
|
XmlNode node = _XmlNodeList[0]; // Get the first node in a list
|
||||||
vlnFormatDocument doc = null;
|
vlnFormatDocument doc = null;
|
||||||
if (node != null)
|
if (node != null)
|
||||||
doc = (node.OwnerDocument) as vlnFormatDocument; // Get the owner document as a vlnFormatDocument
|
doc = node.OwnerDocument as vlnFormatDocument; // Get the owner document as a vlnFormatDocument
|
||||||
if (doc != null)
|
if (doc != null)
|
||||||
_MyFormat = doc.MyFormat; // Get the Format associated with the vlnFormatDocument
|
_MyFormat = doc.MyFormat; // Get the Format associated with the vlnFormatDocument
|
||||||
}
|
}
|
||||||
@@ -557,36 +415,24 @@ namespace VEPROMS.CSLA.Library
|
|||||||
_MyFormat = value;
|
_MyFormat = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#region ICustomTypeDescriptor
|
#region ICustomTypeDescriptor
|
||||||
public String GetClassName()
|
public string GetClassName() => TypeDescriptor.GetClassName(this, true);
|
||||||
{ return TypeDescriptor.GetClassName(this, true); }
|
public AttributeCollection GetAttributes() => TypeDescriptor.GetAttributes(this, true);
|
||||||
public AttributeCollection GetAttributes()
|
public string GetComponentName() => TypeDescriptor.GetComponentName(this, true);
|
||||||
{ return TypeDescriptor.GetAttributes(this, true); }
|
public TypeConverter GetConverter() => TypeDescriptor.GetConverter(this, true);
|
||||||
public String GetComponentName()
|
public EventDescriptor GetDefaultEvent() => TypeDescriptor.GetDefaultEvent(this, true);
|
||||||
{ return TypeDescriptor.GetComponentName(this, true); }
|
public PropertyDescriptor GetDefaultProperty() => TypeDescriptor.GetDefaultProperty(this, true);
|
||||||
public TypeConverter GetConverter()
|
public object GetEditor(Type editorBaseType) => TypeDescriptor.GetEditor(this, editorBaseType, true);
|
||||||
{ return TypeDescriptor.GetConverter(this, true); }
|
public EventDescriptorCollection GetEvents(Attribute[] attributes) => TypeDescriptor.GetEvents(this, attributes, true);
|
||||||
public EventDescriptor GetDefaultEvent()
|
public EventDescriptorCollection GetEvents() => TypeDescriptor.GetEvents(this, true);
|
||||||
{ return TypeDescriptor.GetDefaultEvent(this, true); }
|
public object GetPropertyOwner(PropertyDescriptor pd) => this;
|
||||||
public PropertyDescriptor GetDefaultProperty()
|
public PropertyDescriptorCollection GetProperties(Attribute[] attributes) => GetProperties();
|
||||||
{ return TypeDescriptor.GetDefaultProperty(this, true); }
|
public virtual PropertyDescriptorCollection GetProperties()
|
||||||
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
|
// Create a collection object to hold property descriptors
|
||||||
PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null);
|
PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null);
|
||||||
// Iterate the list
|
// Iterate the list
|
||||||
int i = 0;
|
for (int i = 0; i < Count; i++)
|
||||||
for (i = 0; i < this.Count; i++)
|
|
||||||
{
|
{
|
||||||
// Create a property descriptor for the item and add to the property descriptor collection
|
// Create a property descriptor for the item and add to the property descriptor collection
|
||||||
pds.Add(new vlnPropertyDescriptor<vlnFormatList<T>, T>(this, i));
|
pds.Add(new vlnPropertyDescriptor<vlnFormatList<T>, T>(this, i));
|
||||||
@@ -601,13 +447,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
public class vlnIndexedFormatList<T> : vlnFormatList<T>, ICustomTypeDescriptor
|
public class vlnIndexedFormatList<T> : vlnFormatList<T>, ICustomTypeDescriptor
|
||||||
where T : vlnFormatItem,IVlnIndexedFormatItem, new()
|
where T : vlnFormatItem,IVlnIndexedFormatItem, new()
|
||||||
{
|
{
|
||||||
public vlnIndexedFormatList(XmlNodeList xmlNodeList,IFormatOrFormatInfo myFormat) : base(xmlNodeList)
|
public vlnIndexedFormatList(XmlNodeList xmlNodeList, IFormatOrFormatInfo myFormat) : base(xmlNodeList) => MyFormat = myFormat;
|
||||||
{
|
public vlnIndexedFormatList() : base() { }
|
||||||
MyFormat = myFormat;
|
public virtual vlnIndexedFormatList<T> InheritedList => null;
|
||||||
}
|
public new T this[int index]
|
||||||
public vlnIndexedFormatList() : base() { }
|
|
||||||
public virtual vlnIndexedFormatList<T> InheritedList { get { return null; } }
|
|
||||||
public new T this[int index]
|
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@@ -620,8 +463,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (ttlParent != null)
|
if (ttlParent != null)
|
||||||
return ttlParent[index];
|
return ttlParent[index];
|
||||||
return null;
|
return null;
|
||||||
// None found - Can I find it in another format?
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public int MaxIndex
|
public int MaxIndex
|
||||||
@@ -657,36 +498,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#region ICustomTypeDescriptor
|
#region ICustomTypeDescriptor
|
||||||
public String GetClassName()
|
public new string GetClassName() => TypeDescriptor.GetClassName(this, true);
|
||||||
{ return TypeDescriptor.GetClassName(this, true); }
|
public new AttributeCollection GetAttributes() => TypeDescriptor.GetAttributes(this, true);
|
||||||
public AttributeCollection GetAttributes()
|
public new string GetComponentName() => TypeDescriptor.GetComponentName(this, true);
|
||||||
{ return TypeDescriptor.GetAttributes(this, true); }
|
public new TypeConverter GetConverter() => TypeDescriptor.GetConverter(this, true);
|
||||||
public String GetComponentName()
|
public new EventDescriptor GetDefaultEvent() => TypeDescriptor.GetDefaultEvent(this, true);
|
||||||
{ return TypeDescriptor.GetComponentName(this, true); }
|
public new PropertyDescriptor GetDefaultProperty() => TypeDescriptor.GetDefaultProperty(this, true);
|
||||||
public TypeConverter GetConverter()
|
public new object GetEditor(Type editorBaseType) => TypeDescriptor.GetEditor(this, editorBaseType, true);
|
||||||
{ return TypeDescriptor.GetConverter(this, true); }
|
public new EventDescriptorCollection GetEvents(Attribute[] attributes)
|
||||||
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); }
|
{ return TypeDescriptor.GetEvents(this, attributes, true); }
|
||||||
public EventDescriptorCollection GetEvents()
|
public new EventDescriptorCollection GetEvents() => TypeDescriptor.GetEvents(this, true);
|
||||||
{ return TypeDescriptor.GetEvents(this, true); }
|
public new object GetPropertyOwner(PropertyDescriptor pd) => this;
|
||||||
public object GetPropertyOwner(PropertyDescriptor pd)
|
public new PropertyDescriptorCollection GetProperties(Attribute[] attributes) => GetProperties();
|
||||||
{ return this; }
|
public new virtual PropertyDescriptorCollection GetProperties()
|
||||||
public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
|
|
||||||
{ return GetProperties(); }
|
|
||||||
public virtual PropertyDescriptorCollection GetProperties()
|
|
||||||
{
|
{
|
||||||
// Create a collection object to hold property descriptors
|
// Create a collection object to hold property descriptors
|
||||||
PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null);
|
PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null);
|
||||||
// Iterate the list
|
// Iterate the list
|
||||||
int i = 0;
|
for (int i = 0; i < Count; i++)
|
||||||
for (i = 0; i < this.Count; i++)
|
|
||||||
{
|
{
|
||||||
// Create a property descriptor for the item and add to the property descriptor collection
|
// Create a property descriptor for the item and add to the property descriptor collection
|
||||||
pds.Add(new vlnPropertyDescriptor<vlnFormatList<T>, T>(this, i));
|
pds.Add(new vlnPropertyDescriptor<vlnFormatList<T>, T>(this, i));
|
||||||
@@ -701,14 +531,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
public class vlnNamedFormatList<T> : vlnFormatList<T>, ICustomTypeDescriptor
|
public class vlnNamedFormatList<T> : vlnFormatList<T>, ICustomTypeDescriptor
|
||||||
where T : vlnFormatItem, IVlnNamedFormatItem, new()
|
where T : vlnFormatItem, IVlnNamedFormatItem, new()
|
||||||
{
|
{
|
||||||
public vlnNamedFormatList(XmlNodeList xmlNodeList, IFormatOrFormatInfo myFormat)
|
public vlnNamedFormatList(XmlNodeList xmlNodeList, IFormatOrFormatInfo myFormat)
|
||||||
: base(xmlNodeList)
|
: base(xmlNodeList) => MyFormat = myFormat;
|
||||||
{
|
public vlnNamedFormatList() : base() { }
|
||||||
MyFormat = myFormat;
|
public virtual vlnNamedFormatList<T> InheritedList => null;
|
||||||
}
|
public T this[string name]
|
||||||
public vlnNamedFormatList() : base() { }
|
|
||||||
public virtual vlnNamedFormatList<T> InheritedList { get { return null; } }
|
|
||||||
public new T this[string name]
|
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@@ -721,8 +548,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (ttlParent != null)
|
if (ttlParent != null)
|
||||||
return ttlParent[name];
|
return ttlParent[name];
|
||||||
return null;
|
return null;
|
||||||
// None found - Can I find it in another format?
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public new T this[int index]
|
public new T this[int index]
|
||||||
@@ -735,47 +560,27 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (ttlParent != null)
|
if (ttlParent != null)
|
||||||
return ttlParent[index];
|
return ttlParent[index];
|
||||||
return null;
|
return null;
|
||||||
// None found - Can I find it in another format?
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public new int Count
|
public new int Count => base.Count;
|
||||||
{
|
#region ICustomTypeDescriptor
|
||||||
get
|
public new string GetClassName() => TypeDescriptor.GetClassName(this, true);
|
||||||
{
|
public new AttributeCollection GetAttributes() => TypeDescriptor.GetAttributes(this, true);
|
||||||
return base.Count;
|
public new string GetComponentName() => TypeDescriptor.GetComponentName(this, true);
|
||||||
}
|
public new TypeConverter GetConverter() => TypeDescriptor.GetConverter(this, true);
|
||||||
}
|
public new EventDescriptor GetDefaultEvent() => TypeDescriptor.GetDefaultEvent(this, true);
|
||||||
#region ICustomTypeDescriptor
|
public new PropertyDescriptor GetDefaultProperty() => TypeDescriptor.GetDefaultProperty(this, true);
|
||||||
public String GetClassName()
|
public new object GetEditor(Type editorBaseType) => TypeDescriptor.GetEditor(this, editorBaseType, true);
|
||||||
{ return TypeDescriptor.GetClassName(this, true); }
|
public new EventDescriptorCollection GetEvents(Attribute[] attributes) => TypeDescriptor.GetEvents(this, attributes, true);
|
||||||
public AttributeCollection GetAttributes()
|
public new EventDescriptorCollection GetEvents() => TypeDescriptor.GetEvents(this, true);
|
||||||
{ return TypeDescriptor.GetAttributes(this, true); }
|
public new object GetPropertyOwner(PropertyDescriptor pd) => this;
|
||||||
public String GetComponentName()
|
public new PropertyDescriptorCollection GetProperties(Attribute[] attributes) => GetProperties();
|
||||||
{ return TypeDescriptor.GetComponentName(this, true); }
|
public new virtual PropertyDescriptorCollection GetProperties()
|
||||||
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
|
// Create a collection object to hold property descriptors
|
||||||
PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null);
|
PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null);
|
||||||
// Iterate the list
|
// Iterate the list
|
||||||
int i = 0;
|
for (int i = 0; i < Count; i++)
|
||||||
for (i = 0; i < this.Count; i++)
|
|
||||||
{
|
{
|
||||||
// Create a property descriptor for the item and add to the property descriptor collection
|
// Create a property descriptor for the item and add to the property descriptor collection
|
||||||
pds.Add(new vlnPropertyDescriptor<vlnFormatList<T>, T>(this, i));
|
pds.Add(new vlnPropertyDescriptor<vlnFormatList<T>, T>(this, i));
|
||||||
@@ -793,16 +598,16 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
private string Plural(string name)
|
private string Plural(string name)
|
||||||
{
|
{
|
||||||
if (name.EndsWith("y")) return name.Substring(0, name.Length - 1) + "ies";
|
if (name.EndsWith("y")) return $"{name.Substring(0, name.Length - 1)}ies";
|
||||||
if (name.EndsWith("ss")) return name + "es";
|
if (name.EndsWith("ss")) return $"{name}es";
|
||||||
else return name + "s";
|
else return $"{name}s";
|
||||||
}
|
}
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
{
|
{
|
||||||
if (destType == typeof(string) && value is T)
|
if (destType == typeof(string) && value is T vart)
|
||||||
{
|
{
|
||||||
// Return department and department role separated by comma.
|
// 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 $"{vart.Count} {(vart.Count == 1 ? typeof(C).Name : Plural(typeof(C).Name))}";
|
||||||
}
|
}
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
}
|
}
|
||||||
@@ -815,17 +620,16 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
private string Plural(string name)
|
private string Plural(string name)
|
||||||
{
|
{
|
||||||
if (name.EndsWith("y")) return name.Substring(0, name.Length - 1) + "ies";
|
if (name.EndsWith("y")) return $"{name.Substring(0, name.Length - 1)}ies";
|
||||||
if (name.EndsWith("ss")) return name + "es";
|
if (name.EndsWith("ss")) return $"{name}es";
|
||||||
if (name.EndsWith("x")) return name + "es";
|
return name.EndsWith("x") ? $"{name}es" : $"{name}s";
|
||||||
else return name + "s";
|
}
|
||||||
}
|
|
||||||
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
{
|
{
|
||||||
if (destType == typeof(string) && value is T)
|
if (destType == typeof(string) && value is T vart)
|
||||||
{
|
{
|
||||||
// Return department and department role separated by comma.
|
// Return department and department role separated by comma.
|
||||||
return ((T)value).MaxIndex.ToString() + " " + (((T)value).MaxIndex == 1 ? typeof(C).Name : Plural(typeof(C).Name));
|
return $"{vart.MaxIndex} {(vart.MaxIndex == 1 ? typeof(C).Name : Plural(typeof(C).Name))}";
|
||||||
}
|
}
|
||||||
return base.ConvertTo(context, culture, value, destType);
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
}
|
}
|
||||||
@@ -837,38 +641,23 @@ namespace VEPROMS.CSLA.Library
|
|||||||
where C : vlnFormatItem, new()
|
where C : vlnFormatItem, new()
|
||||||
{
|
{
|
||||||
protected C _Item = null;
|
protected C _Item = null;
|
||||||
public vlnPropertyDescriptor(T itemList, int index)
|
public vlnPropertyDescriptor(T itemList, int index)
|
||||||
: base("#" + index.ToString(), null)
|
: base("#" + index.ToString(), null) => _Item = itemList[index];
|
||||||
{
|
public override bool CanResetValue(object component) => true;
|
||||||
_Item = itemList[index];
|
public override Type ComponentType => _Item.GetType();
|
||||||
}
|
public override object GetValue(object component) => _Item;
|
||||||
public override bool CanResetValue(object component)
|
public override bool IsReadOnly => true;
|
||||||
{ return true; }
|
public override Type PropertyType => _Item.GetType();
|
||||||
public override Type ComponentType
|
public override void ResetValue(object component)
|
||||||
{ get { return _Item.GetType(); } }
|
|
||||||
public override object GetValue(object component)
|
|
||||||
{ return _Item; }
|
|
||||||
public override bool IsReadOnly
|
|
||||||
{ get { return true; } }
|
|
||||||
public override Type PropertyType
|
|
||||||
{ get { return _Item.GetType(); } }
|
|
||||||
public override void ResetValue(object component)
|
|
||||||
{ ;}
|
{ ;}
|
||||||
public override bool ShouldSerializeValue(object component)
|
public override bool ShouldSerializeValue(object component) => true;
|
||||||
{ return true; }
|
public override void SetValue(object component, object value)
|
||||||
public override void SetValue(object component, object value)
|
|
||||||
{ /*_Item = value*/;}
|
{ /*_Item = value*/;}
|
||||||
//public override AttributeCollection Attributes
|
public override string DisplayName => _Item.GetPDDisplayName();
|
||||||
//{ get { return new AttributeCollection(null); } }
|
public override string Description => _Item.GetPDDescription();
|
||||||
public override string DisplayName
|
public override string Name => _Item.GetPDName();
|
||||||
{ get { return _Item.GetPDDisplayName(); } }
|
public override string Category => _Item.GetPDCategory();
|
||||||
public override string Description
|
} // Class
|
||||||
{ get { return _Item.GetPDDescription(); } }
|
|
||||||
public override string Name
|
|
||||||
{ get { return _Item.GetPDName(); } }
|
|
||||||
public override string Category
|
|
||||||
{ get { return _Item.GetPDCategory(); } }
|
|
||||||
} // Class
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using Csla;
|
using Csla;
|
||||||
using Csla.Data;
|
|
||||||
using System.Configuration;
|
|
||||||
using System.IO;
|
|
||||||
using System.ComponentModel;
|
|
||||||
|
|
||||||
|
|
||||||
//namespace VEPROMS.CSLA.Library;
|
|
||||||
|
|
||||||
// C2025-027 this new file is used to support (data retrival) for selecting Annotation types to display on the Annotation screen. This is related to Annotation type filtering through V->Options.
|
// C2025-027 this new file is used to support (data retrival) for selecting Annotation types to display on the Annotation screen. This is related to Annotation type filtering through V->Options.
|
||||||
|
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
@@ -70,8 +58,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
return dt;
|
return dt;
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
//B2025-004
|
//B2025-004
|
||||||
//if it fails loading previously open tabs, simply treat it as if no tabs were open
|
//if it fails loading previously open tabs, simply treat it as if no tabs were open
|
||||||
//instead of crashing
|
//instead of crashing
|
||||||
@@ -101,8 +89,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
return dt;
|
return dt;
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
//B2025-004
|
//B2025-004
|
||||||
//if it fails loading previously open tabs, simply treat it as if no tabs were open
|
//if it fails loading previously open tabs, simply treat it as if no tabs were open
|
||||||
//instead of crashing
|
//instead of crashing
|
||||||
@@ -132,7 +120,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
return dt;
|
return dt;
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
//B2025-004
|
//B2025-004
|
||||||
//if it fails loading previously open tabs, simply treat it as if no tabs were open
|
//if it fails loading previously open tabs, simply treat it as if no tabs were open
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using Csla.Data;
|
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using Csla.Data;
|
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using Csla.Data;
|
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Csla.Data;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using Csla.Data;
|
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
@@ -9,7 +6,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
public interface IVEDrillDownReadOnly
|
public interface IVEDrillDownReadOnly
|
||||||
{
|
{
|
||||||
System.Collections.IList GetChildren(); // Returns a list of Business Objects
|
System.Collections.IList GetChildren(); // Returns a list of Business Objects
|
||||||
//bool ChildrenAreLoaded { get; }; // Have the Business Objects been Loaded
|
|
||||||
bool HasChildren { get; } // Identifies if Children are available
|
bool HasChildren { get; } // Identifies if Children are available
|
||||||
IVEDrillDownReadOnly ActiveParent { get; }
|
IVEDrillDownReadOnly ActiveParent { get; }
|
||||||
FormatInfo ActiveFormat { get; }
|
FormatInfo ActiveFormat { get; }
|
||||||
@@ -25,17 +21,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
bool IsProcedure { get; }
|
bool IsProcedure { get; }
|
||||||
bool IsSection { get; }
|
bool IsSection { get; }
|
||||||
bool IsStep { get; }
|
bool IsStep { get; }
|
||||||
//IVEDrillDown Get();
|
|
||||||
//bool HasStandardSteps();
|
|
||||||
// Ideas Authorization
|
|
||||||
//bool CanLock();
|
|
||||||
//bool CanUnlock();
|
|
||||||
//bool CanOpen();
|
|
||||||
//bool CanEdit();
|
|
||||||
//bool CanAdmin();
|
|
||||||
// Ideas Security
|
|
||||||
//bool Lock(string msg);
|
|
||||||
//bool Unlock();
|
|
||||||
}
|
}
|
||||||
[TypeConverter(typeof(ExpandableObjectConverter))]
|
[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||||
public interface IVEDrillDown : IVEHasBrokenRules
|
public interface IVEDrillDown : IVEHasBrokenRules
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Csla;
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
@@ -14,35 +9,19 @@ namespace VEPROMS.CSLA.Library
|
|||||||
public class VETreeNodeEventArgs : EventArgs
|
public class VETreeNodeEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
public VETreeNodeEventArgs() { ; }
|
public VETreeNodeEventArgs() { ; }
|
||||||
public VETreeNodeEventArgs(string info)
|
public VETreeNodeEventArgs(string info) => Info = info;
|
||||||
|
public VETreeNodeEventArgs(int value) => Value = value;
|
||||||
|
public VETreeNodeEventArgs(string info, int value)
|
||||||
{
|
{
|
||||||
_Info = info;
|
Info = info;
|
||||||
|
Value = value;
|
||||||
}
|
}
|
||||||
public VETreeNodeEventArgs(int value)
|
|
||||||
{
|
|
||||||
_Value = value;
|
|
||||||
}
|
|
||||||
public VETreeNodeEventArgs(string info, int value)
|
|
||||||
{
|
|
||||||
_Info = info;
|
|
||||||
_Value = value;
|
|
||||||
}
|
|
||||||
private int _Value;
|
|
||||||
|
|
||||||
public int Value
|
public int Value { get; set; }
|
||||||
{
|
|
||||||
get { return _Value; }
|
|
||||||
set { _Value = value; }
|
|
||||||
}
|
|
||||||
private string _Info;
|
|
||||||
|
|
||||||
public string Info
|
public string Info { get; set; }
|
||||||
{
|
|
||||||
get { return _Info; }
|
}
|
||||||
set { _Info = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
public class VETreeNode : TreeNode
|
public class VETreeNode : TreeNode
|
||||||
{
|
{
|
||||||
#region Events
|
#region Events
|
||||||
@@ -51,25 +30,13 @@ namespace VEPROMS.CSLA.Library
|
|||||||
public event VETreeNodeEvent LoadingChildrenMax;
|
public event VETreeNodeEvent LoadingChildrenMax;
|
||||||
public event VETreeNodeEvent LoadingChildrenValue;
|
public event VETreeNodeEvent LoadingChildrenValue;
|
||||||
public event VETreeNodeEvent LoadingChildrenDone;
|
public event VETreeNodeEvent LoadingChildrenDone;
|
||||||
private void OnLoadingChildrenSQL(object sender, VETreeNodeEventArgs args)
|
private void OnLoadingChildrenSQL(object sender, VETreeNodeEventArgs args) => LoadingChildrenSQL?.Invoke(sender, args);
|
||||||
{
|
private void OnLoadingChildrenMax(object sender, VETreeNodeEventArgs args) => LoadingChildrenMax?.Invoke(sender, args);
|
||||||
if (LoadingChildrenSQL != null) LoadingChildrenSQL(sender, args);
|
private void OnLoadingChildrenValue(object sender, VETreeNodeEventArgs args) => LoadingChildrenValue?.Invoke(sender, args);
|
||||||
}
|
private void OnLoadingChildrenDone(object sender, VETreeNodeEventArgs args) => LoadingChildrenDone?.Invoke(sender, args);
|
||||||
private void OnLoadingChildrenMax(object sender, VETreeNodeEventArgs args)
|
#endregion
|
||||||
{
|
#region Business Methods
|
||||||
if (LoadingChildrenMax != null) LoadingChildrenMax(sender, args);
|
protected IVEDrillDownReadOnly _VEObject;
|
||||||
}
|
|
||||||
private void OnLoadingChildrenValue(object sender, VETreeNodeEventArgs args)
|
|
||||||
{
|
|
||||||
if (LoadingChildrenValue != null) LoadingChildrenValue(sender, args);
|
|
||||||
}
|
|
||||||
private void OnLoadingChildrenDone(object sender, VETreeNodeEventArgs args)
|
|
||||||
{
|
|
||||||
if (LoadingChildrenDone != null) LoadingChildrenDone(sender, args);
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
#region Business Methods
|
|
||||||
protected IVEDrillDownReadOnly _VEObject;
|
|
||||||
public IVEDrillDownReadOnly VEObject
|
public IVEDrillDownReadOnly VEObject
|
||||||
{
|
{
|
||||||
get { return _VEObject; }
|
get { return _VEObject; }
|
||||||
@@ -80,11 +47,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
ResetNode("Dummy Set_VEObject");
|
ResetNode("Dummy Set_VEObject");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//public void Refresh()
|
|
||||||
//{
|
|
||||||
// if (_VEObject != null)
|
|
||||||
// Text = _VEObject.ToString();
|
|
||||||
//}
|
|
||||||
// Only load the Children Once
|
// Only load the Children Once
|
||||||
protected bool _ChildrenLoaded = false;
|
protected bool _ChildrenLoaded = false;
|
||||||
public bool ChildrenLoaded
|
public bool ChildrenLoaded
|
||||||
@@ -104,16 +66,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
get { return _InChildWindow; }
|
get { return _InChildWindow; }
|
||||||
set { _InChildWindow = value; }
|
set { _InChildWindow = value; }
|
||||||
}
|
}
|
||||||
// Reset Node
|
|
||||||
//public void CloseNode()
|
|
||||||
//{
|
|
||||||
// ResetNode();
|
|
||||||
//}
|
|
||||||
private void SetProperty(string name)
|
private void SetProperty(string name)
|
||||||
{
|
{
|
||||||
PropertyInfo propertyInfoObj = _VEObject.GetType().GetProperty(name);
|
PropertyInfo propertyInfoObj = _VEObject.GetType().GetProperty(name);
|
||||||
if (propertyInfoObj == null) return;
|
if (propertyInfoObj == null) return;
|
||||||
PropertyInfo propertyInfoThis = this.GetType().GetProperty(name);
|
PropertyInfo propertyInfoThis = GetType().GetProperty(name);
|
||||||
if (propertyInfoThis == null) return;
|
if (propertyInfoThis == null) return;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -129,7 +86,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (_VEObject!=null && _VEObject.HasChildren && _ChildrenLoaded == false && CheckForParts())
|
if (_VEObject!=null && _VEObject.HasChildren && _ChildrenLoaded == false && CheckForParts())
|
||||||
{
|
{
|
||||||
_ChildrenLoaded = false;// Reset the children loaded flag
|
_ChildrenLoaded = false;// Reset the children loaded flag
|
||||||
this.Nodes.Add(dummy);// Add a Dummy Node so that the item will appear to be expanable.
|
Nodes.Add(dummy);// Add a Dummy Node so that the item will appear to be expanable.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -167,38 +124,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
tn.ResetNode("Dummy GetFolder");
|
tn.ResetNode("Dummy GetFolder");
|
||||||
return tn;
|
return tn;
|
||||||
}
|
}
|
||||||
// public abstract void LoadChildren();
|
public virtual void LoadChildren() => LoadChildren(true);
|
||||||
//private long _Start;
|
private bool _allParts = true;
|
||||||
//private Dictionary<string, long> _Timings=new Dictionary<string,long>();
|
|
||||||
//private void tReset()
|
|
||||||
//{
|
|
||||||
// _Timings = new Dictionary<string, long>();
|
|
||||||
// _Start = DateTime.Now.Ticks;
|
|
||||||
//}
|
|
||||||
//private void tNext(string msg)
|
|
||||||
//{
|
|
||||||
// long tEnd = DateTime.Now.Ticks;
|
|
||||||
// long tDiff = tEnd - _Start;
|
|
||||||
// if (_Timings.ContainsKey(msg)) tDiff += _Timings[msg];
|
|
||||||
// _Timings[msg] = tDiff;
|
|
||||||
// _Start = DateTime.Now.Ticks;
|
|
||||||
//}
|
|
||||||
//private void tShowResults()
|
|
||||||
//{
|
|
||||||
// Console.WriteLine("Timings");
|
|
||||||
// long total=0;
|
|
||||||
// foreach (string msg in _Timings.Keys)
|
|
||||||
// {
|
|
||||||
// total += _Timings[msg];
|
|
||||||
// Console.WriteLine("{0}\t\"{1}\"", TimeSpan.FromTicks(_Timings[msg]).TotalMilliseconds, msg);
|
|
||||||
// }
|
|
||||||
// Console.WriteLine("{0}\t\"Total\"", TimeSpan.FromTicks(total).TotalMilliseconds);
|
|
||||||
//}
|
|
||||||
public virtual void LoadChildren()
|
|
||||||
{
|
|
||||||
LoadChildren(true);
|
|
||||||
}
|
|
||||||
private bool _allParts = true;
|
|
||||||
private bool _excludeTablesFigsEqu = false; // used for inserting Step Text transitions (BNPP)
|
private bool _excludeTablesFigsEqu = false; // used for inserting Step Text transitions (BNPP)
|
||||||
public virtual void LoadChildren(bool allParts, bool excldTablesFigEq = false)
|
public virtual void LoadChildren(bool allParts, bool excldTablesFigEq = false)
|
||||||
{
|
{
|
||||||
@@ -207,33 +134,23 @@ namespace VEPROMS.CSLA.Library
|
|||||||
_excludeTablesFigsEqu = excldTablesFigEq;
|
_excludeTablesFigsEqu = excldTablesFigEq;
|
||||||
if (!_ChildrenLoaded)
|
if (!_ChildrenLoaded)
|
||||||
{
|
{
|
||||||
this.Nodes.Clear();
|
Nodes.Clear();
|
||||||
//tReset();
|
|
||||||
DateTime tStart = DateTime.Now;
|
DateTime tStart = DateTime.Now;
|
||||||
//TVAddChildren(_VEObject, this);
|
|
||||||
OnLoadingChildrenSQL(this, new VETreeNodeEventArgs());
|
OnLoadingChildrenSQL(this, new VETreeNodeEventArgs());
|
||||||
IList ol;
|
IList ol;
|
||||||
ItemInfo item = _VEObject as ItemInfo;
|
if (_VEObject is ItemInfo item) item.RefreshItemParts();
|
||||||
if (item != null) item.RefreshItemParts();
|
if (_VEObject.GetType() == typeof(StepInfo) || _VEObject.GetType() == typeof(SectionInfo) || _VEObject.GetType() == typeof(ItemInfo))
|
||||||
if (_VEObject.GetType() == typeof(StepInfo) || _VEObject.GetType() == typeof(SectionInfo) || _VEObject.GetType() == typeof(ItemInfo))
|
|
||||||
ol = ((ItemInfo)_VEObject).GetChildren(allParts);
|
ol = ((ItemInfo)_VEObject).GetChildren(allParts);
|
||||||
else
|
else
|
||||||
ol = _VEObject.GetChildren();
|
ol = _VEObject.GetChildren();
|
||||||
//tNext("GetChildren");
|
|
||||||
if (ol != null)
|
if (ol != null)
|
||||||
{
|
{
|
||||||
OnLoadingChildrenMax(this, new VETreeNodeEventArgs(ol.Count));
|
OnLoadingChildrenMax(this, new VETreeNodeEventArgs(ol.Count));
|
||||||
//this.TreeView.BeginUpdate();
|
if (TreeView != null) TreeView.BeginUpdate();
|
||||||
if (this.TreeView != null) this.TreeView.BeginUpdate();
|
|
||||||
else _MyLog.WarnFormat("TreeView.BeginUpdate - Null");
|
else _MyLog.WarnFormat("TreeView.BeginUpdate - Null");
|
||||||
ExpandChildren(ol);
|
ExpandChildren(ol);
|
||||||
//}
|
if (TreeView != null) TreeView.EndUpdate();
|
||||||
//tNext("Set Nodes");
|
|
||||||
//this.TreeView.EndUpdate();
|
|
||||||
if (this.TreeView != null) this.TreeView.EndUpdate();
|
|
||||||
else _MyLog.WarnFormat("TreeView.EndUpdate - Null");
|
else _MyLog.WarnFormat("TreeView.EndUpdate - Null");
|
||||||
//tNext("End Update");
|
|
||||||
//tShowResults();
|
|
||||||
}
|
}
|
||||||
_ChildrenLoaded = true;
|
_ChildrenLoaded = true;
|
||||||
OnLoadingChildrenDone(this, new VETreeNodeEventArgs(TimeSpan.FromTicks(DateTime.Now.Ticks - tStart.Ticks).TotalSeconds.ToString()));
|
OnLoadingChildrenDone(this, new VETreeNodeEventArgs(TimeSpan.FromTicks(DateTime.Now.Ticks - tStart.Ticks).TotalSeconds.ToString()));
|
||||||
@@ -247,7 +164,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
foreach (IVEDrillDownReadOnly o in ol)
|
foreach (IVEDrillDownReadOnly o in ol)
|
||||||
{
|
{
|
||||||
OnLoadingChildrenValue(this, new VETreeNodeEventArgs(++icnt));
|
OnLoadingChildrenValue(this, new VETreeNodeEventArgs(++icnt));
|
||||||
//tNext("Cycle");
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bool skipIt = false;
|
bool skipIt = false;
|
||||||
@@ -277,18 +193,14 @@ namespace VEPROMS.CSLA.Library
|
|||||||
tmp.ExpandChildren(o.GetChildren());
|
tmp.ExpandChildren(o.GetChildren());
|
||||||
tmp._ChildrenLoaded = true;
|
tmp._ChildrenLoaded = true;
|
||||||
}
|
}
|
||||||
// OLD: RHM 20100115 : I don't think that the following lines are necessary since the "new VETreeNode(o)"
|
|
||||||
// above includes a similar function.
|
|
||||||
//else
|
|
||||||
// tmp.Nodes.Add(string.Format("dummy: {0}", o.GetType().Name));// Add a Dummy Node so that the item will appear to be expanable.
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
tmp._ChildrenLoaded = true;// Reset the children loaded flag
|
tmp._ChildrenLoaded = true;// Reset the children loaded flag
|
||||||
if (lastWasSection)
|
if (lastWasSection)
|
||||||
this.Nodes.Insert(0, tmp);
|
Nodes.Insert(0, tmp);
|
||||||
// B2024-019 don't show Tables, Figures, or Equations in step tree when inserting Text Transitions
|
// B2024-019 don't show Tables, Figures, or Equations in step tree when inserting Text Transitions
|
||||||
else if (!_excludeTablesFigsEqu || !isTableFigEqu)
|
else if (!_excludeTablesFigsEqu || !isTableFigEqu)
|
||||||
this.Nodes.Add(tmp);
|
Nodes.Add(tmp);
|
||||||
// if last thing was section & this is step, do insert - i.e. so that steps go before sections.
|
// if last thing was section & this is step, do insert - i.e. so that steps go before sections.
|
||||||
lastWasSection = (o is PartInfo && (o as PartInfo).PartType == E_FromType.Section);
|
lastWasSection = (o is PartInfo && (o as PartInfo).PartType == E_FromType.Section);
|
||||||
}
|
}
|
||||||
@@ -302,16 +214,15 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private void TVAddChildren(IVEDrillDownReadOnly veobj, VETreeNode tn)
|
private void TVAddChildren(IVEDrillDownReadOnly veobj, VETreeNode tn)
|
||||||
{
|
{
|
||||||
OnLoadingChildrenSQL(tn, new VETreeNodeEventArgs());
|
OnLoadingChildrenSQL(tn, new VETreeNodeEventArgs());
|
||||||
IList ol;
|
IList ol;
|
||||||
ItemInfo item = veobj as ItemInfo;
|
if (veobj.GetType() == typeof(StepInfo) || veobj.GetType() == typeof(SectionInfo) || veobj.GetType() == typeof(ItemInfo))
|
||||||
if (veobj.GetType() == typeof(StepInfo) || veobj.GetType() == typeof(SectionInfo) || veobj.GetType() == typeof(ItemInfo))
|
|
||||||
ol = ((ItemInfo)veobj).GetChildren(true);
|
ol = ((ItemInfo)veobj).GetChildren(true);
|
||||||
else
|
else
|
||||||
ol = veobj.GetChildren();
|
ol = veobj.GetChildren();
|
||||||
if (ol != null)
|
if (ol != null)
|
||||||
{
|
{
|
||||||
OnLoadingChildrenMax(this, new VETreeNodeEventArgs(ol.Count));
|
OnLoadingChildrenMax(this, new VETreeNodeEventArgs(ol.Count));
|
||||||
this.TreeView.BeginUpdate();
|
TreeView.BeginUpdate();
|
||||||
int icnt = 0;
|
int icnt = 0;
|
||||||
foreach (IVEDrillDownReadOnly o in ol)
|
foreach (IVEDrillDownReadOnly o in ol)
|
||||||
{
|
{
|
||||||
@@ -333,46 +244,36 @@ namespace VEPROMS.CSLA.Library
|
|||||||
Console.WriteLine("{0}\r\n{1}", ex.Message, ex.InnerException);
|
Console.WriteLine("{0}\r\n{1}", ex.Message, ex.InnerException);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
TreeView.EndUpdate();
|
||||||
//}
|
|
||||||
this.TreeView.EndUpdate();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void myItemInfo_Deleted(object sender)
|
void myItemInfo_Deleted(object sender)
|
||||||
{
|
{
|
||||||
VETreeNode parnode = Parent as VETreeNode;
|
if (!(Parent is VETreeNode parnode)) return;
|
||||||
if (parnode == null) return;
|
Remove();
|
||||||
PartInfo pi = parnode.VEObject as PartInfo;
|
// get rid of 'Steps', 'RNOs', i.e. grouping nodes, if there are no children.
|
||||||
Remove();
|
if (parnode.VEObject is PartInfo && parnode.Nodes.Count == 0)
|
||||||
// get rid of 'Steps', 'RNOs', i.e. grouping nodes, if there are no children.
|
|
||||||
if (pi != null && parnode.Nodes.Count == 0)
|
|
||||||
{
|
{
|
||||||
VETreeNode grndparnode = parnode.Parent as VETreeNode;
|
parnode.Remove();
|
||||||
parnode.Remove();
|
// if only 'Steps' node is left, move steps 'up' a level.
|
||||||
// if only 'Steps' node is left, move steps 'up' a level.
|
if (parnode.Parent is VETreeNode grndparnode && grndparnode.Nodes.Count == 1)
|
||||||
if (grndparnode != null && grndparnode.Nodes.Count == 1)
|
|
||||||
{
|
{
|
||||||
VETreeNode sibnode = grndparnode.Nodes[0] as VETreeNode;
|
VETreeNode sibnode = grndparnode.Nodes[0] as VETreeNode;
|
||||||
PartInfo pisib = sibnode.VEObject as PartInfo;
|
if (sibnode.VEObject is PartInfo pisib && (pisib.ToString() == "Steps"))
|
||||||
if (pisib != null && (pisib.ToString() == "Steps"))
|
{
|
||||||
{
|
if (!sibnode.ChildrenLoaded) sibnode.LoadChildren();
|
||||||
if (!sibnode.ChildrenLoaded) sibnode.LoadChildren();
|
while (sibnode.Nodes.Count > 0)
|
||||||
while (sibnode.Nodes.Count > 0)
|
{
|
||||||
{
|
VETreeNode tmp = sibnode.Nodes[0] as VETreeNode;
|
||||||
VETreeNode tmp = sibnode.Nodes[0] as VETreeNode;
|
tmp.Remove();
|
||||||
tmp.Remove();
|
grndparnode.Nodes.Add(tmp);
|
||||||
grndparnode.Nodes.Add(tmp);
|
}
|
||||||
}
|
sibnode.Remove();
|
||||||
sibnode.Remove();
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//public IVEReadOnlyItem GetCsla()
|
|
||||||
//{
|
|
||||||
// return _VEObject;
|
|
||||||
//}
|
|
||||||
#endregion
|
#endregion
|
||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
// Constructors
|
// Constructors
|
||||||
@@ -383,25 +284,24 @@ namespace VEPROMS.CSLA.Library
|
|||||||
_allParts = allParts;
|
_allParts = allParts;
|
||||||
_VEObject = o;// Save the BusinessObject
|
_VEObject = o;// Save the BusinessObject
|
||||||
ResetNode("Dummy VETreeNode(IVEDrillDownReadOnly o)");
|
ResetNode("Dummy VETreeNode(IVEDrillDownReadOnly o)");
|
||||||
ItemInfo myItemInfo = o as ItemInfo;
|
if (o is ItemInfo myItemInfo)
|
||||||
if (myItemInfo != null)
|
{
|
||||||
{
|
myItemInfo.Deleted -= new ItemInfoEvent(myItemInfo_Deleted);
|
||||||
myItemInfo.Deleted -= new ItemInfoEvent(myItemInfo_Deleted);
|
myItemInfo.Deleted += new ItemInfoEvent(myItemInfo_Deleted);
|
||||||
myItemInfo.Deleted += new ItemInfoEvent(myItemInfo_Deleted);
|
myItemInfo.ChildrenDeleted -= new ItemInfoEvent(myItemInfo_ChildrenDeleted);
|
||||||
myItemInfo.ChildrenDeleted -= new ItemInfoEvent(myItemInfo_ChildrenDeleted);
|
myItemInfo.ChildrenDeleted += new ItemInfoEvent(myItemInfo_ChildrenDeleted);
|
||||||
myItemInfo.ChildrenDeleted += new ItemInfoEvent(myItemInfo_ChildrenDeleted);
|
myItemInfo.MyContent.Changed -= new ContentInfoEvent(NodeText_Changed);
|
||||||
myItemInfo.MyContent.Changed -= new ContentInfoEvent(NodeText_Changed);
|
myItemInfo.MyContent.Changed += new ContentInfoEvent(NodeText_Changed);
|
||||||
myItemInfo.MyContent.Changed += new ContentInfoEvent(NodeText_Changed);
|
myItemInfo.OrdinalChanged -= new ItemInfoEvent(NodeText_Changed);
|
||||||
myItemInfo.OrdinalChanged -= new ItemInfoEvent(NodeText_Changed);
|
myItemInfo.OrdinalChanged += new ItemInfoEvent(NodeText_Changed);
|
||||||
myItemInfo.OrdinalChanged += new ItemInfoEvent(NodeText_Changed);
|
myItemInfo.NewSiblingAfter -= new ItemInfoInsertEvent(myItemInfo_NewSiblingAfter);
|
||||||
myItemInfo.NewSiblingAfter -= new ItemInfoInsertEvent(myItemInfo_NewSiblingAfter);
|
myItemInfo.NewSiblingAfter += new ItemInfoInsertEvent(myItemInfo_NewSiblingAfter);
|
||||||
myItemInfo.NewSiblingAfter += new ItemInfoInsertEvent(myItemInfo_NewSiblingAfter);
|
myItemInfo.NewSiblingBefore -= new ItemInfoInsertEvent(myItemInfo_NewSiblingBefore);
|
||||||
myItemInfo.NewSiblingBefore -= new ItemInfoInsertEvent(myItemInfo_NewSiblingBefore);
|
myItemInfo.NewSiblingBefore += new ItemInfoInsertEvent(myItemInfo_NewSiblingBefore);
|
||||||
myItemInfo.NewSiblingBefore += new ItemInfoInsertEvent(myItemInfo_NewSiblingBefore);
|
myItemInfo.NewChild -= new ItemInfoInsertEvent(myItemInfo_NewChild);
|
||||||
myItemInfo.NewChild -= new ItemInfoInsertEvent(myItemInfo_NewChild);
|
myItemInfo.NewChild += new ItemInfoInsertEvent(myItemInfo_NewChild);
|
||||||
myItemInfo.NewChild += new ItemInfoInsertEvent(myItemInfo_NewChild);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
void NodeText_Changed(object sender)
|
void NodeText_Changed(object sender)
|
||||||
{
|
{
|
||||||
Text = _VEObject.ToString();
|
Text = _VEObject.ToString();
|
||||||
@@ -422,7 +322,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (myItemInfo.Sections != null && myItemInfo.Sections.Count > 0 && myItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections)
|
if (myItemInfo.Sections != null && myItemInfo.Sections.Count > 0 && myItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections)
|
||||||
{
|
{
|
||||||
// see if change in children tree nodes.
|
// see if change in children tree nodes.
|
||||||
this.Nodes.Clear();
|
Nodes.Clear();
|
||||||
_ChildrenLoaded = false;
|
_ChildrenLoaded = false;
|
||||||
LoadChildren(true);
|
LoadChildren(true);
|
||||||
}
|
}
|
||||||
@@ -433,25 +333,24 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
_VEObject = o;// Save the BusinessObject
|
_VEObject = o;// Save the BusinessObject
|
||||||
ResetNode("Dummy VETreeNode(IVEDrillDownReadOnly o)");
|
ResetNode("Dummy VETreeNode(IVEDrillDownReadOnly o)");
|
||||||
ItemInfo myItemInfo = o as ItemInfo;
|
if (o is ItemInfo myItemInfo)
|
||||||
if (myItemInfo != null)
|
{
|
||||||
{
|
myItemInfo.Deleted -= new ItemInfoEvent(myItemInfo_Deleted);
|
||||||
myItemInfo.Deleted -= new ItemInfoEvent(myItemInfo_Deleted);
|
myItemInfo.Deleted += new ItemInfoEvent(myItemInfo_Deleted);
|
||||||
myItemInfo.Deleted += new ItemInfoEvent(myItemInfo_Deleted);
|
myItemInfo.ChildrenDeleted -= new ItemInfoEvent(myItemInfo_ChildrenDeleted);
|
||||||
myItemInfo.ChildrenDeleted -= new ItemInfoEvent(myItemInfo_ChildrenDeleted);
|
myItemInfo.ChildrenDeleted += new ItemInfoEvent(myItemInfo_ChildrenDeleted);
|
||||||
myItemInfo.ChildrenDeleted += new ItemInfoEvent(myItemInfo_ChildrenDeleted);
|
myItemInfo.MyContent.Changed -= new ContentInfoEvent(NodeText_Changed);
|
||||||
myItemInfo.MyContent.Changed -= new ContentInfoEvent(NodeText_Changed);
|
myItemInfo.MyContent.Changed += new ContentInfoEvent(NodeText_Changed);
|
||||||
myItemInfo.MyContent.Changed += new ContentInfoEvent(NodeText_Changed);
|
myItemInfo.OrdinalChanged -= new ItemInfoEvent(NodeText_Changed);
|
||||||
myItemInfo.OrdinalChanged -= new ItemInfoEvent(NodeText_Changed);
|
myItemInfo.OrdinalChanged += new ItemInfoEvent(NodeText_Changed);
|
||||||
myItemInfo.OrdinalChanged += new ItemInfoEvent(NodeText_Changed);
|
myItemInfo.NewSiblingAfter -= new ItemInfoInsertEvent(myItemInfo_NewSiblingAfter);
|
||||||
myItemInfo.NewSiblingAfter -= new ItemInfoInsertEvent(myItemInfo_NewSiblingAfter);
|
myItemInfo.NewSiblingAfter += new ItemInfoInsertEvent(myItemInfo_NewSiblingAfter);
|
||||||
myItemInfo.NewSiblingAfter += new ItemInfoInsertEvent(myItemInfo_NewSiblingAfter);
|
myItemInfo.NewSiblingBefore -= new ItemInfoInsertEvent(myItemInfo_NewSiblingBefore);
|
||||||
myItemInfo.NewSiblingBefore -= new ItemInfoInsertEvent(myItemInfo_NewSiblingBefore);
|
myItemInfo.NewSiblingBefore += new ItemInfoInsertEvent(myItemInfo_NewSiblingBefore);
|
||||||
myItemInfo.NewSiblingBefore += new ItemInfoInsertEvent(myItemInfo_NewSiblingBefore);
|
myItemInfo.NewChild -= new ItemInfoInsertEvent(myItemInfo_NewChild);
|
||||||
myItemInfo.NewChild -= new ItemInfoInsertEvent(myItemInfo_NewChild);
|
myItemInfo.NewChild += new ItemInfoInsertEvent(myItemInfo_NewChild);
|
||||||
myItemInfo.NewChild += new ItemInfoInsertEvent(myItemInfo_NewChild);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void myItemInfo_ChildrenDeleted(object sender)
|
void myItemInfo_ChildrenDeleted(object sender)
|
||||||
{
|
{
|
||||||
@@ -469,8 +368,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
int nextItemID = args.ItemInserted.NextItem.ItemID;
|
int nextItemID = args.ItemInserted.NextItem.ItemID;
|
||||||
VETreeNode nextNode = FindChildOrGrandChild(nextItemID);
|
VETreeNode nextNode = FindChildOrGrandChild(nextItemID);
|
||||||
if(nextNode != null)
|
nextNode?.myItemInfo_NewSiblingBefore(sender, args);
|
||||||
nextNode.myItemInfo_NewSiblingBefore(sender, args);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (args.ItemInserted.MyPrevious != null) // insert after
|
if (args.ItemInserted.MyPrevious != null) // insert after
|
||||||
@@ -486,317 +384,65 @@ namespace VEPROMS.CSLA.Library
|
|||||||
Nodes.Clear();
|
Nodes.Clear();
|
||||||
_ChildrenLoaded = false;
|
_ChildrenLoaded = false;
|
||||||
ResetNode("Dummy myItemInfo_NewChild");
|
ResetNode("Dummy myItemInfo_NewChild");
|
||||||
ItemInfo item = VEObject as ItemInfo;
|
if (isExpanded && VEObject is ItemInfo item && item.MyContent.ContentPartCount > 1) // || args.ItemInserted.NextItem != null || args.ItemInserted.MyPrevious != null))
|
||||||
if (isExpanded && item != null && item.MyContent.ContentPartCount > 1) // || args.ItemInserted.NextItem != null || args.ItemInserted.MyPrevious != null))
|
Expand();
|
||||||
Expand();
|
else
|
||||||
else
|
Collapse();
|
||||||
Collapse();
|
}
|
||||||
}
|
|
||||||
private VETreeNode FindChildOrGrandChild(int itemID)
|
private VETreeNode FindChildOrGrandChild(int itemID)
|
||||||
{
|
{
|
||||||
foreach (TreeNode childNode in Nodes)
|
foreach (TreeNode childNode in Nodes)
|
||||||
{
|
{
|
||||||
VETreeNode child = childNode as VETreeNode;
|
if (childNode is VETreeNode child)
|
||||||
if (child != null)
|
{
|
||||||
{
|
if (child.VEObject is ItemInfo item && item.ItemID == itemID)
|
||||||
ItemInfo item = child.VEObject as ItemInfo;
|
return child;
|
||||||
if (item != null && item.ItemID == itemID)
|
}
|
||||||
return child;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach (TreeNode childNode in Nodes)
|
foreach (TreeNode childNode in Nodes)
|
||||||
{
|
{
|
||||||
VETreeNode child = childNode as VETreeNode;
|
if (childNode is VETreeNode child && child.VEObject is PartInfo)
|
||||||
if (child != null && child.VEObject is PartInfo)
|
foreach (VETreeNode grandchild in child.Nodes)
|
||||||
foreach (VETreeNode grandchild in child.Nodes)
|
{
|
||||||
{
|
if (grandchild.VEObject is ItemInfo item && item.ItemID == itemID)
|
||||||
ItemInfo item = grandchild.VEObject as ItemInfo;
|
return grandchild;
|
||||||
if (item != null && item.ItemID == itemID)
|
}
|
||||||
return grandchild;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
void myItemInfo_NewSiblingBefore(object sender, ItemInfoInsertEventArgs args)
|
void myItemInfo_NewSiblingBefore(object sender, ItemInfoInsertEventArgs args)
|
||||||
{
|
{
|
||||||
if (this.Parent != null) // Only do this if the node has a parent - RHM 20100106
|
if (Parent != null) // Only do this if the node has a parent - RHM 20100106
|
||||||
{
|
{
|
||||||
ItemInfo ii = args.ItemInserted as ItemInfo;
|
if (!(args.ItemInserted is ItemInfo ii))
|
||||||
if (ii == null)
|
Parent.Nodes.Insert(Index, (new VETreeNode(args.ItemInserted)));
|
||||||
this.Parent.Nodes.Insert(Index, (new VETreeNode(args.ItemInserted)));
|
else // B2020-142: Can't get properties of restored item (no treeview context menu would be correct after restore)
|
||||||
else // B2020-142: Can't get properties of restored item (no treeview context menu would be correct after restore)
|
{
|
||||||
{
|
if (ii.IsProcedure) Parent.Nodes.Insert(Index, (new VETreeNode(ProcedureInfo.Get(ii.ItemID))));
|
||||||
if (ii.IsProcedure) this.Parent.Nodes.Insert(Index, (new VETreeNode(ProcedureInfo.Get(ii.ItemID))));
|
if (ii.IsSection) Parent.Nodes.Insert(Index, (new VETreeNode(SectionInfo.Get(ii.ItemID))));
|
||||||
if (ii.IsSection) this.Parent.Nodes.Insert(Index, (new VETreeNode(SectionInfo.Get(ii.ItemID))));
|
if (ii.IsStep) Parent.Nodes.Insert(Index, (new VETreeNode(StepInfo.Get(ii.ItemID))));
|
||||||
if (ii.IsStep) this.Parent.Nodes.Insert(Index, (new VETreeNode(StepInfo.Get(ii.ItemID))));
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
void myItemInfo_NewSiblingAfter(object sender, ItemInfoInsertEventArgs args)
|
void myItemInfo_NewSiblingAfter(object sender, ItemInfoInsertEventArgs args)
|
||||||
{
|
{
|
||||||
if (this.Parent != null) // Only do this if the node has a parent - RHM 20100106
|
if (Parent != null) // Only do this if the node has a parent - RHM 20100106
|
||||||
{
|
{
|
||||||
ItemInfo ii = args.ItemInserted as ItemInfo;
|
if (!(args.ItemInserted is ItemInfo ii))
|
||||||
if (ii == null)
|
Parent.Nodes.Insert(Index + 1, (new VETreeNode(args.ItemInserted)));
|
||||||
this.Parent.Nodes.Insert(Index + 1, (new VETreeNode(args.ItemInserted)));
|
else // B2020-142: Can't get properties of restored item (no treeview context menu would be correct after restore)
|
||||||
else // B2020-142: Can't get properties of restored item (no treeview context menu would be correct after restore)
|
{
|
||||||
{
|
if (ii.IsProcedure) Parent.Nodes.Insert(Index + 1, (new VETreeNode(ProcedureInfo.Get(ii.ItemID))));
|
||||||
if (ii.IsProcedure) this.Parent.Nodes.Insert(Index + 1, (new VETreeNode(ProcedureInfo.Get(ii.ItemID))));
|
if (ii.IsSection) Parent.Nodes.Insert(Index + 1, (new VETreeNode(SectionInfo.Get(ii.ItemID))));
|
||||||
if (ii.IsSection) this.Parent.Nodes.Insert(Index + 1, (new VETreeNode(SectionInfo.Get(ii.ItemID))));
|
if (ii.IsStep) Parent.Nodes.Insert(Index + 1, (new VETreeNode(StepInfo.Get(ii.ItemID))));
|
||||||
if (ii.IsStep) this.Parent.Nodes.Insert(Index + 1, (new VETreeNode(StepInfo.Get(ii.ItemID))));
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public VETreeNode(string s)
|
public VETreeNode(string s)
|
||||||
: base(s)
|
: base(s)
|
||||||
{
|
{
|
||||||
_VEObject = null;// Save the BusinessObject
|
_VEObject = null;// Save the BusinessObject
|
||||||
//ResetNode();
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
//public class VETreeNodeBase<T> : VETreeNode
|
|
||||||
//where T : VETreeNode, new()
|
|
||||||
//{
|
|
||||||
// #region Factory Methods
|
|
||||||
// private static int _ICount = 0;
|
|
||||||
// public VETreeNodeBase(string s) : base(s) { ;}
|
|
||||||
// public VETreeNodeBase(IVEReadOnlyItem o) : base(o) { ;}
|
|
||||||
// protected VETreeNodeBase() : base() {
|
|
||||||
// }
|
|
||||||
// private DateTime tNext(DateTime tStart, string msg)
|
|
||||||
// {
|
|
||||||
// DateTime tEnd = DateTime.Now;
|
|
||||||
// TimeSpan ts = new TimeSpan(tEnd.Ticks-tStart.Ticks);
|
|
||||||
// Console.WriteLine("{0} - {1}", ts.TotalMilliseconds, msg);
|
|
||||||
// return tEnd;
|
|
||||||
// }
|
|
||||||
// public override void LoadChildren()
|
|
||||||
// {
|
|
||||||
// if (!_ChildrenLoaded)
|
|
||||||
// {
|
|
||||||
// this.Nodes.Clear();
|
|
||||||
// "".TrimEnd("\r\n".ToCharArray());
|
|
||||||
// IList ol = _VEObject.GetChildren();
|
|
||||||
// if (ol != null)
|
|
||||||
// {
|
|
||||||
// this.TreeView.BeginUpdate();
|
|
||||||
// DateTime tStart = DateTime.Now;
|
|
||||||
// T[] tmpa = new T[ol.Count];
|
|
||||||
// tStart = tNext(tStart, "Allocate Array");
|
|
||||||
// for (int i = 0; i < ol.Count; i++) tmpa[i] = new T();
|
|
||||||
// tStart = tNext(tStart, "Allocate Nodes");
|
|
||||||
// int ii = 0;
|
|
||||||
// foreach (IVEReadOnlyItem o in ol)
|
|
||||||
// {
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// tmpa[ii++].VEObject = o;
|
|
||||||
// }
|
|
||||||
// catch (Exception ex)
|
|
||||||
// {
|
|
||||||
// Console.WriteLine("{0}\r\n{1}", ex.Message, ex.InnerException);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// tStart = tNext(tStart, "Set Nodes");
|
|
||||||
// for (int i = 0; i < ol.Count; i++) tmpa[i].ResetNode();
|
|
||||||
// tStart = tNext(tStart, "Reset Nodes");
|
|
||||||
// this.Nodes.AddRange(tmpa);
|
|
||||||
// tStart = tNext(tStart, "Add Range");
|
|
||||||
// //foreach (IVEReadOnlyItem o in ol)
|
|
||||||
// //{
|
|
||||||
// // try
|
|
||||||
// // {
|
|
||||||
// // T tmp = new T();
|
|
||||||
// // tmp.VEObject = o;
|
|
||||||
// // this.Nodes.Add(tmp);
|
|
||||||
// // }
|
|
||||||
// // catch (Exception ex)
|
|
||||||
// // {
|
|
||||||
// // Console.WriteLine("{0}\r\n{1}", ex.Message, ex.InnerException);
|
|
||||||
// // }
|
|
||||||
// //}
|
|
||||||
// this.TreeView.EndUpdate();
|
|
||||||
// }
|
|
||||||
// _ChildrenLoaded = true;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//#endregion
|
|
||||||
//}
|
|
||||||
/*
|
|
||||||
public class VEFolder : VETreeNodeBase<VEVersion>
|
|
||||||
{
|
|
||||||
public static VEFolder GetFolder(int folderID)
|
|
||||||
{
|
|
||||||
return new VEFolder(FolderInfo.Get(folderID));
|
|
||||||
}
|
|
||||||
//public static VEFolder LoadTree()
|
|
||||||
//{
|
|
||||||
// VEFolder root = null;
|
|
||||||
// FolderInfoList fil = FolderInfoList.Get();
|
|
||||||
// Dictionary<int, VEFolder> dicMissing = new Dictionary<int, VEFolder>();
|
|
||||||
// Dictionary<int, VEFolder> dicExists = new Dictionary<int, VEFolder>();
|
|
||||||
// foreach (FolderInfo fi in fil)
|
|
||||||
// {
|
|
||||||
// VEFolder ftp = null;
|
|
||||||
// if (dicExists.ContainsKey(fi.ParentID))
|
|
||||||
// {
|
|
||||||
// ftp = dicExists[fi.ParentID];
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// if (fi.ParentID != fi.FolderID)
|
|
||||||
// {
|
|
||||||
// ftp = new VEFolder(fi.ParentID.ToString());
|
|
||||||
// dicMissing.Add(fi.ParentID, ftp);
|
|
||||||
// dicExists.Add(fi.ParentID, ftp);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// VEFolder ft = null;
|
|
||||||
// if (dicMissing.ContainsKey(fi.FolderID))
|
|
||||||
// {
|
|
||||||
// ft = dicMissing[fi.FolderID];
|
|
||||||
// ft.VEObject = fi;
|
|
||||||
// dicMissing.Remove(fi.FolderID);
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// ft = new VEFolder(fi);
|
|
||||||
// dicExists.Add(fi.FolderID, ft);
|
|
||||||
// }
|
|
||||||
// if (fi.ParentID == fi.FolderID)
|
|
||||||
// root = ft;
|
|
||||||
// else
|
|
||||||
// ftp.Nodes.Add(ft);
|
|
||||||
// }
|
|
||||||
// //root.FindTree = dicExists;
|
|
||||||
// return root;
|
|
||||||
//}
|
|
||||||
private VEFolder(string s) : base(s) { ;}
|
|
||||||
public VEFolder(IVEReadOnlyItem o) : base(o) { ;}
|
|
||||||
}
|
|
||||||
public class VEVersion : VETreeNodeBase<VEProcedure> { }
|
|
||||||
public class VEProcedure : VETreeNodeBase<VESection>
|
|
||||||
{
|
|
||||||
//public override void LoadChildren()
|
|
||||||
//{
|
|
||||||
// if (!_ChildrenLoaded)
|
|
||||||
// {
|
|
||||||
// this.Nodes.Clear();
|
|
||||||
// Dictionary<string, VESection> dicSect = new Dictionary<string, VESection>();
|
|
||||||
// SectionInfoList ol = (SectionInfoList)_VEObject.GetChildren();
|
|
||||||
// if (ol != null)
|
|
||||||
// {
|
|
||||||
// foreach (SectionInfo o in ol)
|
|
||||||
// {
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// VESection tmp = new VESection();
|
|
||||||
// tmp.VEObject = o;
|
|
||||||
// if (dicSect.ContainsKey(o.PPath))
|
|
||||||
// dicSect[o.PPath].Nodes.Add(tmp);
|
|
||||||
// else
|
|
||||||
// this.Nodes.Add(tmp);
|
|
||||||
// dicSect[o.Path] = tmp;
|
|
||||||
// }
|
|
||||||
// catch (Exception ex)
|
|
||||||
// {
|
|
||||||
// Console.WriteLine("{0}\r\n{1}", ex.Message, ex.InnerException);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// _ChildrenLoaded = true;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
public class VESection : VETreeNodeBase<VEStep> { }
|
|
||||||
public class VEStep : VETreeNodeBase<VEStep> { }
|
|
||||||
*/
|
|
||||||
//public class VETree : VETreeNodeBase<VETree>
|
|
||||||
//{
|
|
||||||
// public VETree() { ;}
|
|
||||||
// public static VETree GetFolder(int folderID)
|
|
||||||
// {
|
|
||||||
// return new VETree(FolderInfo.Get(folderID));
|
|
||||||
// }
|
|
||||||
// //private VEFolder(string s) : base(s) { ;}
|
|
||||||
// public VETree(IVEReadOnlyItem o) : base(o) { ;}
|
|
||||||
//}
|
|
||||||
//public class VETree : VETreeNode
|
|
||||||
//{
|
|
||||||
// public VETree() { ;}
|
|
||||||
// public static VETree GetFolder(int folderID)
|
|
||||||
// {
|
|
||||||
// VETree tn = new VETree(FolderInfo.Get(folderID));
|
|
||||||
// tn.ResetNode();
|
|
||||||
// return tn;
|
|
||||||
// }
|
|
||||||
// //private VEFolder(string s) : base(s) { ;}
|
|
||||||
// public VETree(IVEReadOnlyItem o) : base(o) { ;}
|
|
||||||
// private DateTime tNext(DateTime tStart, string msg)
|
|
||||||
// {
|
|
||||||
// DateTime tEnd = DateTime.Now;
|
|
||||||
// TimeSpan ts = new TimeSpan(tEnd.Ticks - tStart.Ticks);
|
|
||||||
// Console.WriteLine("{0} - {1}", ts.TotalMilliseconds, msg);
|
|
||||||
// return tEnd;
|
|
||||||
// }
|
|
||||||
// public override void LoadChildren()
|
|
||||||
// {
|
|
||||||
// if (!_ChildrenLoaded)
|
|
||||||
// {
|
|
||||||
// this.Nodes.Clear();
|
|
||||||
// "".TrimEnd("\r\n".ToCharArray());
|
|
||||||
// IList ol = _VEObject.GetChildren();
|
|
||||||
// if (ol != null)
|
|
||||||
// {
|
|
||||||
// this.TreeView.BeginUpdate();
|
|
||||||
// DateTime tStart = DateTime.Now;
|
|
||||||
// //VETree[] tmpa = new VETree[ol.Count];
|
|
||||||
// //tStart = tNext(tStart, "Allocate Array");
|
|
||||||
// ////for (int i = 0; i < ol.Count; i++) tmpa[i] = new VETree();
|
|
||||||
// ////tStart = tNext(tStart, "Allocate Nodes");
|
|
||||||
// //int ii = 0;
|
|
||||||
// //foreach (IVEReadOnlyItem o in ol)
|
|
||||||
// //{
|
|
||||||
// // try
|
|
||||||
// // {
|
|
||||||
// // tmpa[ii++] = new VETree(o);
|
|
||||||
// // //tmpa[ii++].VEObject = o;
|
|
||||||
// // }
|
|
||||||
// // catch (Exception ex)
|
|
||||||
// // {
|
|
||||||
// // Console.WriteLine("{0}\r\n{1}", ex.Message, ex.InnerException);
|
|
||||||
// // }
|
|
||||||
// //}
|
|
||||||
// //tStart = tNext(tStart, "Set Nodes");
|
|
||||||
// //for (int i = 0; i < ol.Count; i++) tmpa[i].ResetNode();
|
|
||||||
// //tStart = tNext(tStart, "Reset Nodes");
|
|
||||||
// //this.Nodes.AddRange(tmpa);
|
|
||||||
// //tStart = tNext(tStart, "Add Range");
|
|
||||||
// this.TreeView.DrawMode = TreeViewDrawMode.OwnerDrawAll;
|
|
||||||
// foreach (IVEReadOnlyItem o in ol)
|
|
||||||
// {
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// VETree tmp = new VETree(o);
|
|
||||||
// //tmp.VEObject = o;
|
|
||||||
// this.Nodes.Add(tmp);
|
|
||||||
// }
|
|
||||||
// catch (Exception ex)
|
|
||||||
// {
|
|
||||||
// Console.WriteLine("{0}\r\n{1}", ex.Message, ex.InnerException);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// tStart = tNext(tStart, "Set Nodes");
|
|
||||||
// this.TreeView.DrawMode = TreeViewDrawMode.Normal;
|
|
||||||
// tStart = tNext(tStart, "DrawMode");
|
|
||||||
// this.TreeView.EndUpdate();
|
|
||||||
// tStart = tNext(tStart, "End Update");
|
|
||||||
// this.TreeView.Refresh();
|
|
||||||
// tStart = tNext(tStart, "Refresh");
|
|
||||||
// }
|
|
||||||
// _ChildrenLoaded = true;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user