CSLA Config cleanup

This commit is contained in:
2026-08-28 11:15:35 -04:00
parent d0587706a2
commit f88f8a1c75
27 changed files with 566 additions and 2412 deletions
@@ -1,6 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel; using System.ComponentModel;
namespace VEPROMS.CSLA.Library namespace VEPROMS.CSLA.Library
@@ -11,35 +9,23 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))] [TypeConverter(typeof(ExpandableObjectConverter))]
public class AnnotationConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged public class AnnotationConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{ {
private XMLProperties _Xp; private readonly XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
public AnnotationConfig(string xml) public AnnotationConfig(string xml)
{ {
if (xml == string.Empty) xml = "<Config/>"; if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml); _Xp = new XMLProperties(xml);
} }
public AnnotationConfig() public AnnotationConfig() => _Xp = new XMLProperties();
{ public override string ToString()
_Xp = new XMLProperties();
}
public override string ToString()
{ {
string s = _Xp.ToString(); string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty; if (s == "<Config/>" || s == "<Config></Config>") return string.Empty;
return s; return s;
} }
public string GetValue(string group, string item) public string GetValue(string group, string item) => _Xp[group, item];
{ public void SetValue(string group, string item, string newvalue) => _Xp[group, item] = newvalue;
return _Xp[group, item];
}
public void SetValue(string group, string item, string newvalue)
{
_Xp[group, item] = newvalue;
}
} }
} }
@@ -1,6 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel; using System.ComponentModel;
namespace VEPROMS.CSLA.Library namespace VEPROMS.CSLA.Library
@@ -9,12 +7,9 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))] [TypeConverter(typeof(ExpandableObjectConverter))]
public class AnnotationTypeConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged public class AnnotationTypeConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{ {
private XMLProperties _Xp; private readonly XMLProperties _Xp;
private XMLProperties Xp
{ public AnnotationTypeConfig(string xml)
get { return _Xp; }
}
public AnnotationTypeConfig(string xml)
{ {
if (xml == string.Empty) xml = "<Config/>"; if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml); _Xp = new XMLProperties(xml);
@@ -48,16 +43,16 @@ namespace VEPROMS.CSLA.Library
{ {
string s = _Xp["PrintableText", "XLocation"]; string s = _Xp["PrintableText", "XLocation"];
if (s == string.Empty) return 0; if (s == string.Empty) return 0;
int tst = 0; int tst;
try try
{ {
tst = int.Parse(s); tst = int.Parse(s);
} }
catch (Exception ex) catch (Exception)
{ {
return 0; return 0;
} }
return int.Parse(s); return tst;
} }
set set
{ {
@@ -1,6 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel; using System.ComponentModel;
namespace VEPROMS.CSLA.Library namespace VEPROMS.CSLA.Library
@@ -9,21 +7,14 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))] [TypeConverter(typeof(ExpandableObjectConverter))]
public class AssociationConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged public class AssociationConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{ {
#region DynamicTypeDescriptor #region DynamicTypeDescriptor
internal override bool IsReadOnly internal override bool IsReadOnly => _Association == null;
{ #endregion
get { return _Association == null; } #region XML
} private readonly XMLProperties _Xp;
#endregion
#region XML
private XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
#endregion #endregion
#region Constructors #region Constructors
private Association _Association; private readonly Association _Association;
public AssociationConfig(Association association) public AssociationConfig(Association association)
{ {
_Association = association; _Association = association;
@@ -31,7 +22,7 @@ namespace VEPROMS.CSLA.Library
if (xml == string.Empty) xml = "<Config/>"; if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml); _Xp = new XMLProperties(xml);
} }
private AssociationInfo _AssociationInfo; private readonly AssociationInfo _AssociationInfo;
public AssociationConfig(AssociationInfo association) public AssociationConfig(AssociationInfo association)
{ {
_AssociationInfo = association; _AssociationInfo = association;
@@ -39,24 +30,17 @@ namespace VEPROMS.CSLA.Library
if (xml == string.Empty) xml = "<Config/>"; if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml); _Xp = new XMLProperties(xml);
} }
public AssociationConfig(string xml) public AssociationConfig(string xml) => _Xp = new XMLProperties(xml);
{ public AssociationConfig()
_Xp = new XMLProperties(xml);
}
public AssociationConfig()
{ {
string xml = "<Config/>"; string xml = "<Config/>";
_Xp = new XMLProperties(xml); _Xp = new XMLProperties(xml);
} }
internal string GetValue(string group, string item) internal string GetValue(string group, string item) => _Xp[group, item];
{ #endregion
return _Xp[group, item]; public Association MyAssociation => _Association;
} #region RODefaults // From proc.ini
#endregion [Category("Referenced Objects")]
public Association MyAssociation
{ get { return _Association; } }
#region RODefaults // From proc.ini
[Category("Referenced Objects")]
[DisplayName("Default RO Prefix")] [DisplayName("Default RO Prefix")]
[RefreshProperties(RefreshProperties.All)] [RefreshProperties(RefreshProperties.All)]
[Description("Setpoint Prefix")] [Description("Setpoint Prefix")]
@@ -146,9 +130,8 @@ namespace VEPROMS.CSLA.Library
public override string ToString() public override string ToString()
{ {
string s = _Xp.ToString(); string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></config>") return string.Empty; return s == "<Config/>" || s == "<Config></config>" ? string.Empty : s;
return s; }
} #endregion
#endregion }
}
} }
@@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Drawing; using System.Drawing;
@@ -8,9 +7,9 @@ namespace VEPROMS.CSLA.Library
{ {
public static class ColorConfig public static class ColorConfig
{ {
private static Regex byARGB = new Regex(@"Color \[A=([0-9]*), R=([0-9]*), G=([0-9]*), B=([0-9]*)\]"); private static readonly Regex byARGB = new Regex(@"Color \[A=([0-9]*), R=([0-9]*), G=([0-9]*), B=([0-9]*)\]");
private static Regex byName = new Regex(@"Color \[(.*)\]"); private static readonly Regex byName = new Regex(@"Color \[(.*)\]");
private static Regex byRGB = new Regex(@"[0-9]*,[0-9]*,[0-9]*"); private static readonly Regex byRGB = new Regex(@"[0-9]*,[0-9]*,[0-9]*");
public static Color ColorFromString(string sColor) public static Color ColorFromString(string sColor)
{ {
if (sColor == string.Empty) return Color.Empty; if (sColor == string.Empty) return Color.Empty;
@@ -59,12 +58,7 @@ namespace VEPROMS.CSLA.Library
return ConvertRGBToName[tmp.Name]; return ConvertRGBToName[tmp.Name];
return tmp; return tmp;
} }
public static Color FindKnownColor(Color tmp) public static Color FindKnownColor(Color tmp) => ConvertRGBToName.ContainsKey(tmp.Name) ? ConvertRGBToName[tmp.Name] : tmp;
{
if (ConvertRGBToName.ContainsKey(tmp.Name))
return ConvertRGBToName[tmp.Name];
return tmp;
}
} }
} }
@@ -1,13 +1,8 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel; using System.ComponentModel;
using DescriptiveEnum; using DescriptiveEnum;
namespace VEPROMS.CSLA.Library namespace VEPROMS.CSLA.Library
{ {
//class ConfigEnum
//{
//C2022-004 Added option for Unit Specific Watermark //C2022-004 Added option for Unit Specific Watermark
[TypeConverter(typeof(EnumDescConverter))] [TypeConverter(typeof(EnumDescConverter))]
public enum PrintWatermark : int public enum PrintWatermark : int
File diff suppressed because it is too large Load Diff
@@ -1,9 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing;
using System.Text.RegularExpressions;
namespace VEPROMS.CSLA.Library namespace VEPROMS.CSLA.Library
{ {
@@ -12,15 +8,11 @@ namespace VEPROMS.CSLA.Library
public class DocumentConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged public class DocumentConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{ {
#region XML #region XML
private XMLProperties _Xp; private readonly XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
#endregion #endregion
#region Constructors #region Constructors
public Document _Document; public Document _Document;
private DocumentInfo _DocumentInfo; private readonly DocumentInfo _DocumentInfo;
public DocumentConfig(Document document) public DocumentConfig(Document document)
{ {
_Document = document; _Document = document;
@@ -35,13 +27,10 @@ namespace VEPROMS.CSLA.Library
if (xml == string.Empty) xml = "<Config/>"; if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml); _Xp = new XMLProperties(xml);
} }
internal string GetValue(string group, string item) internal string GetValue(string group, string item) => _Xp[group, item];
{ #endregion
return _Xp[group, item]; #region Properties
} [Category("General")]
#endregion
#region Properties
[Category("General")]
[DisplayName("Name")] [DisplayName("Name")]
[Description("Name")] [Description("Name")]
public string Name public string Name
@@ -100,48 +89,13 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("History_OriginalFileName"); OnPropertyChanged("History_OriginalFileName");
} }
} }
// RHM 20110415 - These are now stored in the PDF table.
//[Category("Printing")]
//[DisplayName("Length")]
//[Description("Length of Document in Full and Partial Pages")]
//public float Printing_Length
//{
// get
// {
// string s = _Xp["Printing", "Length"];// get the saved value
// return float.Parse(s);
// }
// set
// {
// _Xp["Printing", "Length"] = string.Format("{0:0.0000}", value);
// OnPropertyChanged("Printing_Length");
// }
//}
//[Category("Printing")]
//[DisplayName("Color")]
//[Description("Color of Document Text")]
//public Color Printing_Color
//{
// get
// {
// string sColor = _Xp["Printing", "Color"];
// return ColorConfig.ColorFromString(sColor);
// }
// set
// {
// _Xp["Printing", "Color"] = value.ToString();
// OnPropertyChanged("Printing_Color");
// }
//}
#endregion #endregion
#region ToString #region ToString
public override string ToString() public override string ToString()
{ {
string s = _Xp.ToString(); string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty; return s == "<Config/>" || s == "<Config></Config>" ? string.Empty : s;
return s; }
} #endregion
#endregion }
}
} }
@@ -1,17 +1,13 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel; using System.ComponentModel;
using System.Xml;
using System.Xml.Serialization; using System.Xml.Serialization;
using System.Xml.Schema;
namespace VEPROMS.CSLA.Library namespace VEPROMS.CSLA.Library
{ {
public class DynamicPropertyDescriptor : PropertyDescriptor public class DynamicPropertyDescriptor : PropertyDescriptor
{ {
private PropertyDescriptor _BasePropertyDescriptor; private readonly PropertyDescriptor _BasePropertyDescriptor;
private ConfigDynamicTypeDescriptor _Instance; private readonly ConfigDynamicTypeDescriptor _Instance;
public DynamicPropertyDescriptor(ConfigDynamicTypeDescriptor instance, PropertyDescriptor basePropertyDescriptor) public DynamicPropertyDescriptor(ConfigDynamicTypeDescriptor instance, PropertyDescriptor basePropertyDescriptor)
: base(basePropertyDescriptor) : base(basePropertyDescriptor)
@@ -37,16 +33,15 @@ namespace VEPROMS.CSLA.Library
{ _BasePropertyDescriptor.SetValue(component, value); } { _BasePropertyDescriptor.SetValue(component, value); }
} }
[Serializable()] [Serializable()]
public class ConfigDynamicTypeDescriptor //: ICustomTypeDescriptor//, ISupportInitialize public class ConfigDynamicTypeDescriptor
{ {
#region Events #region Events
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(String info) protected void OnPropertyChanged(String info)
{ {
_IsDirty = true; _IsDirty = true;
if (PropertyChanged != null) PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(info));
PropertyChanged(this, new PropertyChangedEventArgs(info)); }
}
[NonSerialized] [NonSerialized]
private bool _IsDirty = false; private bool _IsDirty = false;
[XmlIgnore] [XmlIgnore]
@@ -57,54 +52,11 @@ namespace VEPROMS.CSLA.Library
set { _IsDirty = value; } set { _IsDirty = value; }
} }
#endregion #endregion
[NonSerialized]
private PropertyDescriptorCollection dynamicProps;
private bool _IsReadOnly = false; private bool _IsReadOnly = false;
internal virtual bool IsReadOnly internal virtual bool IsReadOnly
{ {
get { return _IsReadOnly; } get { return _IsReadOnly; }
set { _IsReadOnly = value; } set { _IsReadOnly = value; }
} }
public ConfigDynamicTypeDescriptor() { }
#region "TypeDescriptor Implementation"
public String GetClassName()
{ return TypeDescriptor.GetClassName(this, true); }
public AttributeCollection GetAttributes()
{ return TypeDescriptor.GetAttributes(this, true); }
public String GetComponentName()
{ return TypeDescriptor.GetComponentName(this, true); }
public TypeConverter GetConverter()
{ return TypeDescriptor.GetConverter(this, true); }
public EventDescriptor GetDefaultEvent()
{ return TypeDescriptor.GetDefaultEvent(this, true); }
public PropertyDescriptor GetDefaultProperty()
{ return TypeDescriptor.GetDefaultProperty(this, true); }
public object GetEditor(Type editorBaseType)
{ return TypeDescriptor.GetEditor(this, editorBaseType, true); }
public EventDescriptorCollection GetEvents(Attribute[] attributes)
{ return TypeDescriptor.GetEvents(this, attributes, true); }
public EventDescriptorCollection GetEvents()
{ return TypeDescriptor.GetEvents(this, true); }
public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
{
return GetProperties();
}
public PropertyDescriptorCollection GetProperties()
{
if (dynamicProps == null)
{
PropertyDescriptorCollection baseProps = TypeDescriptor.GetProperties(this, true);
dynamicProps = new PropertyDescriptorCollection(null);
foreach (PropertyDescriptor oProp in baseProps)
{
dynamicProps.Add(new DynamicPropertyDescriptor(this, oProp));
}
}
return dynamicProps;
}
public object GetPropertyOwner(PropertyDescriptor pd)
{ return this; }
#endregion
} }
} }
@@ -13,8 +13,6 @@
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;
using System.Reflection; using System.Reflection;
using System.Collections; using System.Collections;
using System.Data; using System.Data;
@@ -97,26 +95,26 @@ namespace DescriptiveEnum
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
{ {
if(value is Enum && destinationType == typeof(string)) if(value is Enum myenum && destinationType == typeof(string))
{ {
return EnumDescConverter.GetEnumDescription((Enum)value); return EnumDescConverter.GetEnumDescription(myenum);
} }
if(value is string && destinationType == typeof(string)) if(value is string mystr && destinationType == typeof(string))
{ {
return EnumDescConverter.GetEnumDescription(myVal, (string)value); return EnumDescConverter.GetEnumDescription(myVal, mystr);
} }
return base.ConvertTo (context, culture, value, destinationType); return base.ConvertTo (context, culture, value, destinationType);
} }
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{ {
if(value is string) if(value is string mystr)
{ {
return EnumDescConverter.GetEnumValue(myVal, (string)value); return EnumDescConverter.GetEnumValue(myVal, mystr);
} }
if(value is Enum) if(value is Enum myenum)
{ {
return EnumDescConverter.GetEnumDescription((Enum)value); return EnumDescConverter.GetEnumDescription(myenum);
} }
return base.ConvertFrom (context, culture, value); return base.ConvertFrom (context, culture, value);
} }
@@ -125,7 +123,8 @@ namespace DescriptiveEnum
return true; return true;
} }
public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0059:Unnecessary assignment of a value", Justification = "Keeping attributes for future extensions")]
public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{ {
ArrayList values = new ArrayList(); ArrayList values = new ArrayList();
FieldInfo[] fis = myVal.GetFields(); FieldInfo[] fis = myVal.GetFields();
@@ -133,7 +132,6 @@ namespace DescriptiveEnum
{ {
DescriptionAttribute[] attributes =(DescriptionAttribute[])fi.GetCustomAttributes( DescriptionAttribute[] attributes =(DescriptionAttribute[])fi.GetCustomAttributes(
typeof(DescriptionAttribute), false); typeof(DescriptionAttribute), false);
//if (attributes.Length > 0)
if (fi.Name != "value__") if (fi.Name != "value__")
values.Add(fi.GetValue(fi.Name)); values.Add(fi.GetValue(fi.Name));
} }
@@ -1,6 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection; using System.Reflection;
using System.ComponentModel; using System.ComponentModel;
@@ -8,23 +6,13 @@ namespace VEPROMS.CSLA.Library
{ {
public class EnumDetail<T> public class EnumDetail<T>
{ {
private T _EValue; public T EValue { get; set; }
public T EValue
{
get { return _EValue; }
set { _EValue = value; }
}
private string _Name;
public string Name public string Name { get; set; }
public EnumDetail(string name, T eValue)
{ {
get { return _Name; } Name = name;
set { _Name = value; } EValue = eValue;
}
public EnumDetail(string name, T eValue)
{
_Name = name;
_EValue = eValue;
} }
public static EnumDetail<T>[] Details() public static EnumDetail<T>[] Details()
{ {
+22 -250
View File
@@ -1,29 +1,18 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using DescriptiveEnum;
namespace VEPROMS.CSLA.Library namespace VEPROMS.CSLA.Library
{ {
[Serializable] [Serializable]
[TypeConverter(typeof(ExpandableObjectConverter))] [TypeConverter(typeof(ExpandableObjectConverter))]
//public class FolderConfig : INotifyPropertyChanged
public class FolderConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged public class FolderConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{ {
#region DynamicTypeDescriptor #region DynamicTypeDescriptor
internal override bool IsReadOnly internal override bool IsReadOnly => _Folder == null;
{ #endregion
get { return _Folder == null; } #region XML
} private readonly XMLProperties _Xp;
#endregion
#region XML
private XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
#endregion #endregion
#region Constructors #region Constructors
//PROPGRID: Hide ParentLookup //PROPGRID: Hide ParentLookup
@@ -33,19 +22,8 @@ namespace VEPROMS.CSLA.Library
get { return _Xp.ParentLookup; } get { return _Xp.ParentLookup; }
set { _Xp.ParentLookup = value; } set { _Xp.ParentLookup = value; }
} }
//PROPGRID: Hide AncestorLookup private readonly Folder _Folder;
//PROPGRID: Needed to comment out [NonSerialized] in order to hide this field from the property grid private readonly FolderInfo _FolderInfo;
//[NonSerialized]
//[Browsable(false)]
//private bool _AncestorLookup;
//[Browsable(false)]
//public bool AncestorLookup
//{
// get { return _AncestorLookup; }
// set { _AncestorLookup = value; }
//}
private Folder _Folder;
private FolderInfo _FolderInfo;
public FolderConfig(Folder folder) public FolderConfig(Folder folder)
{ {
_Folder = folder; _Folder = folder;
@@ -75,18 +53,6 @@ namespace VEPROMS.CSLA.Library
return false; return false;
} }
} }
//private string Xp_LookInAncestorFolderInfo(object sender, XMLPropertiesArgs args)
//{
// if (args.AncestorLookup || ParentLookup)
// {
// for (FolderInfo folder = _FolderInfo.MyParent; folder != null; folder = folder.MyParent)
// {
// string retval = folder.FolderConfig.GetValue(args.Group, args.Item);
// if (retval != string.Empty) return retval;
// }
// }
// return string.Empty;
//}
public FolderConfig(FolderInfo folderInfo) public FolderConfig(FolderInfo folderInfo)
{ {
_FolderInfo = folderInfo; _FolderInfo = folderInfo;
@@ -100,21 +66,12 @@ namespace VEPROMS.CSLA.Library
if (xml == string.Empty) xml = "<Config/>"; if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml); _Xp = new XMLProperties(xml);
} }
public FolderConfig() public FolderConfig() => _Xp = new XMLProperties("<Config/>");
{ public string GetValue(string group, string item) => _Xp[group, item];
_Xp = new XMLProperties("<Config/>"); public void SetValue(string group, string item, string newvalue) => _Xp[group, item] = newvalue;
} #endregion
public string GetValue(string group, string item) #region Local Properties
{ [Category("General")]
return _Xp[group, item];
}
public void SetValue(string group, string item, string newvalue)
{
_Xp[group, item] = newvalue;
}
#endregion
#region Local Properties
[Category("General")]
[DisplayName("Name")] [DisplayName("Name")]
[Description("Name")] [Description("Name")]
public string Name public string Name
@@ -189,7 +146,6 @@ namespace VEPROMS.CSLA.Library
if (_Folder != null) if (_Folder != null)
{ {
_Folder.MyFormat = FormatList.ToFormat(value); _Folder.MyFormat = FormatList.ToFormat(value);
//_Folder.ActiveFormat = null;
} }
} }
} }
@@ -206,24 +162,17 @@ namespace VEPROMS.CSLA.Library
return null; return null;
} }
} }
public Folder MyFolder public Folder MyFolder => _Folder;
{ get { return _Folder; } } public FolderInfo MyFolderInfo => _FolderInfo;
public FolderInfo MyFolderInfo #endregion
{ get { return _FolderInfo; } } #region ToString
#endregion public override string ToString()
#region ToString
public override string ToString()
{ {
string s = _Xp.ToString(); string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty; return s == "<Config/>" || s == "<Config></Config>" ? string.Empty : s;
return s; }
} #endregion
#endregion #region GraphicsCategory // From veproms.ini
#region GraphicsCategory // From veproms.ini
public bool CanWrite(string str)
{
return true;
}
[Category("Referenced Objects")] [Category("Referenced Objects")]
[DisplayName("Graphic File Extension")] [DisplayName("Graphic File Extension")]
[RefreshProperties(RefreshProperties.All)] [RefreshProperties(RefreshProperties.All)]
@@ -304,103 +253,6 @@ namespace VEPROMS.CSLA.Library
} }
} }
#endregion #endregion
//#region ColorCategory // From veproms.ini
//// ** Note that not all possibilities from 16-bit will be added here, until
//// ** it is determined how these will be used
//// ** If this is used (unhidden), then we need to add logic to blank setting if the value
//// ** we are saving is the same as the parent's value.
////PROPGRID: Hide Editor Color for ROs
//[Category("Editor Settings")]
//[Browsable(false)]
//[DisplayName("Step Editor Colors - Referenced Objects")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("Color used to highlight an RO in procedure text")]
//public string Color_ro
//{
// get
// {
// return _Xp["Color", "ro"];
// }
// set
// {
// _Xp["Color", "ro"] = value;
// OnPropertyChanged("Color_ro");
// }
//}
////PROPGRID: Hide Editor Color for Transitions
//[Category("Editor Settings")]
//[Browsable(false)]
//[DisplayName("Step Editor Colors - Transitions")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("Color used to highlight a Transition in procedure text")]
//public string Color_transition
//{
// get
// {
// return _Xp["Color", "transition"];
// }
// set
// {
// _Xp["Color", "transition"] = value;
// OnPropertyChanged("Color_transition");
// }
//}
////PROPGRID: Hide Active Text Background Color
//[Category("Editor Settings")]
//[Browsable(false)]
//[DisplayName("Step Editor Colors - Active Background")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("editbackground")]
//public string Color_editbackground
//{
// get
// {
// return _Xp["Color", "editbackground"];
// }
// set
// {
// _Xp["Color", "editbackground"] = value;
// OnPropertyChanged("Color_editbackground");
// }
//}
////PROPGRID: Hide color setting for Black
//[Category("Color")]
//[Browsable(false)]
//[DisplayName("black")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("black")]
//public string Color_black
//{
// get
// {
// return _Xp["Color", "black"];
// }
// set
// {
// _Xp["Color", "black"] = value;
// OnPropertyChanged("Color_black");
// }
//}
////PROPGRID: Hide Color Setting for Blue
//[Category("Color")]
//[Browsable(false)]
//[DisplayName("blue")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("blue")]
//public string Color_blue
//{
// get
// {
// return _Xp["Color", "blue"];
// }
// set
// {
// _Xp["Color", "blue"] = value;
// OnPropertyChanged("Color_blue");
// }
//}
//#endregion // From veproms.ini
#region SystemPrintCategory // From veproms.ini #region SystemPrintCategory // From veproms.ini
[Category("Print Settings")] [Category("Print Settings")]
[DisplayName("Override Underline Thickness (dots)")] [DisplayName("Override Underline Thickness (dots)")]
@@ -635,20 +487,6 @@ namespace VEPROMS.CSLA.Library
} }
#endregion #endregion
#region FormatCategory #region FormatCategory
//[TypeConverter(typeof(EnumDescConverter))]
//public enum FormatColumns : int
//{
// [Description("Format Default")]
// Default = 0,
// [Description("Single Column")]
// OneColumn,
// [Description("Dual Column")]
// TwoColumn,
// [Description("Triple Column")]
// ThreeColumn,
// [Description("Quad Column")]
// FourColumns
//}
[Category("Editor Settings")] [Category("Editor Settings")]
[DisplayName("Step Editor Columns")] [DisplayName("Step Editor Columns")]
[RefreshProperties(RefreshProperties.All)] [RefreshProperties(RefreshProperties.All)]
@@ -726,10 +564,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Print_NumCopies"); OnPropertyChanged("Print_NumCopies");
} }
} }
//public enum PrintPagination : int
//{
// Free = 0, Fixed, Auto
//}
[Category("Print Settings")] [Category("Print Settings")]
[DisplayName("Pagination")] [DisplayName("Pagination")]
[RefreshProperties(RefreshProperties.All)] [RefreshProperties(RefreshProperties.All)]
@@ -767,13 +601,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Print_Pagination"); OnPropertyChanged("Print_Pagination");
} }
} }
//[TypeConverter(typeof(EnumDescConverter))]
//public enum PrintWatermark : int
//{
// None = 0, Reference, Draft, Master, Sample,
// [Description("Information Only")]
// InformationOnly
//}
[Category("Print Settings")] [Category("Print Settings")]
[DisplayName("Watermark")] [DisplayName("Watermark")]
@@ -812,23 +639,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Print_Watermark"); OnPropertyChanged("Print_Watermark");
} }
} }
// Change Bar Use from 16-bit code:
// No Default
// Without Change Bars
// With Default Change Bars
// With User Specified Change Bars
//[TypeConverter(typeof(EnumDescConverter))]
//public enum PrintChangeBar : int
//{
// [Description("Select Before Printing")]
// SelectBeforePrinting = 0,
// [Description("Without Change Bars")]
// Without,
// [Description("With Default Change Bars")]
// WithDefault,
// [Description("Use Custom Change Bars")]
// WithUserSpecified
//}
[Category("Format Settings")] [Category("Format Settings")]
[DisplayName("Change Bar")] [DisplayName("Change Bar")]
[RefreshProperties(RefreshProperties.All)] [RefreshProperties(RefreshProperties.All)]
@@ -866,24 +676,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Print_ChangeBar"); OnPropertyChanged("Print_ChangeBar");
} }
} }
// User Specified Change Bar Location from16-bit code:
// With Text
// Outside Box
// AER on LEFT, RNO on Right
// To the Left of Text
//[TypeConverter(typeof(EnumDescConverter))]
//public enum PrintChangeBarLoc : int
//{
// [Description("With Text")]
// WithText = 0,
// [Description("Outside Box")]
// OutsideBox,
// [Description("AER on Left RNO on Right")]
// AERleftRNOright,
// [Description("To the Left of the Text")]
// LeftOfText
//}
[Category("Format Settings")] [Category("Format Settings")]
[DisplayName("Change Bar Position")] [DisplayName("Change Bar Position")]
[RefreshProperties(RefreshProperties.All)] [RefreshProperties(RefreshProperties.All)]
@@ -922,26 +714,6 @@ namespace VEPROMS.CSLA.Library
} }
} }
// Change Bar Text from16-bit code:
// Date and Change ID
// Revision Number
// Change ID
// No Change Bar Message
// User Defined Message
//[TypeConverter(typeof(EnumDescConverter))]
//public enum PrintChangeBarText : int
//{
// [Description("Date and Change ID")]
// DateChgID = 0,
// [Description("Revision Number")]
// RevNum,
// [Description("Change ID")]
// ChgID,
// [Description("No Change Bar Text")]
// None,
// [Description("Custom Change Bar Text")]
// UserDef
//}
[Category("Format Settings")] [Category("Format Settings")]
[DisplayName("Change bar Text Type")] [DisplayName("Change bar Text Type")]
[RefreshProperties(RefreshProperties.All)] [RefreshProperties(RefreshProperties.All)]
+81 -226
View File
@@ -1,15 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.ComponentModel; using System.ComponentModel;
using DescriptiveEnum;
using System.Xml; using System.Xml;
using System.Xml.Serialization; using System.Xml.Serialization;
using System.Xml.Schema; using System.Xml.Schema;
using System.Windows.Forms;
using Volian.Base.Library; using Volian.Base.Library;
using System.Drawing;
namespace VEPROMS.CSLA.Library namespace VEPROMS.CSLA.Library
{ {
@@ -28,13 +23,6 @@ namespace VEPROMS.CSLA.Library
get { return false; } get { return false; }
} }
#endregion #endregion
#region XML
private XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
#endregion
#region Attributes #region Attributes
[XmlAttribute("Name")] [XmlAttribute("Name")]
private string _Name; private string _Name;
@@ -69,27 +57,14 @@ namespace VEPROMS.CSLA.Library
} }
#endregion Elements #endregion Elements
#region Constructors #region Constructors
private Format _Format; private readonly Format _Format;
private FormatInfo _FormatInfo; private readonly FormatInfo _FormatInfo;
public FormatConfig(string xml) public FormatConfig(FormatInfo fi) => _FormatInfo = fi;
{ public FormatConfig(Format f) => _Format = f;
if (xml == string.Empty) xml = "<FormatConfig/>"; public FormatConfig() => PlantFormat = new PlantFormatx();
} #endregion Constructors
public FormatConfig(FormatInfo fi) #region Serialize
{ public string ConvertToString()
_FormatInfo = fi;
}
public FormatConfig(Format f)
{
_Format = f;
}
public FormatConfig()
{
PlantFormat = new PlantFormatx();
}
#endregion Constructors
#region Serialize
public string ConvertToString()
{ {
return GenericSerializer<FormatConfig>.StringSerialize(this); return GenericSerializer<FormatConfig>.StringSerialize(this);
} }
@@ -131,11 +106,8 @@ namespace VEPROMS.CSLA.Library
{ {
} }
public override string ToString() public override string ToString() => "Plant Format";
{ }
return "Plant Format";
}
}
#endregion PlantFormat #endregion PlantFormat
#region FormatData #region FormatData
// FormatData maps to the PlantFormat/Format data and contains properties & data objects that are implemented for the user to // FormatData maps to the PlantFormat/Format data and contains properties & data objects that are implemented for the user to
@@ -202,11 +174,8 @@ namespace VEPROMS.CSLA.Library
{ {
ReplaceStrData = new ReplaceStrData(); ReplaceStrData = new ReplaceStrData();
} }
public override string ToString() public override string ToString() => "Format Data";
{ }
return "Format Data";
}
}
#endregion FormatData #endregion FormatData
#region Flags #region Flags
[Serializable] [Serializable]
@@ -242,27 +211,15 @@ namespace VEPROMS.CSLA.Library
[Editor(typeof(PropGridCollEditor), typeof(System.Drawing.Design.UITypeEditor))] [Editor(typeof(PropGridCollEditor), typeof(System.Drawing.Design.UITypeEditor))]
public class ReplaceStrData : List<ReplaceStr> public class ReplaceStrData : List<ReplaceStr>
{ {
[Browsable(false)] [Browsable(false)]
public int Capacity { get { return base.Capacity; } } public new int Capacity => base.Capacity;
[Browsable(false)] [Browsable(false)]
public int Count { get { return base.Count; } } public new int Count => base.Count;
public ReplaceStr this[int index] public new ReplaceStr this[int index] => (ReplaceStr)base[index];
{ public string ConvertToString() => GenericSerializer<ReplaceStrData>.StringSerialize(this);
get { return (ReplaceStr)base[index]; } public override string ToString() => $"Replace Words List Count = {base.Count}";
} public static ReplaceStrData Get(string xml) => GenericSerializer<ReplaceStrData>.StringDeserialize(xml);
public string ConvertToString() }
{
return GenericSerializer<ReplaceStrData>.StringSerialize(this);
}
public override string ToString()
{
return "Replace Words List Count = " + base.Count.ToString();
}
public static ReplaceStrData Get(string xml)
{
return GenericSerializer<ReplaceStrData>.StringDeserialize(xml);
}
}
#endregion ReplaceStrData #endregion ReplaceStrData
#region ReplaceStr #region ReplaceStr
@@ -303,19 +260,10 @@ namespace VEPROMS.CSLA.Library
public ReplaceStr() public ReplaceStr()
{ {
} }
public string ConvertToString() public string ConvertToString() => GenericSerializer<ReplaceStr>.StringSerialize(this);
{ public override string ToString() => ReplaceWord;
return GenericSerializer<ReplaceStr>.StringSerialize(this); public static ReplaceStr Get(string xml) => GenericSerializer<ReplaceStr>.StringDeserialize(xml);
} }
public override string ToString()
{
return ReplaceWord;
}
public static ReplaceStr Get(string xml)
{
return GenericSerializer<ReplaceStr>.StringDeserialize(xml);
}
}
#endregion ReplaceStr #endregion ReplaceStr
#region CheckOffHeaders (list) #region CheckOffHeaders (list)
[Serializable] [Serializable]
@@ -323,23 +271,14 @@ namespace VEPROMS.CSLA.Library
[Editor(typeof(PropGridCollEditor), typeof(System.Drawing.Design.UITypeEditor))] [Editor(typeof(PropGridCollEditor), typeof(System.Drawing.Design.UITypeEditor))]
public class CheckOffHeaderList : List<CheckOffHeader> public class CheckOffHeaderList : List<CheckOffHeader>
{ {
[Browsable(false)] [Browsable(false)]
public int Capacity { get { return base.Capacity; } } public new int Capacity => base.Capacity;
[Browsable(false)] [Browsable(false)]
public int Count { get { return base.Count; } } public new int Count { get { return base.Count; } }
public CheckOffHeader this[int index] public new CheckOffHeader this[int index] => (CheckOffHeader)base[index];
{ public string ConvertToString() => GenericSerializer<CheckOffHeaderList>.StringSerialize(this);
get { return (CheckOffHeader)base[index]; } public override string ToString() => $"CheckOffHeader Count = {base.Count}";
} }
public string ConvertToString()
{
return GenericSerializer<CheckOffHeaderList>.StringSerialize(this);
}
public override string ToString()
{
return "CheckOffHeader Count = " + base.Count.ToString();
}
}
#endregion CheckOffHeaders #endregion CheckOffHeaders
#region CheckOffHeader #region CheckOffHeader
[Serializable] [Serializable]
@@ -382,15 +321,9 @@ namespace VEPROMS.CSLA.Library
public CheckOffHeader() public CheckOffHeader()
{ {
} }
public string ConvertToString() public string ConvertToString() => GenericSerializer<CheckOffHeader>.StringSerialize(this);
{ public override string ToString() => CheckOffHeading;
return GenericSerializer<CheckOffHeader>.StringSerialize(this); }
}
public override string ToString()
{
return CheckOffHeading;
}
}
#endregion CheckOffHeader #endregion CheckOffHeader
#region CheckOffs (list) #region CheckOffs (list)
[Serializable] [Serializable]
@@ -399,22 +332,13 @@ namespace VEPROMS.CSLA.Library
public class CheckOffList : List<CheckOff> public class CheckOffList : List<CheckOff>
{ {
[Browsable(false)] [Browsable(false)]
public int Capacity { get { return base.Capacity; } } public new int Capacity { get { return base.Capacity; } }
[Browsable(false)] [Browsable(false)]
public int Count { get { return base.Count; } } public new int Count { get { return base.Count; } }
public CheckOff this[int index] public new CheckOff this[int index] => (CheckOff)base[index];
{ public string ConvertToString() => GenericSerializer<CheckOffList>.StringSerialize(this);
get { return (CheckOff)base[index]; } public override string ToString() => $"CheckOff Count = {base.Count}";
} }
public string ConvertToString()
{
return GenericSerializer<CheckOffList>.StringSerialize(this);
}
public override string ToString()
{
return "CheckOff Count = " + base.Count.ToString();
}
}
#endregion CheckOffs #endregion CheckOffs
#region CheckOff #region CheckOff
[Serializable] [Serializable]
@@ -457,15 +381,9 @@ namespace VEPROMS.CSLA.Library
public CheckOff() public CheckOff()
{ {
} }
public string ConvertToString() public string ConvertToString() => GenericSerializer<CheckOff>.StringSerialize(this);
{ public override string ToString() => MenuItem;
return GenericSerializer<CheckOff>.StringSerialize(this); }
}
public override string ToString()
{
return MenuItem;
}
}
#endregion CheckOff #endregion CheckOff
#region ShwRplWds #region ShwRplWds
[Serializable] [Serializable]
@@ -508,15 +426,9 @@ namespace VEPROMS.CSLA.Library
public ShwRplWds() public ShwRplWds()
{ {
} }
public string ConvertToString() public string ConvertToString() => GenericSerializer<ShwRplWds>.StringSerialize(this);
{ public override string ToString() => MenuItem;
return GenericSerializer<ShwRplWds>.StringSerialize(this); }
}
public override string ToString()
{
return MenuItem;
}
}
#endregion ShwRplWds #endregion ShwRplWds
#region StepData (list) #region StepData (list)
[Serializable] [Serializable]
@@ -525,26 +437,14 @@ namespace VEPROMS.CSLA.Library
public class StepData : List<Step> public class StepData : List<Step>
{ {
[Browsable(false)] [Browsable(false)]
public int Capacity { get { return base.Capacity; } } public new int Capacity { get { return base.Capacity; } }
[Browsable(false)] [Browsable(false)]
public int Count { get { return base.Count; } } public new int Count { get { return base.Count; } }
public Step this[int index] public new Step this[int index] => (Step)base[index];
{ public string ConvertToString() => GenericSerializer<StepData>.StringSerialize(this);
get { return (Step)base[index]; } public override string ToString() => $"Step Count = {base.Count}";
} public static StepData Get(string xml) => GenericSerializer<StepData>.StringDeserialize(xml);
public string ConvertToString() }
{
return GenericSerializer<StepData>.StringSerialize(this);
}
public override string ToString()
{
return "Step Count = " + base.Count.ToString();
}
public static StepData Get(string xml)
{
return GenericSerializer<StepData>.StringDeserialize(xml);
}
}
#endregion StepData #endregion StepData
#region Step #region Step
[Serializable] [Serializable]
@@ -577,28 +477,16 @@ namespace VEPROMS.CSLA.Library
public Step() public Step()
{ {
} }
public string ConvertToString() public string ConvertToString() => GenericSerializer<Step>.StringSerialize(this);
{ public override string ToString() => Type;
return GenericSerializer<Step>.StringSerialize(this); public static Step Get(string xml) => GenericSerializer<Step>.StringDeserialize(xml);
} }
public override string ToString()
{
return Type;
}
public static Step Get(string xml)
{
return GenericSerializer<Step>.StringDeserialize(xml);
}
}
#endregion Step #endregion Step
#region FontDesc #region FontDesc
[Serializable] [Serializable]
[TypeConverter(typeof(ExpandableObjectConverter))] [TypeConverter(typeof(ExpandableObjectConverter))]
public class FontDesc public class FontDesc
{ {
// The Font object allows the conversion from a windows font back/forth from a string. This is how the
// data is stored in the database, i.e. a string representing the font.
private Font _Font;
[XmlAttribute("Font")] [XmlAttribute("Font")]
[Browsable(false)] [Browsable(false)]
public string Font public string Font
@@ -633,19 +521,10 @@ namespace VEPROMS.CSLA.Library
public FontDesc() public FontDesc()
{ {
} }
public string ConvertToString() public string ConvertToString() => GenericSerializer<FontDesc>.StringSerialize(this);
{ public override string ToString() => "FontDescription";
return GenericSerializer<FontDesc>.StringSerialize(this); public static FontDesc Get(string xml) => GenericSerializer<FontDesc>.StringDeserialize(xml);
} }
public override string ToString()
{
return "FontDescription";
}
public static FontDesc Get(string xml)
{
return GenericSerializer<FontDesc>.StringDeserialize(xml);
}
}
#endregion Font #endregion Font
#region DocStyles #region DocStyles
[Serializable] [Serializable]
@@ -654,22 +533,13 @@ namespace VEPROMS.CSLA.Library
public class DocStyles : List<DocStyle> public class DocStyles : List<DocStyle>
{ {
[Browsable(false)] [Browsable(false)]
public int Capacity { get { return base.Capacity; } } public new int Capacity { get { return base.Capacity; } }
[Browsable(false)] [Browsable(false)]
public int Count { get { return base.Count; } } public new int Count { get { return base.Count; } }
public DocStyle this[int index] public new DocStyle this[int index] => (DocStyle)base[index];
{ public string ConvertToString() => GenericSerializer<DocStyles>.StringSerialize(this);
get { return (DocStyle)base[index]; } public override string ToString() => $"Section Type Count = {base.Count}";
} }
public string ConvertToString()
{
return GenericSerializer<DocStyles>.StringSerialize(this);
}
public override string ToString()
{
return "Section Type Count = " + base.Count.ToString();
}
}
#endregion DocStyles #endregion DocStyles
#region DocStyle #region DocStyle
[Serializable] [Serializable]
@@ -702,15 +572,9 @@ namespace VEPROMS.CSLA.Library
public DocStyle() public DocStyle()
{ {
} }
public string ConvertToString() public string ConvertToString() => GenericSerializer<DocStyle>.StringSerialize(this);
{ public override string ToString() => Name;
return GenericSerializer<DocStyle>.StringSerialize(this); }
}
public override string ToString()
{
return Name;
}
}
#endregion DocStyle #endregion DocStyle
#region Layout #region Layout
[Serializable] [Serializable]
@@ -752,18 +616,12 @@ namespace VEPROMS.CSLA.Library
public Layout() public Layout()
{ {
} }
public string ConvertToString() public string ConvertToString() => GenericSerializer<Layout>.StringSerialize(this);
{ public override string ToString() => "Layout";
return GenericSerializer<Layout>.StringSerialize(this); #region IXmlSerializable members
} // The read & write for these is necessary since they are within same xml element, and one may be empty, so
public override string ToString() // no attribute should be listed in the xml.
{ public void WriteXml(XmlWriter writer)
return "Layout";
}
#region IXmlSerializable members
// The read & write for these is necessary since they are within same xml element, and one may be empty, so
// no attribute should be listed in the xml.
public void WriteXml(XmlWriter writer)
{ {
if (LeftMargin != null) writer.WriteAttributeString("LeftMargin", LeftMargin.ToString()); if (LeftMargin != null) writer.WriteAttributeString("LeftMargin", LeftMargin.ToString());
if (PageLength != null) writer.WriteAttributeString("PageLength", PageLength.ToString()); if (PageLength != null) writer.WriteAttributeString("PageLength", PageLength.ToString());
@@ -780,12 +638,9 @@ namespace VEPROMS.CSLA.Library
} }
} }
public XmlSchema GetSchema() public XmlSchema GetSchema() => (null);
{ #endregion
return (null); }
}
#endregion
}
#endregion Layout #endregion Layout
} }
} }
@@ -7,21 +7,14 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))] [TypeConverter(typeof(ExpandableObjectConverter))]
public class ImageConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged public class ImageConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{ {
#region DynamicTypeDescriptor #region DynamicTypeDescriptor
internal override bool IsReadOnly internal override bool IsReadOnly => _ImageInfo == null;
{ #endregion
get { return _ImageInfo == null; } #region XML
} private readonly XMLProperties _Xp;
#endregion
#region XML
private XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
#endregion #endregion
#region Constructors #region Constructors
private ImageInfo _ImageInfo; private readonly ImageInfo _ImageInfo;
public ImageConfig(ImageInfo imageInfo) public ImageConfig(ImageInfo imageInfo)
{ {
if (imageInfo == null) if (imageInfo == null)
@@ -40,13 +33,10 @@ namespace VEPROMS.CSLA.Library
string xml = "<Config/>"; string xml = "<Config/>";
_Xp = new XMLProperties(xml); _Xp = new XMLProperties(xml);
} }
internal string GetValue(string group, string item) internal string GetValue(string group, string item) => _Xp[group, item];
{ #endregion
return _Xp[group, item]; #region Local Properties
} [Category("Image")]
#endregion
#region Local Properties
[Category("Image")]
[Browsable(false)] [Browsable(false)]
[DisplayName("DataSize")] [DisplayName("DataSize")]
[RefreshProperties(RefreshProperties.All)] [RefreshProperties(RefreshProperties.All)]
@@ -57,16 +47,16 @@ namespace VEPROMS.CSLA.Library
{ {
string s = _Xp["Image", "DataSize"]; string s = _Xp["Image", "DataSize"];
if (s == string.Empty) return 0; if (s == string.Empty) return 0;
int tst = 0; int tst;
try try
{ {
tst = int.Parse(s); tst = int.Parse(s);
} }
catch (Exception ex) catch (Exception)
{ {
return 0; return 0;
} }
return int.Parse(s); return tst;
} }
set set
{ {
@@ -87,16 +77,16 @@ namespace VEPROMS.CSLA.Library
{ {
string s = _Xp["Image", "Width"]; string s = _Xp["Image", "Width"];
if (s == string.Empty) return 0; if (s == string.Empty) return 0;
int tst = 0; int tst;
try try
{ {
tst = int.Parse(s); tst = int.Parse(s);
} }
catch (Exception ex) catch (Exception)
{ {
return 0; return 0;
} }
return int.Parse(s); return tst;
} }
set set
{ {
@@ -117,16 +107,16 @@ namespace VEPROMS.CSLA.Library
{ {
string s = _Xp["Image", "Height"]; string s = _Xp["Image", "Height"];
if (s == string.Empty) return 0; if (s == string.Empty) return 0;
int tst = 0; int tst;
try try
{ {
tst = int.Parse(s); tst = int.Parse(s);
} }
catch (Exception ex) catch (Exception)
{ {
return 0; return 0;
} }
return int.Parse(s); return tst;
} }
set set
{ {
@@ -141,9 +131,8 @@ namespace VEPROMS.CSLA.Library
public override string ToString() public override string ToString()
{ {
string s = _Xp.ToString(); string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty; return s == "<Config/>" || s == "<Config></Config>" ? string.Empty : s;
return s; }
} #endregion
#endregion }
}
} }
+40 -174
View File
@@ -1,8 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel; using System.ComponentModel;
using DescriptiveEnum;
using System.Xml; using System.Xml;
namespace VEPROMS.CSLA.Library namespace VEPROMS.CSLA.Library
@@ -11,18 +8,11 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))] [TypeConverter(typeof(ExpandableObjectConverter))]
public class ProcedureConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged, IItemConfig public class ProcedureConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged, IItemConfig
{ {
#region DynamicTypeDescriptor #region DynamicTypeDescriptor
internal override bool IsReadOnly internal override bool IsReadOnly => _Procedure == null;
{ #endregion
get { return _Procedure == null; } #region XML
} private readonly XMLProperties _Xp;
#endregion
#region XML
private XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
#endregion #endregion
#region Constructors #region Constructors
//PROPGRID: Hide ParentLookup //PROPGRID: Hide ParentLookup
@@ -32,24 +22,14 @@ namespace VEPROMS.CSLA.Library
get { return _Xp.ParentLookup; } get { return _Xp.ParentLookup; }
set { _Xp.ParentLookup = value; } set { _Xp.ParentLookup = value; }
} }
//PROPGRID: Needed to comment out [NonSerialized] in order to hide AncestorLookup from property grid private readonly Procedure _Procedure;
//[NonSerialized] private readonly ProcedureInfo _ProcedureInfo;
//private bool _AncestorLookup;
////PROPGRID: Hide AncestorLookup
//[Browsable(false)]
//public bool AncestorLookup
//{
// get { return _AncestorLookup; }
// set { _AncestorLookup = value; }
//}
private Procedure _Procedure;
private ProcedureInfo _ProcedureInfo;
public ProcedureConfig(Procedure procedure) public ProcedureConfig(Procedure procedure)
{ {
_Procedure = procedure; _Procedure = procedure;
string xml = procedure.MyContent.Config; string xml = procedure.MyContent.Config;
if (xml == string.Empty) if (xml == string.Empty)
xml = "<Config/>"; xml = "<Config/>";
_Xp = new XMLProperties(xml); _Xp = new XMLProperties(xml);
// Correct Slaves nodes for Parent Child // Correct Slaves nodes for Parent Child
ValidateSlaves(_Xp.XmlContents, _Procedure.MyProcedureInfo.MyDocVersion.MultiUnitCount); ValidateSlaves(_Xp.XmlContents, _Procedure.MyProcedureInfo.MyDocVersion.MultiUnitCount);
@@ -74,7 +54,7 @@ namespace VEPROMS.CSLA.Library
} }
for (int i = 1; i <= unitCount; i++) for (int i = 1; i <= unitCount; i++)
{ {
XmlNode xnc = xn.SelectSingleNode(string.Format("Slave[@index='{0}']", i)); XmlNode xnc = xn.SelectSingleNode($"Slave[@index='{i}']");
if (xnc == null) // Missing Required Slave Node (index=i) - Add it. if (xnc == null) // Missing Required Slave Node (index=i) - Add it.
{ {
XmlElement xec = xd.CreateElement("Slave"); XmlElement xec = xd.CreateElement("Slave");
@@ -98,9 +78,8 @@ namespace VEPROMS.CSLA.Library
retval = proc.ProcedureConfig.GetValue(args.Group, args.Item); retval = proc.ProcedureConfig.GetValue(args.Group, args.Item);
if (retval != string.Empty) return retval; if (retval != string.Empty) return retval;
} }
DocVersionInfo docVersion = proc.ActiveParent as DocVersionInfo; if (!(proc.ActiveParent is DocVersionInfo docVersion)) return string.Empty;
if (docVersion == null) return string.Empty; retval = docVersion.DocVersionConfig.GetValue(args.Group, args.Item);
retval = docVersion.DocVersionConfig.GetValue(args.Group, args.Item);
if (retval != string.Empty) return retval; if (retval != string.Empty) return retval;
for (FolderInfo folder = docVersion.MyFolder; folder != null; folder = folder.MyParent) for (FolderInfo folder = docVersion.MyFolder; folder != null; folder = folder.MyParent)
{ {
@@ -110,36 +89,19 @@ namespace VEPROMS.CSLA.Library
} }
return string.Empty; return string.Empty;
} }
//private string Xp_LookInAncestorFolderInfo(object sender, XMLPropertiesArgs args)
//{
// if (args.AncestorLookup || ParentLookup)
// {
// DocVersionInfo docVersion = (DocVersionInfo)_Procedure.ActiveParent;
// string retval = docVersion.DocVersionConfig.GetValue(args.Group, args.Item);
// if (retval != string.Empty) return retval;
// for (FolderInfo folder = docVersion.MyFolder; folder != null; folder = folder.MyParent)
// {
// retval = folder.FolderConfig.GetValue(args.Group, args.Item);
// if (retval != string.Empty) return retval;
// }
// }
// return string.Empty;
//}
public ProcedureConfig(ProcedureInfo procedureInfo) public ProcedureConfig(ProcedureInfo procedureInfo)
{ {
_ProcedureInfo = procedureInfo; _ProcedureInfo = procedureInfo;
string xml = procedureInfo.MyContent.Config; string xml = procedureInfo.MyContent.Config;
if (xml == string.Empty) if (xml == string.Empty)
xml = "<Config/>"; xml = "<Config/>";
_Xp = new XMLProperties(xml); _Xp = new XMLProperties(xml);
// Fix Slaves nodes for Parent Child // Fix Slaves nodes for Parent Child
ValidateSlaves(_Xp.XmlContents, _ProcedureInfo.MyDocVersion.MultiUnitCount); ValidateSlaves(_Xp.XmlContents, _ProcedureInfo.MyDocVersion.MultiUnitCount);
_Xp.AncestorLookup = true; _Xp.AncestorLookup = true;
if (procedureInfo.ActiveParent != null) _Xp.LookInAncestor += new XMLPropertiesEvent(Xp_LookInAncestorFolder); if (procedureInfo.ActiveParent != null) _Xp.LookInAncestor += new XMLPropertiesEvent(Xp_LookInAncestorFolder);
} }
private int _SelectedSlave = 0; private int _SelectedSlave = 0;
//[Browsable(false)]
public int SelectedSlave public int SelectedSlave
{ {
get { return _SelectedSlave; } get { return _SelectedSlave; }
@@ -150,19 +112,9 @@ namespace VEPROMS.CSLA.Library
if (xml == string.Empty) xml = "<Config/>"; if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml); _Xp = new XMLProperties(xml);
} }
//public ProcedureConfig() public string GetValue(string group, string item) => _Xp[group, item];
//{ public void SetValue(string group, string item, string newvalue) => _Xp[group, item] = newvalue;
// _Xp = new XMLProperties(); public int GetItemId()
//}
public string GetValue(string group, string item)
{
return _Xp[group, item];
}
public void SetValue(string group, string item, string newvalue)
{
_Xp[group, item] = newvalue;
}
public int GetItemId()
{ {
if (_Procedure != null) return _Procedure.ItemID; if (_Procedure != null) return _Procedure.ItemID;
if (_ProcedureInfo != null) return _ProcedureInfo.ItemID; if (_ProcedureInfo != null) return _ProcedureInfo.ItemID;
@@ -193,19 +145,16 @@ namespace VEPROMS.CSLA.Library
[Description("Old Sequence")] [Description("Old Sequence")]
public string OldSequence public string OldSequence
{ {
get { return (_Procedure != null ? _Procedure.MyContent.MyZContent.OldStepSequence : (_ProcedureInfo.MyContent.MyZContent == null ? null : _ProcedureInfo.MyContent.MyZContent.OldStepSequence)); } get { return (_Procedure != null ? _Procedure.MyContent.MyZContent.OldStepSequence : (_ProcedureInfo.MyContent.MyZContent?.OldStepSequence)); }
set { if (_Procedure != null) _Procedure.MyContent.MyZContent.OldStepSequence = value; } set { if (_Procedure != null) _Procedure.MyContent.MyZContent.OldStepSequence = value; }
} }
[Category("Identification")] [Category("Identification")]
//PROPGRID: Hide Dirty //PROPGRID: Hide Dirty
[Browsable(false)] [Browsable(false)]
[DisplayName("Dirty")] [DisplayName("Dirty")]
[Description("Dirty")] [Description("Dirty")]
public bool Dirty public bool Dirty => _Procedure != null && _Procedure.IsDirty;
{ [Category("Format Settings")]
get { return (_Procedure != null ? _Procedure.IsDirty : false); }
}
[Category("Format Settings")]
[DisplayName("Format")] [DisplayName("Format")]
[Description("Format")] [Description("Format")]
[TypeConverter(typeof(FormatList))] [TypeConverter(typeof(FormatList))]
@@ -222,7 +171,6 @@ namespace VEPROMS.CSLA.Library
if (_Procedure != null) if (_Procedure != null)
{ {
_Procedure.MyContent.MyFormat = FormatList.ToFormat(value); // Can only be set if _DocVersion is set _Procedure.MyContent.MyFormat = FormatList.ToFormat(value); // Can only be set if _DocVersion is set
//_Procedure.ActiveFormat = null;
} }
} }
} }
@@ -261,12 +209,11 @@ namespace VEPROMS.CSLA.Library
public override string ToString() public override string ToString()
{ {
string s = _Xp.ToString(); string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty; return s == "<Config/>" || s == "<Config></Config>" ? string.Empty : s;
return s; }
} #endregion
#endregion #region DelProcReason
#region DelProcReason [Category("General")]
[Category("General")]
[DisplayName("DelProcReason")] [DisplayName("DelProcReason")]
[RefreshProperties(RefreshProperties.All)] [RefreshProperties(RefreshProperties.All)]
[Description("Delete Procedure Reason")] [Description("Delete Procedure Reason")]
@@ -283,19 +230,6 @@ namespace VEPROMS.CSLA.Library
} }
#endregion #endregion
#region FormatCategory #region FormatCategory
//[TypeConverter(typeof(EnumDescConverter))]
//public enum FormatColumns : int
//{
// Default = 0,
// [Description("Single Column")]
// OneColumn,
// [Description("Dual Column")]
// TwoColumn,
// [Description("Triple Column")]
// ThreeColumn,
// [Description("Quad Column")]
// FourColumns
//}
[Category("General")] [Category("General")]
[DisplayName("Default Column Mode")] [DisplayName("Default Column Mode")]
[RefreshProperties(RefreshProperties.All)] [RefreshProperties(RefreshProperties.All)]
@@ -375,13 +309,13 @@ namespace VEPROMS.CSLA.Library
{ {
string s = _Xp["Procedure", "Rev"]; string s = _Xp["Procedure", "Rev"];
if (SelectedSlave > 0) if (SelectedSlave > 0)
s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "Rev"]; s = _Xp[$"Slave[@index='{SelectedSlave}']", "Rev"];
return s; return s;
} }
set set
{ {
if (SelectedSlave > 0) if (SelectedSlave > 0)
_Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "Rev"] = value; // save selected value _Xp[$"Slave[@index='{SelectedSlave}']", "Rev"] = value; // save selected value
else else
_Xp["Procedure", "Rev"] = value; _Xp["Procedure", "Rev"] = value;
OnPropertyChanged("Print_Rev"); OnPropertyChanged("Print_Rev");
@@ -399,13 +333,13 @@ namespace VEPROMS.CSLA.Library
{ {
string s = _Xp["Procedure", "RevDate"]; string s = _Xp["Procedure", "RevDate"];
if (SelectedSlave > 0) if (SelectedSlave > 0)
s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "RevDate"]; s = _Xp[$"Slave[@index='{SelectedSlave}']", "RevDate"];
return s; return s;
} }
set set
{ {
if (SelectedSlave > 0) if (SelectedSlave > 0)
_Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "RevDate"] = value; // save selected value _Xp[$"Slave[@index='{SelectedSlave}']", "RevDate"] = value; // save selected value
else else
_Xp["Procedure", "RevDate"] = value; _Xp["Procedure", "RevDate"] = value;
OnPropertyChanged("Print_RevDate"); OnPropertyChanged("Print_RevDate");
@@ -443,7 +377,7 @@ namespace VEPROMS.CSLA.Library
{ {
string s = _Xp["Procedure", "ChangeBarDate"]; string s = _Xp["Procedure", "ChangeBarDate"];
if (SelectedSlave > 0) if (SelectedSlave > 0)
s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "ChangeBarDate"]; s = _Xp[$"Slave[@index='{SelectedSlave}']", "ChangeBarDate"];
else else
{ {
if (s != "") if (s != "")
@@ -470,7 +404,7 @@ namespace VEPROMS.CSLA.Library
set set
{ {
if (SelectedSlave > 0) if (SelectedSlave > 0)
_Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "ChangeBarDate"] = value; // save selected value _Xp[$"Slave[@index='{SelectedSlave}']", "ChangeBarDate"] = value; // save selected value
else else
_Xp["Procedure", "ChangeBarDate"] = value; _Xp["Procedure", "ChangeBarDate"] = value;
OnPropertyChanged("Print_ChangeBarDate"); OnPropertyChanged("Print_ChangeBarDate");
@@ -487,13 +421,13 @@ namespace VEPROMS.CSLA.Library
{ {
string s = _Xp["Procedure", "ReviewDate"]; string s = _Xp["Procedure", "ReviewDate"];
if (SelectedSlave > 0) if (SelectedSlave > 0)
s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "ReviewDate"]; s = _Xp[$"Slave[@index='{SelectedSlave}']", "ReviewDate"];
return s; return s;
} }
set set
{ {
if (SelectedSlave > 0) if (SelectedSlave > 0)
_Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "ReviewDate"] = value; // save selected value _Xp[$"Slave[@index='{SelectedSlave}']", "ReviewDate"] = value; // save selected value
else else
_Xp["Procedure", "ReviewDate"] = value; _Xp["Procedure", "ReviewDate"] = value;
OnPropertyChanged("Print_ReviewDate"); OnPropertyChanged("Print_ReviewDate");
@@ -519,12 +453,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Print_NumCopies"); OnPropertyChanged("Print_NumCopies");
} }
} }
//public enum PrintPagination : int
//{
// Free = 0, Fixed,
// [Description("Automatic")]
// Auto
//}
[Category("Print Settings")] [Category("Print Settings")]
[DisplayName("Pagination")] [DisplayName("Pagination")]
[RefreshProperties(RefreshProperties.All)] [RefreshProperties(RefreshProperties.All)]
@@ -562,13 +490,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Print_Pagination"); OnPropertyChanged("Print_Pagination");
} }
} }
//[TypeConverter(typeof(EnumDescConverter))]
//public enum PrintWatermark : int
//{
// None = 0, Reference, Draft, Master, Sample,
// [Description("Information Only")]
// InformationOnly
//}
[Category("Print Settings")] [Category("Print Settings")]
[DisplayName("Watermark")] [DisplayName("Watermark")]
[RefreshProperties(RefreshProperties.All)] [RefreshProperties(RefreshProperties.All)]
@@ -623,29 +544,12 @@ namespace VEPROMS.CSLA.Library
set set
{ {
string s = _Xp["PrintSettings", "NotInMergeAll"]; // get the original value to see if a change string s = _Xp["PrintSettings", "NotInMergeAll"]; // get the original value to see if a change
bool original = (s==string.Empty) ? false : bool.Parse(s); bool original = s != string.Empty && bool.Parse(s);
if (original == value) return; if (original == value) return;
_Xp["PrintSettings", "NotInMergeAll"] = ((bool)value).ToString(); // save selected value _Xp["PrintSettings", "NotInMergeAll"] = ((bool)value).ToString(); // save selected value
OnPropertyChanged("Print_NotInMergeAll"); OnPropertyChanged("Print_NotInMergeAll");
} }
} }
// Change Bar Use from 16-bit code:
// No Default
// Without Change Bars
// With Default Change Bars
// With User Specified Change Bars
//[TypeConverter(typeof(EnumDescConverter))]
//public enum PrintChangeBar : int
//{
// [Description("Select Before Printing")]
// SelectBeforePrinting = 0,
// [Description("Without Change Bars")]
// Without,
// [Description("With Default Change Bars")]
// WithDefault,
// [Description("Use Custom Change Bars")]
// WithUserSpecified
//}
[Category("Format Settings")] [Category("Format Settings")]
[DisplayName("Change Bar")] [DisplayName("Change Bar")]
[RefreshProperties(RefreshProperties.All)] [RefreshProperties(RefreshProperties.All)]
@@ -683,23 +587,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Print_ChangeBar"); OnPropertyChanged("Print_ChangeBar");
} }
} }
// User Specified Change Bar Location from16-bit code:
// With Text
// Outside Box
// AER on LEFT, RNO on Right
// To the Left of Text
//[TypeConverter(typeof(EnumDescConverter))]
//public enum PrintChangeBarLoc : int
//{
// [Description("With Text")]
// WithText = 0,
// [Description("Outside Box")]
// OutsideBox,
// [Description("AER on Left RNO on Right")]
// AERleftRNOright,
// [Description("To the Left of the Text")]
// LeftOfText
//}
[Category("Format Settings")] [Category("Format Settings")]
[DisplayName("Change Bar Position")] [DisplayName("Change Bar Position")]
[RefreshProperties(RefreshProperties.All)] [RefreshProperties(RefreshProperties.All)]
@@ -737,27 +624,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Print_ChangeBarLoc"); OnPropertyChanged("Print_ChangeBarLoc");
} }
} }
// Change Bar Text from16-bit code:
// Date and Change ID
// Revision Number
// Change ID
// No Change Bar Message
// User Defined Message
//[TypeConverter(typeof(EnumDescConverter))]
//public enum PrintChangeBarText : int
//{
// [Description("Date and Change ID")]
// DateChgID = 0,
// [Description("Revision Number")]
// RevNum,
// [Description("Change ID")]
// ChgID,
// [Description("No Change Bar Text")]
// None,
// [Description("Custom Change Bar Text")]
// UserDef
//}
[Category("Format Settings")] [Category("Format Settings")]
[DisplayName("Change Bar Text Type")] [DisplayName("Change Bar Text Type")]
[RefreshProperties(RefreshProperties.All)] [RefreshProperties(RefreshProperties.All)]
+51 -64
View File
@@ -1,10 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing;
using System.IO; using System.IO;
using DescriptiveEnum;
namespace VEPROMS.CSLA.Library namespace VEPROMS.CSLA.Library
{ {
@@ -12,21 +8,14 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))] [TypeConverter(typeof(ExpandableObjectConverter))]
public class RODbConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged public class RODbConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{ {
#region DynamicTypeDescriptor #region DynamicTypeDescriptor
internal override bool IsReadOnly internal override bool IsReadOnly => _RODb == null;
{ #endregion
get { return _RODb == null; } #region XML
} private readonly XMLProperties _Xp;
#endregion
#region XML
private XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
#endregion #endregion
#region Constructors #region Constructors
private RODb _RODb; private readonly RODb _RODb;
public RODbConfig(RODb roDb) public RODbConfig(RODb roDb)
{ {
_RODb = roDb; _RODb = roDb;
@@ -34,7 +23,7 @@ namespace VEPROMS.CSLA.Library
if (xml == string.Empty) xml = "<Config/>"; if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml); _Xp = new XMLProperties(xml);
} }
private RODbInfo _RODbInfo; private readonly RODbInfo _RODbInfo;
public RODbConfig(RODbInfo roDbInfo) public RODbConfig(RODbInfo roDbInfo)
{ {
_RODbInfo = roDbInfo; _RODbInfo = roDbInfo;
@@ -52,13 +41,10 @@ namespace VEPROMS.CSLA.Library
string xml = "<Config/>"; string xml = "<Config/>";
_Xp = new XMLProperties(xml); _Xp = new XMLProperties(xml);
} }
internal string GetValue(string group, string item) internal string GetValue(string group, string item) => _Xp[group, item];
{ #endregion
return _Xp[group, item]; #region Local Properties
} [Category("General")]
#endregion
#region Local Properties
[Category("General")]
[DisplayName("ROName")] [DisplayName("ROName")]
[Description("ROName")] [Description("ROName")]
public string ROName public string ROName
@@ -71,22 +57,20 @@ namespace VEPROMS.CSLA.Library
[Description("FolderPath")] [Description("FolderPath")]
public string FolderPath public string FolderPath
{ {
get { return (_RODb != null ? _RODb.FolderPath : _RODbInfo != null?_RODbInfo.FolderPath:null); } get { return (_RODb != null ? _RODb.FolderPath : _RODbInfo?.FolderPath); }
set { if (_RODb != null) _RODb.FolderPath = value; } set { if (_RODb != null) _RODb.FolderPath = value; }
} }
public RODb MyRODb public RODb MyRODb => _RODb;
{ get { return _RODb; } } #endregion
#endregion #region ToString
#region ToString public override string ToString()
public override string ToString()
{ {
string s = _Xp.ToString(); string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty; return s == "<Config/>" || s == "<Config></Config>" ? string.Empty : s;
return s; }
} #endregion
#endregion #region RODefaults
#region RODefaults [Category("Referenced Objects")]
[Category("Referenced Objects")]
[DisplayName("Graphic File Extension")] [DisplayName("Graphic File Extension")]
[RefreshProperties(RefreshProperties.All)] [RefreshProperties(RefreshProperties.All)]
[Description("Default File Extension")] [Description("Default File Extension")]
@@ -98,38 +82,41 @@ namespace VEPROMS.CSLA.Library
// look in roapp.ini in the FolderPath directory; // look in roapp.ini in the FolderPath directory;
// look in top folder's config // look in top folder's config
// set to Volian default, i.e. "TIF". // set to Volian default, i.e. "TIF".
string s = GetRoAppIniValue("ROAPP", "Extention"); string s = GetRoAppIniValue("Extention");
if (s == null || s == string.Empty) if (s == null || s == string.Empty)
s = TopFolderConfigValue("Graphics", "defaultext"); s = TopFolderConfigValue();
if (s == null || s == string.Empty) if (s == null || s == string.Empty)
return s = "TIF"; return s = "TIF";
return s; return s;
} }
} }
private string GetRoAppIniValue(string p, string p_2) private string GetRoAppIniValue(string p_2)
{ {
if (FolderPath == null) return null; if (FolderPath == null) return null;
string inipath = FolderPath + @"\roapp.ini"; string inipath = FolderPath + @"\roapp.ini";
if (!File.Exists(inipath)) return null; if (!File.Exists(inipath)) return null;
StreamReader myReader = new StreamReader(inipath); using (StreamReader myReader = new StreamReader(inipath))
string sLine; {
int indx = -1; string sLine;
while ((sLine = myReader.ReadLine()) != null) int indx = -1;
{ while ((sLine = myReader.ReadLine()) != null)
if (sLine.Length > 0 && sLine.Substring(0, 1) != ";") {
{ if (sLine.Length > 0 && sLine.Substring(0, 1) != ";")
if ((indx = sLine.ToLower().IndexOf(p_2.ToLower())) >= 0) {
{ if ((indx = sLine.ToLower().IndexOf(p_2.ToLower())) >= 0)
indx = sLine.IndexOf("=", indx + 9); {
return sLine.Substring(indx + 1, sLine.Length - indx - 1).Trim(); indx = sLine.IndexOf("=", indx + 9);
} return sLine.Substring(indx + 1, sLine.Length - indx - 1).Trim();
} }
} }
myReader.Close(); }
return null; myReader.Close();
} }
private string TopFolderConfigValue(string p, string p_2)
return null;
}
private string TopFolderConfigValue()
{ {
FolderInfo fi = FolderInfo.GetTop(); FolderInfo fi = FolderInfo.GetTop();
return fi.FolderConfig.Graphics_defaultext; return fi.FolderConfig.Graphics_defaultext;
@@ -145,9 +132,9 @@ namespace VEPROMS.CSLA.Library
} }
public string GetDefaultGraphicExtensionLocation() public string GetDefaultGraphicExtensionLocation()
{ {
string s = GetRoAppIniValue("ROAPP", "Extention"); string s = GetRoAppIniValue("Extention");
if (s != null && s != string.Empty) return "Default Extension found in roapp.ini"; if (s != null && s != string.Empty) return "Default Extension found in roapp.ini";
s = TopFolderConfigValue("Graphics", "defaultext"); s = TopFolderConfigValue();
if (s != null && s != string.Empty) return "Default Extension defined in veproms properties"; if (s != null && s != string.Empty) return "Default Extension defined in veproms properties";
return "Used program default"; return "Used program default";
} }
+38 -105
View File
@@ -159,16 +159,13 @@ namespace VEPROMS.CSLA.Library
private int _totalRoCnt = 0; private int _totalRoCnt = 0;
private double _pctComplete = 0; private double _pctComplete = 0;
#endregion #endregion
#region Properties #region Properties
public int RofstID public int RofstID => _rofstID;
{
get { return _rofstID; }
}
public DocVersionInfo MyDocVersionInfo public DocVersionInfo MyDocVersionInfo
{ {
get { return _myDocVersionInfo; } get { return _myDocVersionInfo; }
set set
@@ -178,14 +175,11 @@ namespace VEPROMS.CSLA.Library
} }
} }
// C2021-065 see if we need to get the RO information for the "Other" Child applicability value // C2021-065 see if we need to get the RO information for the "Other" Child applicability value
public int SelectedSlave public int SelectedSlave => (!string.IsNullOrEmpty(_otherChild)) ? Convert.ToInt32(_otherChild) : _selectedSlave;
{
get { return (!string.IsNullOrEmpty(_otherChild)) ? Convert.ToInt32(_otherChild) : _selectedSlave; }
}
//C2021-065 used by Barakah Alarms so that we get ROLookUp for the Other applicability //C2021-065 used by Barakah Alarms so that we get ROLookUp for the Other applicability
public string OtherChild public string OtherChild
{ {
get { return _otherChild; } get { return _otherChild; }
set { _otherChild = value; } set { _otherChild = value; }
@@ -237,16 +231,13 @@ namespace VEPROMS.CSLA.Library
set { _autoCombineSingleRetValues = value; } set { _autoCombineSingleRetValues = value; }
} }
public bool ShowLoadingStatus public bool ShowLoadingStatus => _showLoadingStatus;
{
get { return _showLoadingStatus; }
}
#endregion #endregion
#region Constructors #region Constructors
public ROFSTLookup(int rofstID, DocVersionInfo dvi, string otherChild, bool showLoadingStatus = true) public ROFSTLookup(int rofstID, DocVersionInfo dvi, string otherChild, bool showLoadingStatus = true)
{ {
// Set Fields/Properties // Set Fields/Properties
_rofstID = rofstID; _rofstID = rofstID;
@@ -321,31 +312,19 @@ namespace VEPROMS.CSLA.Library
return RofstDataSearch(_rofstID, value, searchTypeID, onlyRoid16, maxNumRecords); return RofstDataSearch(_rofstID, value, searchTypeID, onlyRoid16, maxNumRecords);
} }
public ROFSTLookup.rochild[] GetRoChildrenByID(int id, int dbiID, bool loadChildren = false, bool loadAllChildren = false) public ROFSTLookup.rochild[] GetRoChildrenByID(int id, int dbiID, bool loadChildren = false, bool loadAllChildren = false) => RofstDataGetChildrenByID(_rofstID, dbiID, id, loadChildren, loadAllChildren);
{
return RofstDataGetChildrenByID(_rofstID, dbiID, id, loadChildren, loadAllChildren);
}
public ROFSTLookup.rochild[] GetRoChildrenByRoid(string roid, bool loadChildren = false, bool loadAllChildren = false) public ROFSTLookup.rochild[] GetRoChildrenByRoid(string roid, bool loadChildren = false, bool loadAllChildren = false) => RofstDataGetChildrenByRoid(_rofstID, roid, loadChildren, loadAllChildren);
{
return RofstDataGetChildrenByRoid(_rofstID, roid, loadChildren, loadAllChildren);
}
public ROFSTLookup.rochild[] GetRoChildrenByType(E_ROValueType valueTypes, bool loadChildren = false, bool loadAllChildren = false) public ROFSTLookup.rochild[] GetRoChildrenByType(E_ROValueType valueTypes, bool loadChildren = false, bool loadAllChildren = false) => RofstDataGetRoChildrenByType(_rofstID, valueTypes, loadChildren, loadAllChildren);
{
return RofstDataGetRoChildrenByType(_rofstID, valueTypes, loadChildren, loadAllChildren);
}
#endregion #endregion
#region (RO Database Info) #region (RO Database Info)
public int GetRODatabaseTitleIndex(string roid) public int GetRODatabaseTitleIndex(string roid) => Convert.ToInt32("0x" + roid.Substring(0, 4), 16);
{
return Convert.ToInt32("0x" + roid.Substring(0, 4), 16);
}
public string GetRODatabaseTitle(int idx) public string GetRODatabaseTitle(int idx)
{ {
ROFSTLookup.rodbi rd = RofstDataGetDatabaseByID(_rofstID, idx); ROFSTLookup.rodbi rd = RofstDataGetDatabaseByID(_rofstID, idx);
return (!string.IsNullOrEmpty(rd.dbiTitle) ? rd.dbiTitle : "RO Database Title Not Found"); return (!string.IsNullOrEmpty(rd.dbiTitle) ? rd.dbiTitle : "RO Database Title Not Found");
@@ -358,16 +337,13 @@ namespace VEPROMS.CSLA.Library
return (rd.dbiID > 0) ? rd : RofstDataGetDatabaseByID(_rofstID, 1, loadChildren, loadAllChildren); return (rd.dbiID > 0) ? rd : RofstDataGetDatabaseByID(_rofstID, 1, loadChildren, loadAllChildren);
} }
public ROFSTLookup.rodbi[] GetRODatabaseList(bool loadChildren = false, bool loadAllChildren = false) public ROFSTLookup.rodbi[] GetRODatabaseList(bool loadChildren = false, bool loadAllChildren = false) => RofstDataGetDatabases(_rofstID, loadChildren, loadAllChildren);
{
return RofstDataGetDatabases(_rofstID, loadChildren, loadAllChildren);
}
#endregion #endregion
#region (RO Info By AccPageID) #region (RO Info By AccPageID)
public string FormatAccPageKey(string accPageID) public string FormatAccPageKey(string accPageID)
{ {
string accPageBase = string.Empty; string accPageBase = string.Empty;
string accPageExt = string.Empty; string accPageExt = string.Empty;
@@ -527,12 +503,9 @@ namespace VEPROMS.CSLA.Library
return (!string.IsNullOrEmpty(retval)) ? retval.Replace("\r\n", @"\par ") : retval; return (!string.IsNullOrEmpty(retval)) ? retval.Replace("\r\n", @"\par ") : retval;
} }
public List<string> GetValueDifferences(int originalRofstID, ref List<string> delList) public List<string> GetValueDifferences(int originalRofstID, ref List<string> delList) => RofstDataGetValueDifferences(originalRofstID, _rofstID, ref delList);
{
return RofstDataGetValueDifferences(originalRofstID, _rofstID, ref delList);
}
public List<string> GetROTitleAndGroupPath(string roid, bool reportMissingROs, bool convertCaretToDelta) public List<string> GetROTitleAndGroupPath(string roid, bool reportMissingROs, bool convertCaretToDelta)
{ {
// Return the RO Title in a list of strings. The last item in the list is the actual RO title, // Return the RO Title in a list of strings. The last item in the list is the actual RO title,
// the items preceding it are the titles of the groups and sub-groups containing the RO // the items preceding it are the titles of the groups and sub-groups containing the RO
@@ -616,26 +589,17 @@ namespace VEPROMS.CSLA.Library
return sb.ToString(); return sb.ToString();
} }
#endregion #endregion
#region (RO Info Helper Methods) #region (RO Info Helper Methods)
public static byte[] GetRofstLookupBytes(int rofstID) public static byte[] GetRofstLookupBytes(int rofstID) => RofstDataGetRofstLookupBytes(rofstID);
{
return RofstDataGetRofstLookupBytes(rofstID);
}
public static DateTime GetRoFSTdts(int rofstID) public static DateTime GetRoFSTdts(int rofstID) => GetRofstDtsByID(rofstID);
{
return GetRofstDtsByID(rofstID);
}
public DateTime GetRoFSTdts() public DateTime GetRoFSTdts() => GetRoFSTdts(_rofstID);
{
return GetRoFSTdts(_rofstID);
}
public bool HasChildren(ref ROFSTLookup.rochild child) public bool HasChildren(ref ROFSTLookup.rochild child)
{ {
LoadChildren(ref child); LoadChildren(ref child);
return child.children.Any(); return child.children.Any();
@@ -666,12 +630,9 @@ namespace VEPROMS.CSLA.Library
db.children = GetRoChildrenByID(db.ID, db.dbiID, false); db.children = GetRoChildrenByID(db.ID, db.dbiID, false);
} }
public static ROFSTLookup.rochild GetEmptyRoChild() public static ROFSTLookup.rochild GetEmptyRoChild() => new ROFSTLookup.rochild() { ID = -1, type = 0 };
{
return new ROFSTLookup.rochild() { ID = -1, type = 0 };
}
public static string CalculateDuration(DateTime dtStart) public static string CalculateDuration(DateTime dtStart)
{ {
string duration = string.Empty; string duration = string.Empty;
@@ -1736,31 +1697,6 @@ namespace VEPROMS.CSLA.Library
#region (Convert To Objects) #region (Convert To Objects)
private ROFSTLookup.roHdr ConvertToRoHdrObject(SafeDataReader dr, bool loadChildren)
{
ROFSTLookup.roHdr rh = new ROFSTLookup.roHdr
{
hSize = (int)dr.GetValue("hSize"),
hYear = (int)dr.GetValue("hYear"),
hMonth = (byte)dr.GetValue("hMonth"),
hDay = (byte)dr.GetValue("hDay"),
hcYear = (int)dr.GetValue("hcYear"),
hcMonth = (byte)dr.GetValue("hcMonth"),
hcDay = (byte)dr.GetValue("hcDay"),
hcHour = (byte)dr.GetValue("hcHour"),
hcMin = (byte)dr.GetValue("hcMin"),
hcSec = (byte)dr.GetValue("hcSec"),
hcHund = (byte)dr.GetValue("hcHund")
};
if (loadChildren)
{
rh.myDbs = RofstDataGetDatabases(_rofstID);
}
return rh;
}
private ROFSTLookup.rodbi ConvertToRodbiObject(SafeDataReader dr, bool loadChildren, bool loadAllChildren) private ROFSTLookup.rodbi ConvertToRodbiObject(SafeDataReader dr, bool loadChildren, bool loadAllChildren)
{ {
ROFSTLookup.rodbi rd = new ROFSTLookup.rodbi ROFSTLookup.rodbi rd = new ROFSTLookup.rodbi
@@ -2202,12 +2138,9 @@ namespace VEPROMS.CSLA.Library
return i; return i;
} }
private int NextDelimiter(string delim, string str) private int NextDelimiter(string delim, string str) => (!string.IsNullOrEmpty(str)) ? str.IndexOfAny(delim.ToCharArray()) : -1;
{
return (!string.IsNullOrEmpty(str)) ? str.IndexOfAny(delim.ToCharArray()) : -1;
}
private int MatchingBrace(string str) private int MatchingBrace(string str)
{ {
int level = 1; int level = 1;
int idx = 0; // the while will skip the first position (the first brace) int idx = 0; // the while will skip the first position (the first brace)
@@ -2426,7 +2359,7 @@ namespace VEPROMS.CSLA.Library
{ {
if (match.Groups[2].Value != "1") // Other than "1", multiply it times 10 raised to a power if (match.Groups[2].Value != "1") // Other than "1", multiply it times 10 raised to a power
{ {
sb.Append(match.Groups[2].Value + "x10"); sb.Append($"{match.Groups[2].Value}x10");
} }
else // The number is simply 1 so it can be ignored and 10 can be raised to a power else // The number is simply 1 so it can be ignored and 10 can be raised to a power
{ {
@@ -2435,11 +2368,11 @@ namespace VEPROMS.CSLA.Library
} }
else // A number with a decimal point else // A number with a decimal point
{ {
sb.Append(match.Groups[2].Value + "." + match.Groups[3].Value + "x10"); sb.Append($"{match.Groups[2].Value}.{match.Groups[3].Value}x10");
} }
// Add the exponent as superscript // Add the exponent as superscript
return sb.ToString() + "\\up2 " + match.Groups[4].Value.Replace("-", @"\u8209?") + match.Groups[5].Value + "\\up0 "; return $"{sb}\\up2 {match.Groups[4].Value.Replace("-", @"\u8209?")}{match.Groups[5].Value}\\up0 ";
} }
#endregion #endregion
@@ -7,21 +7,14 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))] [TypeConverter(typeof(ExpandableObjectConverter))]
public class ROImageConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged public class ROImageConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{ {
#region DynamicTypeDescriptor #region DynamicTypeDescriptor
internal override bool IsReadOnly internal override bool IsReadOnly => _ROImageInfo == null;
{ #endregion
get { return _ROImageInfo == null; } #region XML
} private readonly XMLProperties _Xp;
#endregion
#region XML
private XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
#endregion #endregion
#region Constructors #region Constructors
private ROImageInfo _ROImageInfo; private readonly ROImageInfo _ROImageInfo;
public ROImageConfig(ROImageInfo rOImageInfo) public ROImageConfig(ROImageInfo rOImageInfo)
{ {
_ROImageInfo = rOImageInfo; _ROImageInfo = rOImageInfo;
@@ -34,13 +27,10 @@ namespace VEPROMS.CSLA.Library
string xml = "<Config/>"; string xml = "<Config/>";
_Xp = new XMLProperties(xml); _Xp = new XMLProperties(xml);
} }
internal string GetValue(string group, string item) internal string GetValue(string group, string item) => _Xp[group, item];
{ #endregion
return _Xp[group, item]; #region Local Properties
} [Category("Image")]
#endregion
#region Local Properties
[Category("Image")]
[Browsable(false)] [Browsable(false)]
[DisplayName("Size")] [DisplayName("Size")]
[RefreshProperties(RefreshProperties.All)] [RefreshProperties(RefreshProperties.All)]
@@ -62,9 +52,8 @@ namespace VEPROMS.CSLA.Library
public override string ToString() public override string ToString()
{ {
string s = _Xp.ToString(); string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty; return s == "<Config/>" || s == "<Config></Config>" ? string.Empty : s;
return s; }
} #endregion
#endregion }
}
} }
@@ -1,9 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing;
using DescriptiveEnum;
namespace VEPROMS.CSLA.Library namespace VEPROMS.CSLA.Library
{ {
@@ -11,22 +7,15 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))] [TypeConverter(typeof(ExpandableObjectConverter))]
public class RevisionConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged public class RevisionConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{ {
#region DynamicTypeDescriptor #region DynamicTypeDescriptor
internal override bool IsReadOnly internal override bool IsReadOnly => false;
{ #endregion
get { return false; }//_Section == null; } #region XML
} private readonly XMLProperties _Xp;
#endregion
#region XML
private XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
#endregion #endregion
#region Constructors #region Constructors
private Revision _Revision; private readonly Revision _Revision;
private RevisionInfo _RevisionInfo; private readonly RevisionInfo _RevisionInfo;
[Browsable(false)] [Browsable(false)]
public bool ParentLookup public bool ParentLookup
{ {
@@ -52,18 +41,12 @@ namespace VEPROMS.CSLA.Library
if (xml == string.Empty) xml = "<Config/>"; if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml); _Xp = new XMLProperties(xml);
} }
public RevisionConfig() public RevisionConfig() => _Xp = new XMLProperties();
{ internal string GetValue(string group, string item) => _Xp[group, item];
_Xp = new XMLProperties(); #endregion
} #region Properties and Methods
internal string GetValue(string group, string item) // This is needed for the Data Loader
{ [Category("History")]
return _Xp[group, item];
}
#endregion
#region Properties and Methods
// This is needed for the Data Loader
[Category("History")]
[Browsable(false)] [Browsable(false)]
[DisplayName("Start Date")] [DisplayName("Start Date")]
[RefreshProperties(RefreshProperties.All)] [RefreshProperties(RefreshProperties.All)]
@@ -115,9 +98,8 @@ namespace VEPROMS.CSLA.Library
public override string ToString() public override string ToString()
{ {
string s = _Xp.ToString(); string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty; return s == "<Config/>" || s == "<Config></Config>" ? string.Empty : s;
return s; }
} #endregion
#endregion }
}
} }
@@ -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 DescriptiveEnum; using DescriptiveEnum;
using System.Xml; using System.Xml;
@@ -11,18 +10,11 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))] [TypeConverter(typeof(ExpandableObjectConverter))]
public class SectionConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged, IItemConfig public class SectionConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged, IItemConfig
{ {
#region DynamicTypeDescriptor #region DynamicTypeDescriptor
internal override bool IsReadOnly internal override bool IsReadOnly => false;
{ #endregion
get { return false; }//_Section == null; } #region XML
} private readonly XMLProperties _Xp;
#endregion
#region XML
private XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
#endregion #endregion
#region Constructors #region Constructors
//PROPGRID: Hide ParentLookup //PROPGRID: Hide ParentLookup
@@ -32,26 +24,13 @@ namespace VEPROMS.CSLA.Library
get { return _Xp.ParentLookup; } get { return _Xp.ParentLookup; }
set { _Xp.ParentLookup = value; } set { _Xp.ParentLookup = value; }
} }
//PROPGRID: Had to comment out NonSerialized to hide AncestorLookup from Property Grid private readonly Section _Section;
//[NonSerialized] private readonly SectionInfo _SectionInfo;
private bool _AncestorLookup;
//PROPGRID: Hide AncestorLookup
//[Browsable(false)]
//public bool AncestorLookup
//{
// get { return _AncestorLookup; }
// set { _AncestorLookup = value; }
//}
private Section _Section;
private SectionInfo _SectionInfo;
private static int _SectionConfigUnique = 0; private static int _SectionConfigUnique = 0;
private static int SectionConfigUnique private static int SectionConfigUnique => ++_SectionConfigUnique;
{ get { return ++_SectionConfigUnique; } } private readonly int _MySectionConfigUnique = SectionConfigUnique;
private int _MySectionConfigUnique = SectionConfigUnique;
public int MySectionConfigUnique // Absolutely Unique ID - Info
{ get { return _MySectionConfigUnique; } }
public SectionConfig(Section section) public SectionConfig(Section section)
{ {
_Section = section; _Section = section;
string xml = section.MyContent.Config; string xml = section.MyContent.Config;
@@ -82,9 +61,8 @@ namespace VEPROMS.CSLA.Library
if (retval != string.Empty) return retval; if (retval != string.Empty) return retval;
proc = (ProcedureInfo)proc.ActiveParent; proc = (ProcedureInfo)proc.ActiveParent;
} }
DocVersionInfo docVersion = proc.ActiveParent as DocVersionInfo; if (!(proc.ActiveParent is DocVersionInfo docVersion)) return string.Empty;
if (docVersion == null) return string.Empty; retval = docVersion.DocVersionConfig.GetValue(args.Group, args.Item);
retval = docVersion.DocVersionConfig.GetValue(args.Group, args.Item);
if (retval != string.Empty) return retval; if (retval != string.Empty) return retval;
for (FolderInfo folder = docVersion.MyFolder; folder != null; folder = folder.MyParent) for (FolderInfo folder = docVersion.MyFolder; folder != null; folder = folder.MyParent)
{ {
@@ -102,23 +80,11 @@ namespace VEPROMS.CSLA.Library
_Xp = new XMLProperties(xml); _Xp = new XMLProperties(xml);
if (_SectionInfo.ActiveParent != null) _Xp.LookInAncestor += new XMLPropertiesEvent(Xp_LookInAncestorFolder); if (_SectionInfo.ActiveParent != null) _Xp.LookInAncestor += new XMLPropertiesEvent(Xp_LookInAncestorFolder);
} }
//public SectionConfig(string xml) public SectionConfig() => _Xp = new XMLProperties();
//{ internal string GetValue(string group, string item) => _Xp[group, item];
// if (xml == string.Empty) xml = "<Config/>"; #endregion
// _Xp = new XMLProperties(xml); #region Local Properties
//} [Category("General")]
public SectionConfig()
{
_Xp = new XMLProperties();
}
internal string GetValue(string group, string item)
{
return _Xp[group, item];
}
#endregion
#region Local Properties
//[Category("Identification")]
[Category("General")]
[DisplayName("Number")] [DisplayName("Number")]
[Description("Number")] [Description("Number")]
public string Number public string Number
@@ -126,7 +92,6 @@ namespace VEPROMS.CSLA.Library
get { return (_Section != null ? _Section.MyContent.Number : _SectionInfo.MyContent.Number); } get { return (_Section != null ? _Section.MyContent.Number : _SectionInfo.MyContent.Number); }
set { if (_Section != null) _Section.MyContent.Number = value; } set { if (_Section != null) _Section.MyContent.Number = value; }
} }
//[Category("Identification")]
[Category("General")] [Category("General")]
[DisplayName("Title")] [DisplayName("Title")]
[Description("Title")] [Description("Title")]
@@ -142,7 +107,7 @@ namespace VEPROMS.CSLA.Library
[Description("Old Sequence")] [Description("Old Sequence")]
public string OldSequence public string OldSequence
{ {
get { return (_Section != null ? _Section.MyContent.MyZContent.OldStepSequence : (_SectionInfo.MyContent.MyZContent == null ? null : _SectionInfo.MyContent.MyZContent.OldStepSequence)); } get { return (_Section != null ? _Section.MyContent.MyZContent.OldStepSequence : (_SectionInfo.MyContent.MyZContent?.OldStepSequence)); }
set { if (_Section != null) _Section.MyContent.MyZContent.OldStepSequence = value; } set { if (_Section != null) _Section.MyContent.MyZContent.OldStepSequence = value; }
} }
[Category("Identification")] [Category("Identification")]
@@ -152,7 +117,7 @@ namespace VEPROMS.CSLA.Library
[Description("Dirty")] [Description("Dirty")]
public bool Dirty public bool Dirty
{ {
get { return (_Section != null ? _Section.IsDirty : false); } get { return (_Section != null && _Section.IsDirty); }
} }
[Category("Format")] [Category("Format")]
[DisplayName("Format")] [DisplayName("Format")]
@@ -171,7 +136,6 @@ namespace VEPROMS.CSLA.Library
if (_Section != null) if (_Section != null)
{ {
_Section.MyContent.MyFormat = FormatList.ToFormat(value); // Can only be set if _DocVersion is set _Section.MyContent.MyFormat = FormatList.ToFormat(value); // Can only be set if _DocVersion is set
//_Section.ActiveFormat = null;
DocStyleListConverter.MySection = _Section; DocStyleListConverter.MySection = _Section;
} }
} }
@@ -192,7 +156,7 @@ namespace VEPROMS.CSLA.Library
set set
{ {
if (_Section != null) if (_Section != null)
_Section.MyContent.MyFormat = value == null ? null : value.GetJustFormat(); _Section.MyContent.MyFormat = value?.GetJustFormat();
} }
} }
[Category("Format")] [Category("Format")]
@@ -304,15 +268,13 @@ namespace VEPROMS.CSLA.Library
public override string ToString() public override string ToString()
{ {
string s = _Xp.ToString(); string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty; return s == "<Config/>" || s == "<Config></Config>" ? string.Empty : s;
return s; }
} #endregion
#endregion #region SectionCategory // from sequence number in 16-bit database.
#region SectionCategory // from sequence number in 16-bit database. [TypeConverter(typeof(EnumDescConverter))]
[TypeConverter(typeof(EnumDescConverter))]
public enum SectionPagination : int public enum SectionPagination : int
{ {
//Default = 0, Continuous, Separate
Continuous = 1, Separate = 2 Continuous = 1, Separate = 2
} }
[Category("Format")] [Category("Format")]
@@ -415,7 +377,7 @@ namespace VEPROMS.CSLA.Library
get get
{ {
string tmp = _Xp["Section", "TOC_Group_Title"]; string tmp = _Xp["Section", "TOC_Group_Title"];
return (tmp == null)? "" : tmp; return tmp ?? "";
} }
set set
{ {
@@ -476,23 +438,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Section_DontIncludeDuplexFoldout"); OnPropertyChanged("Section_DontIncludeDuplexFoldout");
} }
} }
//[Category("Section")]
////PROPGRID: Hide AutoGen
//[DisplayName("Section AutoGen")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("Section AutoGen")]
//public string Section_AutoGen
//{
// get
// {
// return _Xp["Section", "AutoGen"];
// }
// set
// {
// _Xp["Section", "AutoGen"] = value;
// OnPropertyChanged("Section_AutoGen");
// }
//}
[Category("Section")] [Category("Section")]
//PROPGRID: Hide Subsection PH //PROPGRID: Hide Subsection PH
[DisplayName("Section PrintHdr")] [DisplayName("Section PrintHdr")]
@@ -536,7 +481,6 @@ namespace VEPROMS.CSLA.Library
{ {
get get
{ {
//return _Xp["Section", "ShwRplWords"];
string tmp = _Xp["Section", "ShwRplWords"]; string tmp = _Xp["Section", "ShwRplWords"];
return tmp == null || tmp == "" ? "Y" : tmp; return tmp == null || tmp == "" ? "Y" : tmp;
} }
@@ -568,8 +512,6 @@ namespace VEPROMS.CSLA.Library
// C2020-046 change wording for the column modes to One, Two, Three, and Four // C2020-046 change wording for the column modes to One, Two, Three, and Four
public enum SectionColumnMode : int public enum SectionColumnMode : int
{ {
//[Description("Format Default")]
//Default = 0,
[Description("One Column")] [Description("One Column")]
One = 1, One = 1,
[Description("Two Columns")] [Description("Two Columns")]
@@ -595,7 +537,7 @@ namespace VEPROMS.CSLA.Library
// If there is no parent value, then use the volian default // If there is no parent value, then use the volian default
if (s == string.Empty) if (s == string.Empty)
{ {
SectionInfo si = _SectionInfo != null ? _SectionInfo : SectionInfo.Get(_Section.ItemID); SectionInfo si = _SectionInfo ?? SectionInfo.Get(_Section.ItemID);
if (si != null) if (si != null)
{ {
E_PurchaseOptions po = (E_PurchaseOptions)(MyFormat ?? MyDefaultFormat).PlantFormat.FormatData.PurchaseOptions; E_PurchaseOptions po = (E_PurchaseOptions)(MyFormat ?? MyDefaultFormat).PlantFormat.FormatData.PurchaseOptions;
@@ -607,34 +549,23 @@ namespace VEPROMS.CSLA.Library
{ {
case FormatColumns.OneColumn: case FormatColumns.OneColumn:
return SectionColumnMode.One; return SectionColumnMode.One;
break;
case FormatColumns.TwoColumn: case FormatColumns.TwoColumn:
return SectionColumnMode.Two; return SectionColumnMode.Two;
break;
case FormatColumns.ThreeColumn: case FormatColumns.ThreeColumn:
return SectionColumnMode.Three; return SectionColumnMode.Three;
break;
case FormatColumns.FourColumns: case FormatColumns.FourColumns:
return SectionColumnMode.Four; return SectionColumnMode.Four;
break;
//default:
// return SectionColumnMode.One;
// break;
} }
} }
} }
int rval = 0; int rval;
if (MyFormat != null) if (MyFormat != null)
{ {
rval = (int)MyFormat.MyStepSectionLayoutData.PMode; rval = (int)MyFormat.MyStepSectionLayoutData.PMode;
//int rval = (int)MyFormat.MyStepSectionLayoutData.PMode;
//return (SectionColumnMode)rval;//SectionColumnMode.Two; //SectionColumnMode.Default;// default to volian default
} }
else else
{ {
//int rval = (int)MyDefaultFormat.MyStepSectionLayoutData.PMode;
rval = (int)MyDefaultFormat.MyStepSectionLayoutData.PMode; rval = (int)MyDefaultFormat.MyStepSectionLayoutData.PMode;
//return (SectionColumnMode)rval;
} }
// if no pmode is defined, i.e. rval = 0, then go up to the procedure level & get // if no pmode is defined, i.e. rval = 0, then go up to the procedure level & get
// it's format column. // it's format column.
@@ -646,11 +577,6 @@ namespace VEPROMS.CSLA.Library
} }
else else
return (SectionColumnMode)int.Parse(s); return (SectionColumnMode)int.Parse(s);
//if (s == string.Empty)
// return SectionColumnMode.Default;
//return (SectionColumnMode)int.Parse(s);
} }
set set
{ {
@@ -670,13 +596,12 @@ namespace VEPROMS.CSLA.Library
} }
else else
rval =(int)MyFormat.MyStepSectionLayoutData.PMode; rval =(int)MyFormat.MyStepSectionLayoutData.PMode;
//parval = ((rval > 0)?((SectionColumnMode)rval).ToString() : "2"); // if PMode is zero default to 2 column mode
} }
// if still no value found in inheritance, check if the procedure has a default. if so and value matches, clear out any config item. // if still no value found in inheritance, check if the procedure has a default. if so and value matches, clear out any config item.
if (rval == 0) if (rval == 0)
{ {
SectionInfo si = _SectionInfo != null ? _SectionInfo : SectionInfo.Get(_Section.ItemID); SectionInfo si = _SectionInfo ?? SectionInfo.Get(_Section.ItemID);
if (si != null) if (si != null)
{ {
switch (si.MyProcedure.ProcedureConfig.Format_Columns) switch (si.MyProcedure.ProcedureConfig.Format_Columns)
@@ -708,103 +633,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Section_ColumnMode"); OnPropertyChanged("Section_ColumnMode");
} }
} }
//char * far printtypes[] = {
// "Compressed, 8 lines per inch",
// "Elite, 6 lines per inch",
// "Pica, 6 lines per inch",
// "Default font, 4 Lines Per Inch",
// "Default font, 6 Lines Per Inch",
// "Compressed 6 LPI",
// "Default font, 7 Lines Per Inch",
// "Special Landscape, Elite, 6 lines per inch"
//};
//[TypeConverter(typeof(EnumDescConverter))]
//public enum AttPrintSize : int
//{
// [Description("Compressed, 8 lines per inch")]
// Cmp8lpi = 0,
// [Description("Elite, 6 lines per inch")]
// Elite6lpi = 1,
// [Description("Pica, 6 lines per inch")]
// Pica6lpi = 2,
// [Description("Default font, 4 Lines Per Inch")]
// Def4lpi = 3,
// [Description("Default font, 6 Lines Per Inch")]
// Def6lpi = 4,
// [Description("Compressed 6 LPI")]
// Cmp6lpi = 5,
// [Description("Default font, 7 Lines Per Inch")]
// Def7lpi = 6,
// [Description("Landscape, Elite, 6 lines per inch")]
// landElite6lpi = 7
//}
//[Category("Format")]
//[DisplayName("Attachment PrintSize")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("Attachment Print Size")]
//public AttPrintSize Section_AttachmentPrintSize
//{
// get
// {
// string lpiSettings = "*pP46f7L";
// string s = _Xp["Section", "OldType"];
// int idx = -1;
// //If there is no value to get, then get the parent value (a.k.a. default value).
// if (s == string.Empty)
// s = _Xp.ParentValue("Section", "OldType"); // get the parent value
// // If there is no parent value, then use the volian default
// if (s == string.Empty)
// return AttPrintSize.Def6lpi;// default to volian default
// idx = lpiSettings.IndexOf(s[1]);
// if (idx == -1) idx = 4;
// return (AttPrintSize)idx;
// //return (AttPrintSize)int.Parse(s);
// }
// set
// {
// // if value being saved is same as the parent value, then clear the value (save blank). This will
// // reset the data to use the parent value.
// string lpiSettings = "*pP46f7L";
// string parval = _Xp.ParentValue("Section", "OldType"); // get the parent value
// StringBuilder sb = new StringBuilder();
// string curval = parval[1].ToString();
// sb.Append(parval[0]); // save first part of OldType
// if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default
// {
// //parval = ((int)(AttPrintSize.Def6lpi)).ToString();
// //sb.Append(((int)(AttPrintSize.Def6lpi)).ToString());
// sb.Append(lpiSettings[(int)(AttPrintSize.Def6lpi)]);
// }
// if (curval.Equals(((int)value).ToString()))
// _Xp["Section", "OldType"] = string.Empty; // reset to parent value
// else
// {
// //sb.Append(((int)value).ToString());
// sb.Append(lpiSettings[(int)value]);
// _Xp["Section", "OldType"] = sb.ToString(); // save selected value
// }
// OnPropertyChanged("Section_AttachmentPrintSize");
// }
//}
/*
int chkOffType = (rid[0] & 0x007F) - '0';
if (chkOffType > 0)
ci.AddItem("Section", "CheckoffSelection", chkOffType.ToString());
if (stype.Length > 1)
{
int chkOffHeading = (stype[1] & 0x007F) - '0';
if (chkOffHeading > 0)
ci.AddItem("Section", "CheckoffHeading", chkOffHeading.ToString());
*/
[Category("Format")] [Category("Format")]
[DisplayName("Checkoff List Selection")] [DisplayName("Checkoff List Selection")]
[Description("Checkoff List Selection")] [Description("Checkoff List Selection")]
@@ -874,13 +702,10 @@ namespace VEPROMS.CSLA.Library
{ {
get get
{ {
//if (_SectionInfo != null && _SectionInfo.Sections != null && _SectionInfo.Sections.Count > 0 && _SectionInfo.Steps != null && _SectionInfo.Steps.Count > 0)
if (_SectionInfo != null && _SectionInfo.Sections != null && _SectionInfo.Sections.Count > 0) if (_SectionInfo != null && _SectionInfo.Sections != null && _SectionInfo.Sections.Count > 0)
return "N"; return "N";
if (_Section != null && HasSubsections) if (_Section != null && HasSubsections)
return "N"; return "N";
//if (_Section != null && _Section.MyContent.cont .Sections.Count > 0 && _Section.Steps.Count > 0)
// return "N";
return "Y"; return "Y";
} }
} }
@@ -1013,8 +838,6 @@ namespace VEPROMS.CSLA.Library
{ {
if (MyEnhancedDocuments == null || MyEnhancedDocuments.Count == 0) // clear out the xml node if (MyEnhancedDocuments == null || MyEnhancedDocuments.Count == 0) // clear out the xml node
{ {
//XmlNode dd = _Xp.XmlContents.SelectSingleNode("//Slave[@index='" + index.ToString() + "']");
//dd.ParentNode.RemoveChild(dd);
List<XmlNode> nodesToDel = new List<XmlNode>(); List<XmlNode> nodesToDel = new List<XmlNode>();
foreach (XmlNode xnr in _Xp.XmlContents.SelectNodes("//Enhanced")) nodesToDel.Add(xnr); foreach (XmlNode xnr in _Xp.XmlContents.SelectNodes("//Enhanced")) nodesToDel.Add(xnr);
if (nodesToDel != null) if (nodesToDel != null)
+48 -212
View File
@@ -1,19 +1,14 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.ComponentModel; using System.ComponentModel;
using DescriptiveEnum;
using System.Xml; using System.Xml;
namespace VEPROMS.CSLA.Library namespace VEPROMS.CSLA.Library
{ {
public partial class EnhancedDocuments : List<EnhancedDocument> public partial class EnhancedDocuments : List<EnhancedDocument>
{ {
public void Add(int type, int itemID) public void Add(int type, int itemID) => Add(new EnhancedDocument(type, itemID));
{ public static EnhancedDocuments Load(XMLProperties _Xp)
Add(new EnhancedDocument(type, itemID));
}
public static EnhancedDocuments Load(XMLProperties _Xp)
{ {
EnhancedDocuments ed = new EnhancedDocuments(); EnhancedDocuments ed = new EnhancedDocuments();
foreach (XmlNode xn in _Xp.XmlContents.SelectNodes("//Enhanced")) foreach (XmlNode xn in _Xp.XmlContents.SelectNodes("//Enhanced"))
@@ -31,45 +26,25 @@ namespace VEPROMS.CSLA.Library
} }
public partial class EnhancedDocument public partial class EnhancedDocument
{ {
private int _Type; public int Type { get; set; }
public int Type public int ItemID { get; set; }
{ public EnhancedDocument() { ;}
get { return _Type; }
set { _Type = value; }
}
private int _ItemID;
public int ItemID
{
get { return _ItemID; }
set { _ItemID = value; }
}
public EnhancedDocument() { ;}
public EnhancedDocument(int type, int itemID) public EnhancedDocument(int type, int itemID)
{ {
Type = type; Type = type;
ItemID = itemID; ItemID = itemID;
} }
public override string ToString() public override string ToString() => $"{Type}.ItemID={ItemID}";
{ }
return string.Format("{0}.ItemID={1}", Type, ItemID);
}
}
[Serializable] [Serializable]
[TypeConverter(typeof(ExpandableObjectConverter))] [TypeConverter(typeof(ExpandableObjectConverter))]
public class StepConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged, IItemConfig public class StepConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged, IItemConfig
{ {
#region DynamicTypeDescriptor #region DynamicTypeDescriptor
internal override bool IsReadOnly internal override bool IsReadOnly => false;
{ #endregion
get { return false; }//_Section == null; } #region XML
} private readonly XMLProperties _Xp;
#endregion
#region XML
private XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
#endregion #endregion
#region Constructors #region Constructors
//PROPGRID: Hide ParentLookup //PROPGRID: Hide ParentLookup
@@ -79,18 +54,8 @@ namespace VEPROMS.CSLA.Library
get { return _Xp.ParentLookup; } get { return _Xp.ParentLookup; }
set { _Xp.ParentLookup = value; } set { _Xp.ParentLookup = value; }
} }
//PROPGRID: Had to comment out NonSerialized to hide AncestorLookup from Property Grid private readonly Step _Step;
//[NonSerialized] private readonly StepInfo _StepInfo;
//private bool _AncestorLookup;
////PROPGRID: Hide AncestorLookup
//[Browsable(false)]
//public bool AncestorLookup
//{
// get { return _AncestorLookup; }
// set { _AncestorLookup = value; }
//}
private Step _Step;
private StepInfo _StepInfo;
public StepConfig(Step step) public StepConfig(Step step)
{ {
_Step = step; _Step = step;
@@ -111,47 +76,36 @@ namespace VEPROMS.CSLA.Library
_Xp = new XMLProperties(xml); _Xp = new XMLProperties(xml);
} }
public StepConfig() public StepConfig() => _Xp = new XMLProperties();
{ internal string GetValue(string group, string item) => _Xp[group, item];
_Xp = new XMLProperties(); #endregion
} #region Local Properties
internal string GetValue(string group, string item)
{ #endregion
return _Xp[group, item]; #region ToString
} public override string ToString()
#endregion
#region Local Properties
#endregion
#region ToString
public override string ToString()
{ {
string s = _Xp.ToString(); string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty; return s == "<Config/>" || s == "<Config></Config>" ? string.Empty : s;
return s; }
} #endregion
#endregion #region StepAttr
#region StepAttr public int Step_FloatingFoldout
//[Category("Step Attributes")]
//[DisplayName("Step Floating Foldout Association")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("Step Floating Foldout Association")]
public int Step_FloatingFoldout
{ {
get get
{ {
string s = _Xp["Step", "FloatingFoldout"]; string s = _Xp["Step", "FloatingFoldout"];
if (s == string.Empty) return 0; if (s == string.Empty) return 0;
int tst = 0; int tst;
try try
{ {
tst = int.Parse(s); tst = int.Parse(s);
} }
catch (Exception ex) catch (Exception)
{ {
return 0; return 0;
} }
return int.Parse(s); return tst;
} }
set set
{ {
@@ -196,28 +150,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Step_TCAS"); OnPropertyChanged("Step_TCAS");
} }
} }
//// Alternate text to use on the Continuous Action Summary
//public string Step_AlternateContActSumText
//{
// get
// {
// string s = _Xp["Step", "AlternateContActSumText"];
// //If there is no value to get, then we use the actual step text
// if (s == string.Empty) return null;
// return s;
// }
// set
// {
// string s = _Xp["Step", "AlternateContActSumText"];
// if (value == s) return;
// _Xp["Step", "AlternateContActSumText"] = value;
// OnPropertyChanged("Step_AlternateContActSumText");
// }
//}
//[Category("Step Attributes")]
//[DisplayName("Step Placekeeper")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("Step Placekeeper")]
public string Step_Placekeeper public string Step_Placekeeper
{ {
get get
@@ -236,10 +168,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Step_Placekeeper"); OnPropertyChanged("Step_Placekeeper");
} }
} }
//[Category("Step Attributes")]
//[DisplayName("Step Check Off Index")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("Step Check Off Index")]
public int Step_CheckOffIndex public int Step_CheckOffIndex
{ {
get get
@@ -248,24 +176,14 @@ namespace VEPROMS.CSLA.Library
if (s == string.Empty) return 0; if (s == string.Empty) return 0;
// there was an invalid character for Wolf Creek's index. just return // there was an invalid character for Wolf Creek's index. just return
// a 0 if found. The dataloader was fixed (6/8/12) to not migrate the // a 0 if found. The dataloader was fixed (6/8/12) to not migrate the
// bad character, but this was added, in case there are some other conditions. // bad character, but this was added, in case there are some other conditions.
int tst = 0; if (int.TryParse(s, out int tst))
if(int.TryParse(s,out tst)) return tst;
return tst; tst = (int) s[0];
tst = (int) s[0];
tst -= '0'; tst -= '0';
return tst; return tst;
//try
//{
// tst = int.Parse(s);
//}
//catch (Exception ex)
//{
// return 0;
//}
//return int.Parse(s);
} }
set set
{ {
@@ -275,10 +193,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Step_CheckOffIndex"); OnPropertyChanged("Step_CheckOffIndex");
} }
} }
//[Category("Step Attributes")]
//[DisplayName("Step Manual Pagebreak")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("Step Manual Pagebreak")]
public bool Step_ManualPagebreak public bool Step_ManualPagebreak
{ {
get get
@@ -352,10 +266,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Step_SubStepPagebreak"); OnPropertyChanged("Step_SubStepPagebreak");
} }
} }
//[Category("Step Attributes")]
//[DisplayName("Step Change Bar Override")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("Step Change Bar Override")]
public string Step_CBOverride public string Step_CBOverride
{ {
get get
@@ -440,10 +350,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Step_Responsibility"); OnPropertyChanged("Step_Responsibility");
} }
} }
//[Category("Step Attributes")]
//[DisplayName("Step Change By Spell Checker")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("Step Change By Spell Checker")]
// When the spell checker changes text do not assign a change bar but keep existing change bar if it is there // When the spell checker changes text do not assign a change bar but keep existing change bar if it is there
public string Step_SpellCheckerChangedText public string Step_SpellCheckerChangedText
{ {
@@ -557,16 +463,16 @@ namespace VEPROMS.CSLA.Library
{ {
string s = _Xp["Step", "ImageWidth"]; string s = _Xp["Step", "ImageWidth"];
if (s == string.Empty) return 0; if (s == string.Empty) return 0;
int tst = 0; int tst;
try try
{ {
tst = int.Parse(s); tst = int.Parse(s);
} }
catch (Exception ex) catch (Exception)
{ {
return 0; return 0;
} }
return int.Parse(s); return tst;
} }
set set
{ {
@@ -582,16 +488,16 @@ namespace VEPROMS.CSLA.Library
{ {
string s = _Xp["Step", "ImageHeight"]; string s = _Xp["Step", "ImageHeight"];
if (s == string.Empty) return 0; if (s == string.Empty) return 0;
int tst = 0; int tst;
try try
{ {
tst = int.Parse(s); tst = int.Parse(s);
} }
catch (Exception ex) catch (Exception)
{ {
return 0; return 0;
} }
return int.Parse(s); return tst;
} }
set set
{ {
@@ -617,7 +523,6 @@ namespace VEPROMS.CSLA.Library
set set
{ {
_MyEnhancedDocuments = value; _MyEnhancedDocuments = value;
//OnPropertyChanged("EnhancedDocuments");
} }
} }
public void AddEnhancedDocument(int type, int itemid) public void AddEnhancedDocument(int type, int itemid)
@@ -637,7 +542,6 @@ namespace VEPROMS.CSLA.Library
// so that what remains are those that need added to xml that will then be written to database // so that what remains are those that need added to xml that will then be written to database
foreach (XmlNode xn in _Xp.XmlContents.SelectNodes("//Enhanced")) foreach (XmlNode xn in _Xp.XmlContents.SelectNodes("//Enhanced"))
{ {
//EnhancedDocument tmp = edsToAdd[int.Parse(xn.Attributes["Type"].Value)];
EnhancedDocument tmp = edsToAdd.GetByType(int.Parse(xn.Attributes["Type"].Value)); EnhancedDocument tmp = edsToAdd.GetByType(int.Parse(xn.Attributes["Type"].Value));
if (tmp != null) if (tmp != null)
{ {
@@ -659,74 +563,6 @@ namespace VEPROMS.CSLA.Library
xa.Value = edadd.ItemID.ToString(); xa.Value = edadd.ItemID.ToString();
} }
} }
//public string Step_SourceToBackground
//{
// get
// {
// string s = _Xp["Step", "SourceToBackground"];
// if (s == string.Empty) return null;
// return s;
// }
// set
// {
// string s = _Xp["Step", "SourceToBackground"];
// if (value != null && value.ToString() == s) return;
// if (value == null && s != null) _Xp["Step", "SourceToBackground"] = null;
// else _Xp["Step", "SourceToBackground"] = value.ToString();
// OnPropertyChanged("Step_SourceToBackground");
// }
//}
//public string Step_BackgroundToSource
//{
// get
// {
// string s = _Xp["Step", "BackgroundToSource"];
// if (s == string.Empty) return null;
// return s;
// }
// set
// {
// string s = _Xp["Step", "BackgroundToSource"];
// if (value != null && value.ToString() == s) return;
// if (value == null && s != null) _Xp["Step", "BackgroundToSource"] = null;
// else _Xp["Step", "BackgroundToSource"] = value.ToString();
// OnPropertyChanged("Step_BackgroundToSource");
// }
//}
//public string Step_SourceToDeviation
//{
// get
// {
// string s = _Xp["Step", "SourceToDeviation"];
// if (s == string.Empty) return null;
// return s;
// }
// set
// {
// string s = _Xp["Step", "SourceToDeviation"];
// if (value != null && value.ToString() == s) return;
// if (value == null && s != null) _Xp["Step", "SourceToDeviation"] = null;
// else _Xp["Step", "SourceToDeviation"] = value.ToString();
// OnPropertyChanged("Step_SourceToDeviation");
// }
//}
//public string Step_DeviationToSource
//{
// get
// {
// string s = _Xp["Step", "DeviationToSource"];
// if (s == string.Empty) return null;
// return s;
// }
// set
// {
// string s = _Xp["Step", "DeviationToSource"];
// if (value != null && value.ToString() == s) return;
// if (value == null && s != null) _Xp["Step", "DeviationToSource"] = null;
// else _Xp["Step", "DeviationToSource"] = value.ToString();
// OnPropertyChanged("Step_DeviationToSource");
// }
//}
#endregion #endregion
#region IItemConfig Members #region IItemConfig Members
@@ -1,6 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel; using System.ComponentModel;
namespace VEPROMS.CSLA.Library namespace VEPROMS.CSLA.Library
@@ -9,11 +7,7 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))] [TypeConverter(typeof(ExpandableObjectConverter))]
public class TransitionConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged public class TransitionConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{ {
private XMLProperties _Xp; private readonly XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
public TransitionConfig(string xml) public TransitionConfig(string xml)
{ {
if (xml == string.Empty) xml = "<Config/>"; if (xml == string.Empty) xml = "<Config/>";
@@ -38,8 +32,7 @@ namespace VEPROMS.CSLA.Library
public override string ToString() public override string ToString()
{ {
string s = _Xp.ToString(); string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty; return s == "<Config/>" || s == "<Config></Config>" ? string.Empty : s;
return s;
} }
#region GeneralTransitionProperties #region GeneralTransitionProperties
[Category("Formatted")] // format transition, i.e. include page number [Category("Formatted")] // format transition, i.e. include page number
@@ -1,6 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel; using System.ComponentModel;
namespace VEPROMS.CSLA.Library namespace VEPROMS.CSLA.Library
@@ -9,11 +7,7 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))] [TypeConverter(typeof(ExpandableObjectConverter))]
public class UserConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged public class UserConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{ {
private XMLProperties _Xp; private readonly XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
public UserConfig(string xml) public UserConfig(string xml)
{ {
if (xml == string.Empty) xml = "<Config/>"; if (xml == string.Empty) xml = "<Config/>";
@@ -26,8 +20,7 @@ namespace VEPROMS.CSLA.Library
public override string ToString() public override string ToString()
{ {
string s = _Xp.ToString(); string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty; return s == "<Config/>" || s == "<Config></Config>" ? string.Empty : s;
return s;
} }
#region UserCategory // from user.cfg #region UserCategory // from user.cfg
[Category("User")] [Category("User")]
@@ -1,6 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using System.Xml; using System.Xml;
@@ -47,12 +45,9 @@ namespace VEPROMS.CSLA.Library
set { _ParentLookup = value; } set { _ParentLookup = value; }
} }
[NonSerialized] [NonSerialized]
XmlDocument _XmlContents; readonly XmlDocument _XmlContents;
public XmlDocument XmlContents public XmlDocument XmlContents => _XmlContents;
{ private XmlNode GetGroup(string group)
get { return _XmlContents; }
}
private XmlNode GetGroup(string group)
{ {
XmlNodeList xl = _XmlContents.DocumentElement.SelectNodes(string.Format("//{0}", group)); XmlNodeList xl = _XmlContents.DocumentElement.SelectNodes(string.Format("//{0}", group));
if(xl.Count == 0 && System.Text.RegularExpressions.Regex.IsMatch(group,"^[A-Za-z0-9]+$")) if(xl.Count == 0 && System.Text.RegularExpressions.Regex.IsMatch(group,"^[A-Za-z0-9]+$"))
@@ -72,7 +67,6 @@ namespace VEPROMS.CSLA.Library
} }
private XmlAttribute GetItem(XmlNode xx, string item) private XmlAttribute GetItem(XmlNode xx, string item)
{ {
//XmlNodeList xl = xx.SelectNodes(string.Format("@{0}", item));
XmlNodeList xl = xx.SelectNodes( XmlNodeList xl = xx.SelectNodes(
string.Format("@*[translate(local-name(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')='{0}']", item.ToLower())); string.Format("@*[translate(local-name(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')='{0}']", item.ToLower()));
switch (xl.Count) switch (xl.Count)
@@ -87,11 +81,8 @@ namespace VEPROMS.CSLA.Library
throw new XmlPropertiesException("Found more than one node @{0}", item); throw new XmlPropertiesException("Found more than one node @{0}", item);
} }
} }
public string ParentValue(string group, string item) public string ParentValue(string group, string item) => OnLookInAncestor(this, new XMLPropertiesArgs(group, item, true));
{ public string this[string group, string item]
return OnLookInAncestor(this, new XMLPropertiesArgs(group, item, true));
}
public string this[string group, string item]
{ {
get get
{ {
@@ -162,41 +153,26 @@ namespace VEPROMS.CSLA.Library
} }
public partial class XMLPropertiesArgs public partial class XMLPropertiesArgs
{ {
#region Business Methods #region Business Methods
private string _Group; public string Group { get; set; }
public string Group public string Item { get; set; }
{
get { return _Group; }
set { _Group = value; }
}
private string _Item;
public string Item
{
get { return _Item; }
set { _Item = value; }
}
private bool _AncestorLookup;
public bool AncestorLookup public bool AncestorLookup { get; set; }
{
get { return _AncestorLookup; }
set { _AncestorLookup = value; }
}
#endregion #endregion
#region Factory Methods #region Factory Methods
private XMLPropertiesArgs() { ;} private XMLPropertiesArgs() { ;}
public XMLPropertiesArgs(string group, string item) public XMLPropertiesArgs(string group, string item)
{ {
_Group=group; Group=group;
_Item=item; Item=item;
_AncestorLookup = false; AncestorLookup = false;
} }
public XMLPropertiesArgs(string group, string item, bool ancestorLookup) public XMLPropertiesArgs(string group, string item, bool ancestorLookup)
{ {
_Group = group; Group = group;
_Item = item; Item = item;
_AncestorLookup = ancestorLookup; AncestorLookup = ancestorLookup;
} }
#endregion #endregion
} }
@@ -1,8 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VEPROMS.CSLA.Library namespace VEPROMS.CSLA.Library
{ {
@@ -0,0 +1,8 @@
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Not modifying Naming Styles")]
@@ -148,7 +148,6 @@
<Compile Include="Extension\DROUsagesExt.cs" /> <Compile Include="Extension\DROUsagesExt.cs" />
<Compile Include="Extension\FigureExt.cs" /> <Compile Include="Extension\FigureExt.cs" />
<Compile Include="Extension\FolderExt.cs" /> <Compile Include="Extension\FolderExt.cs" />
<Compile Include="Extension\FontTab.cs" />
<Compile Include="Extension\FormatExt.cs" /> <Compile Include="Extension\FormatExt.cs" />
<Compile Include="Extension\GridExt.cs" /> <Compile Include="Extension\GridExt.cs" />
<Compile Include="Extension\ItemExt.cs" /> <Compile Include="Extension\ItemExt.cs" />
@@ -388,6 +387,7 @@
<Compile Include="Generated\ZContentInfo.cs" /> <Compile Include="Generated\ZContentInfo.cs" />
<Compile Include="Generated\ZTransition.cs" /> <Compile Include="Generated\ZTransition.cs" />
<Compile Include="Generated\ZTransitionInfo.cs" /> <Compile Include="Generated\ZTransitionInfo.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Minimal\AnnotationstypeSections.cs" /> <Compile Include="Minimal\AnnotationstypeSections.cs" />
<Compile Include="Minimal\ChangeBarAuditHistory.cs" /> <Compile Include="Minimal\ChangeBarAuditHistory.cs" />
<Compile Include="Minimal\Maintenance.cs" /> <Compile Include="Minimal\Maintenance.cs" />
@@ -1,41 +1,26 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using VEPROMS.CSLA.Library;
using Volian.Base.Library;
using JR.Utils.GUI.Forms;
using System.Threading; using System.Threading;
namespace VEPROMS.CSLA.Library namespace VEPROMS.CSLA.Library
{ {
public partial class frmRofstLoadStatus : Form public partial class frmRofstLoadStatus : Form
{ {
#region Fields #region Fields
#endregion #endregion
#region Properties #region Properties
public string Title public string Title => lblTitle.Text;
{
get { return lblTitle.Text; }
}
public string DisplayText public string DisplayText => statusProgressBar.Text;
{
get { return statusProgressBar.Text; }
}
#endregion #endregion
#region Constructor #region Constructor
public frmRofstLoadStatus() public frmRofstLoadStatus()
{ {
// B2022-107: Display Progress Bar Messages/Statuses when a new ROFST binary file is loaded into the database // B2022-107: Display Progress Bar Messages/Statuses when a new ROFST binary file is loaded into the database
// Initialize Base Component // Initialize Base Component
@@ -64,14 +49,14 @@ namespace VEPROMS.CSLA.Library
lblTitle.Text = title; lblTitle.Text = title;
this.Refresh(); Refresh();
Application.DoEvents(); Application.DoEvents();
// Check if Finalizing Status/Progress Bar // Check if Finalizing Status/Progress Bar
if (curVal >= 100) if (curVal >= 100)
{ {
Thread.Sleep(3000); Thread.Sleep(3000);
this.Close(); Close();
} }
} }