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.Collections.Generic;
using System.Text;
using System.ComponentModel;
namespace VEPROMS.CSLA.Library
@@ -11,35 +9,23 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))]
public class AnnotationConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{
private XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
private readonly XMLProperties _Xp;
public AnnotationConfig(string xml)
{
if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml);
}
public AnnotationConfig()
{
_Xp = new XMLProperties();
}
public override string ToString()
public AnnotationConfig() => _Xp = new XMLProperties();
public override string ToString()
{
string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty;
return s;
}
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 string GetValue(string group, string item) => _Xp[group, item];
public void SetValue(string group, string item, string newvalue) => _Xp[group, item] = newvalue;
}
}
}
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
namespace VEPROMS.CSLA.Library
@@ -9,12 +7,9 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))]
public class AnnotationTypeConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{
private XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
public AnnotationTypeConfig(string xml)
private readonly XMLProperties _Xp;
public AnnotationTypeConfig(string xml)
{
if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml);
@@ -48,16 +43,16 @@ namespace VEPROMS.CSLA.Library
{
string s = _Xp["PrintableText", "XLocation"];
if (s == string.Empty) return 0;
int tst = 0;
int tst;
try
{
tst = int.Parse(s);
}
catch (Exception ex)
{
catch (Exception)
{
return 0;
}
return int.Parse(s);
return tst;
}
set
{
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
namespace VEPROMS.CSLA.Library
@@ -9,21 +7,14 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))]
public class AssociationConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{
#region DynamicTypeDescriptor
internal override bool IsReadOnly
{
get { return _Association == null; }
}
#endregion
#region XML
private XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
#region DynamicTypeDescriptor
internal override bool IsReadOnly => _Association == null;
#endregion
#region XML
private readonly XMLProperties _Xp;
#endregion
#region Constructors
private Association _Association;
private readonly Association _Association;
public AssociationConfig(Association association)
{
_Association = association;
@@ -31,7 +22,7 @@ namespace VEPROMS.CSLA.Library
if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml);
}
private AssociationInfo _AssociationInfo;
private readonly AssociationInfo _AssociationInfo;
public AssociationConfig(AssociationInfo association)
{
_AssociationInfo = association;
@@ -39,24 +30,17 @@ namespace VEPROMS.CSLA.Library
if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml);
}
public AssociationConfig(string xml)
{
_Xp = new XMLProperties(xml);
}
public AssociationConfig()
public AssociationConfig(string xml) => _Xp = new XMLProperties(xml);
public AssociationConfig()
{
string xml = "<Config/>";
_Xp = new XMLProperties(xml);
}
internal string GetValue(string group, string item)
{
return _Xp[group, item];
}
#endregion
public Association MyAssociation
{ get { return _Association; } }
#region RODefaults // From proc.ini
[Category("Referenced Objects")]
internal string GetValue(string group, string item) => _Xp[group, item];
#endregion
public Association MyAssociation => _Association;
#region RODefaults // From proc.ini
[Category("Referenced Objects")]
[DisplayName("Default RO Prefix")]
[RefreshProperties(RefreshProperties.All)]
[Description("Setpoint Prefix")]
@@ -146,9 +130,8 @@ namespace VEPROMS.CSLA.Library
public override string ToString()
{
string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></config>") return string.Empty;
return s;
}
#endregion
}
return s == "<Config/>" || s == "<Config></config>" ? string.Empty : s;
}
#endregion
}
}
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Drawing;
@@ -8,9 +7,9 @@ namespace VEPROMS.CSLA.Library
{
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 Regex byName = new Regex(@"Color \[(.*)\]");
private static Regex byRGB = new Regex(@"[0-9]*,[0-9]*,[0-9]*");
private static readonly Regex byARGB = new Regex(@"Color \[A=([0-9]*), R=([0-9]*), G=([0-9]*), B=([0-9]*)\]");
private static readonly Regex byName = new Regex(@"Color \[(.*)\]");
private static readonly Regex byRGB = new Regex(@"[0-9]*,[0-9]*,[0-9]*");
public static Color ColorFromString(string sColor)
{
if (sColor == string.Empty) return Color.Empty;
@@ -59,12 +58,7 @@ namespace VEPROMS.CSLA.Library
return ConvertRGBToName[tmp.Name];
return tmp;
}
public static Color FindKnownColor(Color tmp)
{
if (ConvertRGBToName.ContainsKey(tmp.Name))
return ConvertRGBToName[tmp.Name];
return tmp;
}
public static Color FindKnownColor(Color tmp) => ConvertRGBToName.ContainsKey(tmp.Name) ? ConvertRGBToName[tmp.Name] : tmp;
}
}
}
@@ -1,13 +1,8 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using DescriptiveEnum;
namespace VEPROMS.CSLA.Library
{
//class ConfigEnum
//{
//C2022-004 Added option for Unit Specific Watermark
[TypeConverter(typeof(EnumDescConverter))]
public enum PrintWatermark : int
File diff suppressed because it is too large Load Diff
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Drawing;
using System.Text.RegularExpressions;
namespace VEPROMS.CSLA.Library
{
@@ -12,15 +8,11 @@ namespace VEPROMS.CSLA.Library
public class DocumentConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{
#region XML
private XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
private readonly XMLProperties _Xp;
#endregion
#region Constructors
public Document _Document;
private DocumentInfo _DocumentInfo;
private readonly DocumentInfo _DocumentInfo;
public DocumentConfig(Document document)
{
_Document = document;
@@ -35,13 +27,10 @@ namespace VEPROMS.CSLA.Library
if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml);
}
internal string GetValue(string group, string item)
{
return _Xp[group, item];
}
#endregion
#region Properties
[Category("General")]
internal string GetValue(string group, string item) => _Xp[group, item];
#endregion
#region Properties
[Category("General")]
[DisplayName("Name")]
[Description("Name")]
public string Name
@@ -100,48 +89,13 @@ namespace VEPROMS.CSLA.Library
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
#region ToString
public override string ToString()
{
string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty;
return s;
}
#endregion
}
return s == "<Config/>" || s == "<Config></Config>" ? string.Empty : s;
}
#endregion
}
}
@@ -1,17 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Xml;
using System.Xml.Serialization;
using System.Xml.Schema;
namespace VEPROMS.CSLA.Library
{
public class DynamicPropertyDescriptor : PropertyDescriptor
{
private PropertyDescriptor _BasePropertyDescriptor;
private ConfigDynamicTypeDescriptor _Instance;
private readonly PropertyDescriptor _BasePropertyDescriptor;
private readonly ConfigDynamicTypeDescriptor _Instance;
public DynamicPropertyDescriptor(ConfigDynamicTypeDescriptor instance, PropertyDescriptor basePropertyDescriptor)
: base(basePropertyDescriptor)
@@ -37,16 +33,15 @@ namespace VEPROMS.CSLA.Library
{ _BasePropertyDescriptor.SetValue(component, value); }
}
[Serializable()]
public class ConfigDynamicTypeDescriptor //: ICustomTypeDescriptor//, ISupportInitialize
public class ConfigDynamicTypeDescriptor
{
#region Events
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(String info)
{
_IsDirty = true;
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(info));
}
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(info));
}
[NonSerialized]
private bool _IsDirty = false;
[XmlIgnore]
@@ -57,54 +52,11 @@ namespace VEPROMS.CSLA.Library
set { _IsDirty = value; }
}
#endregion
[NonSerialized]
private PropertyDescriptorCollection dynamicProps;
private bool _IsReadOnly = false;
internal virtual bool IsReadOnly
{
get { return _IsReadOnly; }
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.ComponentModel;
using System.Drawing;
using System.Drawing.Design;
using System.Reflection;
using System.Collections;
using System.Data;
@@ -97,26 +95,26 @@ namespace DescriptiveEnum
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);
}
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);
}
@@ -125,7 +123,8 @@ namespace DescriptiveEnum
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();
FieldInfo[] fis = myVal.GetFields();
@@ -133,7 +132,6 @@ namespace DescriptiveEnum
{
DescriptionAttribute[] attributes =(DescriptionAttribute[])fi.GetCustomAttributes(
typeof(DescriptionAttribute), false);
//if (attributes.Length > 0)
if (fi.Name != "value__")
values.Add(fi.GetValue(fi.Name));
}
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.ComponentModel;
@@ -8,23 +6,13 @@ namespace VEPROMS.CSLA.Library
{
public class EnumDetail<T>
{
private T _EValue;
public T EValue
{
get { return _EValue; }
set { _EValue = value; }
}
private string _Name;
public T EValue { get; set; }
public string Name
public string Name { get; set; }
public EnumDetail(string name, T eValue)
{
get { return _Name; }
set { _Name = value; }
}
public EnumDetail(string name, T eValue)
{
_Name = name;
_EValue = eValue;
Name = name;
EValue = eValue;
}
public static EnumDetail<T>[] Details()
{
+22 -250
View File
@@ -1,29 +1,18 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Drawing;
using DescriptiveEnum;
namespace VEPROMS.CSLA.Library
{
[Serializable]
[TypeConverter(typeof(ExpandableObjectConverter))]
//public class FolderConfig : INotifyPropertyChanged
public class FolderConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{
#region DynamicTypeDescriptor
internal override bool IsReadOnly
{
get { return _Folder == null; }
}
#endregion
#region XML
private XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
#region DynamicTypeDescriptor
internal override bool IsReadOnly => _Folder == null;
#endregion
#region XML
private readonly XMLProperties _Xp;
#endregion
#region Constructors
//PROPGRID: Hide ParentLookup
@@ -33,19 +22,8 @@ namespace VEPROMS.CSLA.Library
get { return _Xp.ParentLookup; }
set { _Xp.ParentLookup = value; }
}
//PROPGRID: Hide AncestorLookup
//PROPGRID: Needed to comment out [NonSerialized] in order to hide this field from the property grid
//[NonSerialized]
//[Browsable(false)]
//private bool _AncestorLookup;
//[Browsable(false)]
//public bool AncestorLookup
//{
// get { return _AncestorLookup; }
// set { _AncestorLookup = value; }
//}
private Folder _Folder;
private FolderInfo _FolderInfo;
private readonly Folder _Folder;
private readonly FolderInfo _FolderInfo;
public FolderConfig(Folder folder)
{
_Folder = folder;
@@ -75,18 +53,6 @@ namespace VEPROMS.CSLA.Library
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)
{
_FolderInfo = folderInfo;
@@ -100,21 +66,12 @@ namespace VEPROMS.CSLA.Library
if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml);
}
public FolderConfig()
{
_Xp = new XMLProperties("<Config/>");
}
public string GetValue(string group, string item)
{
return _Xp[group, item];
}
public void SetValue(string group, string item, string newvalue)
{
_Xp[group, item] = newvalue;
}
#endregion
#region Local Properties
[Category("General")]
public FolderConfig() => _Xp = new XMLProperties("<Config/>");
public string GetValue(string group, string item) => _Xp[group, item];
public void SetValue(string group, string item, string newvalue) => _Xp[group, item] = newvalue;
#endregion
#region Local Properties
[Category("General")]
[DisplayName("Name")]
[Description("Name")]
public string Name
@@ -189,7 +146,6 @@ namespace VEPROMS.CSLA.Library
if (_Folder != null)
{
_Folder.MyFormat = FormatList.ToFormat(value);
//_Folder.ActiveFormat = null;
}
}
}
@@ -206,24 +162,17 @@ namespace VEPROMS.CSLA.Library
return null;
}
}
public Folder MyFolder
{ get { return _Folder; } }
public FolderInfo MyFolderInfo
{ get { return _FolderInfo; } }
#endregion
#region ToString
public override string ToString()
public Folder MyFolder => _Folder;
public FolderInfo MyFolderInfo => _FolderInfo;
#endregion
#region ToString
public override string ToString()
{
string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty;
return s;
}
#endregion
#region GraphicsCategory // From veproms.ini
public bool CanWrite(string str)
{
return true;
}
return s == "<Config/>" || s == "<Config></Config>" ? string.Empty : s;
}
#endregion
#region GraphicsCategory // From veproms.ini
[Category("Referenced Objects")]
[DisplayName("Graphic File Extension")]
[RefreshProperties(RefreshProperties.All)]
@@ -304,103 +253,6 @@ namespace VEPROMS.CSLA.Library
}
}
#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
[Category("Print Settings")]
[DisplayName("Override Underline Thickness (dots)")]
@@ -635,20 +487,6 @@ namespace VEPROMS.CSLA.Library
}
#endregion
#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")]
[DisplayName("Step Editor Columns")]
[RefreshProperties(RefreshProperties.All)]
@@ -726,10 +564,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Print_NumCopies");
}
}
//public enum PrintPagination : int
//{
// Free = 0, Fixed, Auto
//}
[Category("Print Settings")]
[DisplayName("Pagination")]
[RefreshProperties(RefreshProperties.All)]
@@ -767,13 +601,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Print_Pagination");
}
}
//[TypeConverter(typeof(EnumDescConverter))]
//public enum PrintWatermark : int
//{
// None = 0, Reference, Draft, Master, Sample,
// [Description("Information Only")]
// InformationOnly
//}
[Category("Print Settings")]
[DisplayName("Watermark")]
@@ -812,23 +639,6 @@ namespace VEPROMS.CSLA.Library
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")]
[DisplayName("Change Bar")]
[RefreshProperties(RefreshProperties.All)]
@@ -866,24 +676,6 @@ namespace VEPROMS.CSLA.Library
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")]
[DisplayName("Change Bar Position")]
[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")]
[DisplayName("Change bar Text Type")]
[RefreshProperties(RefreshProperties.All)]
+81 -226
View File
@@ -1,15 +1,10 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.ComponentModel;
using DescriptiveEnum;
using System.Xml;
using System.Xml.Serialization;
using System.Xml.Schema;
using System.Windows.Forms;
using Volian.Base.Library;
using System.Drawing;
namespace VEPROMS.CSLA.Library
{
@@ -28,13 +23,6 @@ namespace VEPROMS.CSLA.Library
get { return false; }
}
#endregion
#region XML
private XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
#endregion
#region Attributes
[XmlAttribute("Name")]
private string _Name;
@@ -69,27 +57,14 @@ namespace VEPROMS.CSLA.Library
}
#endregion Elements
#region Constructors
private Format _Format;
private FormatInfo _FormatInfo;
public FormatConfig(string xml)
{
if (xml == string.Empty) xml = "<FormatConfig/>";
}
public FormatConfig(FormatInfo fi)
{
_FormatInfo = fi;
}
public FormatConfig(Format f)
{
_Format = f;
}
public FormatConfig()
{
PlantFormat = new PlantFormatx();
}
#endregion Constructors
#region Serialize
public string ConvertToString()
private readonly Format _Format;
private readonly FormatInfo _FormatInfo;
public FormatConfig(FormatInfo fi) => _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);
}
@@ -131,11 +106,8 @@ namespace VEPROMS.CSLA.Library
{
}
public override string ToString()
{
return "Plant Format";
}
}
public override string ToString() => "Plant Format";
}
#endregion PlantFormat
#region FormatData
// 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();
}
public override string ToString()
{
return "Format Data";
}
}
public override string ToString() => "Format Data";
}
#endregion FormatData
#region Flags
[Serializable]
@@ -242,27 +211,15 @@ namespace VEPROMS.CSLA.Library
[Editor(typeof(PropGridCollEditor), typeof(System.Drawing.Design.UITypeEditor))]
public class ReplaceStrData : List<ReplaceStr>
{
[Browsable(false)]
public int Capacity { get { return base.Capacity; } }
[Browsable(false)]
public int Count { get { return base.Count; } }
public ReplaceStr this[int index]
{
get { return (ReplaceStr)base[index]; }
}
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);
}
}
[Browsable(false)]
public new int Capacity => base.Capacity;
[Browsable(false)]
public new int Count => base.Count;
public new ReplaceStr this[int index] => (ReplaceStr)base[index];
public string ConvertToString() => GenericSerializer<ReplaceStrData>.StringSerialize(this);
public override string ToString() => $"Replace Words List Count = {base.Count}";
public static ReplaceStrData Get(string xml) => GenericSerializer<ReplaceStrData>.StringDeserialize(xml);
}
#endregion ReplaceStrData
#region ReplaceStr
@@ -303,19 +260,10 @@ namespace VEPROMS.CSLA.Library
public ReplaceStr()
{
}
public string ConvertToString()
{
return GenericSerializer<ReplaceStr>.StringSerialize(this);
}
public override string ToString()
{
return ReplaceWord;
}
public static ReplaceStr Get(string xml)
{
return GenericSerializer<ReplaceStr>.StringDeserialize(xml);
}
}
public string ConvertToString() => GenericSerializer<ReplaceStr>.StringSerialize(this);
public override string ToString() => ReplaceWord;
public static ReplaceStr Get(string xml) => GenericSerializer<ReplaceStr>.StringDeserialize(xml);
}
#endregion ReplaceStr
#region CheckOffHeaders (list)
[Serializable]
@@ -323,23 +271,14 @@ namespace VEPROMS.CSLA.Library
[Editor(typeof(PropGridCollEditor), typeof(System.Drawing.Design.UITypeEditor))]
public class CheckOffHeaderList : List<CheckOffHeader>
{
[Browsable(false)]
public int Capacity { get { return base.Capacity; } }
[Browsable(false)]
public int Count { get { return base.Count; } }
public CheckOffHeader this[int index]
{
get { return (CheckOffHeader)base[index]; }
}
public string ConvertToString()
{
return GenericSerializer<CheckOffHeaderList>.StringSerialize(this);
}
public override string ToString()
{
return "CheckOffHeader Count = " + base.Count.ToString();
}
}
[Browsable(false)]
public new int Capacity => base.Capacity;
[Browsable(false)]
public new int Count { get { return base.Count; } }
public new CheckOffHeader this[int index] => (CheckOffHeader)base[index];
public string ConvertToString() => GenericSerializer<CheckOffHeaderList>.StringSerialize(this);
public override string ToString() => $"CheckOffHeader Count = {base.Count}";
}
#endregion CheckOffHeaders
#region CheckOffHeader
[Serializable]
@@ -382,15 +321,9 @@ namespace VEPROMS.CSLA.Library
public CheckOffHeader()
{
}
public string ConvertToString()
{
return GenericSerializer<CheckOffHeader>.StringSerialize(this);
}
public override string ToString()
{
return CheckOffHeading;
}
}
public string ConvertToString() => GenericSerializer<CheckOffHeader>.StringSerialize(this);
public override string ToString() => CheckOffHeading;
}
#endregion CheckOffHeader
#region CheckOffs (list)
[Serializable]
@@ -399,22 +332,13 @@ namespace VEPROMS.CSLA.Library
public class CheckOffList : List<CheckOff>
{
[Browsable(false)]
public int Capacity { get { return base.Capacity; } }
public new int Capacity { get { return base.Capacity; } }
[Browsable(false)]
public int Count { get { return base.Count; } }
public CheckOff this[int index]
{
get { return (CheckOff)base[index]; }
}
public string ConvertToString()
{
return GenericSerializer<CheckOffList>.StringSerialize(this);
}
public override string ToString()
{
return "CheckOff Count = " + base.Count.ToString();
}
}
public new int Count { get { return base.Count; } }
public new CheckOff this[int index] => (CheckOff)base[index];
public string ConvertToString() => GenericSerializer<CheckOffList>.StringSerialize(this);
public override string ToString() => $"CheckOff Count = {base.Count}";
}
#endregion CheckOffs
#region CheckOff
[Serializable]
@@ -457,15 +381,9 @@ namespace VEPROMS.CSLA.Library
public CheckOff()
{
}
public string ConvertToString()
{
return GenericSerializer<CheckOff>.StringSerialize(this);
}
public override string ToString()
{
return MenuItem;
}
}
public string ConvertToString() => GenericSerializer<CheckOff>.StringSerialize(this);
public override string ToString() => MenuItem;
}
#endregion CheckOff
#region ShwRplWds
[Serializable]
@@ -508,15 +426,9 @@ namespace VEPROMS.CSLA.Library
public ShwRplWds()
{
}
public string ConvertToString()
{
return GenericSerializer<ShwRplWds>.StringSerialize(this);
}
public override string ToString()
{
return MenuItem;
}
}
public string ConvertToString() => GenericSerializer<ShwRplWds>.StringSerialize(this);
public override string ToString() => MenuItem;
}
#endregion ShwRplWds
#region StepData (list)
[Serializable]
@@ -525,26 +437,14 @@ namespace VEPROMS.CSLA.Library
public class StepData : List<Step>
{
[Browsable(false)]
public int Capacity { get { return base.Capacity; } }
public new int Capacity { get { return base.Capacity; } }
[Browsable(false)]
public int Count { get { return base.Count; } }
public Step this[int index]
{
get { return (Step)base[index]; }
}
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);
}
}
public new int Count { get { return base.Count; } }
public new Step this[int index] => (Step)base[index];
public string ConvertToString() => GenericSerializer<StepData>.StringSerialize(this);
public override string ToString() => $"Step Count = {base.Count}";
public static StepData Get(string xml) => GenericSerializer<StepData>.StringDeserialize(xml);
}
#endregion StepData
#region Step
[Serializable]
@@ -577,28 +477,16 @@ namespace VEPROMS.CSLA.Library
public Step()
{
}
public string ConvertToString()
{
return GenericSerializer<Step>.StringSerialize(this);
}
public override string ToString()
{
return Type;
}
public static Step Get(string xml)
{
return GenericSerializer<Step>.StringDeserialize(xml);
}
}
public string ConvertToString() => GenericSerializer<Step>.StringSerialize(this);
public override string ToString() => Type;
public static Step Get(string xml) => GenericSerializer<Step>.StringDeserialize(xml);
}
#endregion Step
#region FontDesc
[Serializable]
[TypeConverter(typeof(ExpandableObjectConverter))]
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")]
[Browsable(false)]
public string Font
@@ -633,19 +521,10 @@ namespace VEPROMS.CSLA.Library
public FontDesc()
{
}
public string ConvertToString()
{
return GenericSerializer<FontDesc>.StringSerialize(this);
}
public override string ToString()
{
return "FontDescription";
}
public static FontDesc Get(string xml)
{
return GenericSerializer<FontDesc>.StringDeserialize(xml);
}
}
public string ConvertToString() => GenericSerializer<FontDesc>.StringSerialize(this);
public override string ToString() => "FontDescription";
public static FontDesc Get(string xml) => GenericSerializer<FontDesc>.StringDeserialize(xml);
}
#endregion Font
#region DocStyles
[Serializable]
@@ -654,22 +533,13 @@ namespace VEPROMS.CSLA.Library
public class DocStyles : List<DocStyle>
{
[Browsable(false)]
public int Capacity { get { return base.Capacity; } }
public new int Capacity { get { return base.Capacity; } }
[Browsable(false)]
public int Count { get { return base.Count; } }
public DocStyle this[int index]
{
get { return (DocStyle)base[index]; }
}
public string ConvertToString()
{
return GenericSerializer<DocStyles>.StringSerialize(this);
}
public override string ToString()
{
return "Section Type Count = " + base.Count.ToString();
}
}
public new int Count { get { return base.Count; } }
public new DocStyle this[int index] => (DocStyle)base[index];
public string ConvertToString() => GenericSerializer<DocStyles>.StringSerialize(this);
public override string ToString() => $"Section Type Count = {base.Count}";
}
#endregion DocStyles
#region DocStyle
[Serializable]
@@ -702,15 +572,9 @@ namespace VEPROMS.CSLA.Library
public DocStyle()
{
}
public string ConvertToString()
{
return GenericSerializer<DocStyle>.StringSerialize(this);
}
public override string ToString()
{
return Name;
}
}
public string ConvertToString() => GenericSerializer<DocStyle>.StringSerialize(this);
public override string ToString() => Name;
}
#endregion DocStyle
#region Layout
[Serializable]
@@ -752,18 +616,12 @@ namespace VEPROMS.CSLA.Library
public Layout()
{
}
public string ConvertToString()
{
return GenericSerializer<Layout>.StringSerialize(this);
}
public override string ToString()
{
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)
public string ConvertToString() => GenericSerializer<Layout>.StringSerialize(this);
public override string ToString() => "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 (PageLength != null) writer.WriteAttributeString("PageLength", PageLength.ToString());
@@ -780,12 +638,9 @@ namespace VEPROMS.CSLA.Library
}
}
public XmlSchema GetSchema()
{
return (null);
}
#endregion
}
public XmlSchema GetSchema() => (null);
#endregion
}
#endregion Layout
}
}
@@ -7,21 +7,14 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))]
public class ImageConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{
#region DynamicTypeDescriptor
internal override bool IsReadOnly
{
get { return _ImageInfo == null; }
}
#endregion
#region XML
private XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
#region DynamicTypeDescriptor
internal override bool IsReadOnly => _ImageInfo == null;
#endregion
#region XML
private readonly XMLProperties _Xp;
#endregion
#region Constructors
private ImageInfo _ImageInfo;
private readonly ImageInfo _ImageInfo;
public ImageConfig(ImageInfo imageInfo)
{
if (imageInfo == null)
@@ -40,13 +33,10 @@ namespace VEPROMS.CSLA.Library
string xml = "<Config/>";
_Xp = new XMLProperties(xml);
}
internal string GetValue(string group, string item)
{
return _Xp[group, item];
}
#endregion
#region Local Properties
[Category("Image")]
internal string GetValue(string group, string item) => _Xp[group, item];
#endregion
#region Local Properties
[Category("Image")]
[Browsable(false)]
[DisplayName("DataSize")]
[RefreshProperties(RefreshProperties.All)]
@@ -57,16 +47,16 @@ namespace VEPROMS.CSLA.Library
{
string s = _Xp["Image", "DataSize"];
if (s == string.Empty) return 0;
int tst = 0;
int tst;
try
{
tst = int.Parse(s);
}
catch (Exception ex)
catch (Exception)
{
return 0;
}
return int.Parse(s);
return tst;
}
set
{
@@ -87,16 +77,16 @@ namespace VEPROMS.CSLA.Library
{
string s = _Xp["Image", "Width"];
if (s == string.Empty) return 0;
int tst = 0;
int tst;
try
{
tst = int.Parse(s);
}
catch (Exception ex)
catch (Exception)
{
return 0;
}
return int.Parse(s);
return tst;
}
set
{
@@ -117,16 +107,16 @@ namespace VEPROMS.CSLA.Library
{
string s = _Xp["Image", "Height"];
if (s == string.Empty) return 0;
int tst = 0;
int tst;
try
{
tst = int.Parse(s);
}
catch (Exception ex)
catch (Exception)
{
return 0;
}
return int.Parse(s);
return tst;
}
set
{
@@ -141,9 +131,8 @@ namespace VEPROMS.CSLA.Library
public override string ToString()
{
string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty;
return s;
}
#endregion
}
return s == "<Config/>" || s == "<Config></Config>" ? string.Empty : s;
}
#endregion
}
}
+40 -174
View File
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using DescriptiveEnum;
using System.Xml;
namespace VEPROMS.CSLA.Library
@@ -11,18 +8,11 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))]
public class ProcedureConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged, IItemConfig
{
#region DynamicTypeDescriptor
internal override bool IsReadOnly
{
get { return _Procedure == null; }
}
#endregion
#region XML
private XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
#region DynamicTypeDescriptor
internal override bool IsReadOnly => _Procedure == null;
#endregion
#region XML
private readonly XMLProperties _Xp;
#endregion
#region Constructors
//PROPGRID: Hide ParentLookup
@@ -32,24 +22,14 @@ namespace VEPROMS.CSLA.Library
get { return _Xp.ParentLookup; }
set { _Xp.ParentLookup = value; }
}
//PROPGRID: Needed to comment out [NonSerialized] in order to hide AncestorLookup from property grid
//[NonSerialized]
//private bool _AncestorLookup;
////PROPGRID: Hide AncestorLookup
//[Browsable(false)]
//public bool AncestorLookup
//{
// get { return _AncestorLookup; }
// set { _AncestorLookup = value; }
//}
private Procedure _Procedure;
private ProcedureInfo _ProcedureInfo;
private readonly Procedure _Procedure;
private readonly ProcedureInfo _ProcedureInfo;
public ProcedureConfig(Procedure procedure)
{
_Procedure = procedure;
string xml = procedure.MyContent.Config;
if (xml == string.Empty)
xml = "<Config/>";
if (xml == string.Empty)
xml = "<Config/>";
_Xp = new XMLProperties(xml);
// Correct Slaves nodes for Parent Child
ValidateSlaves(_Xp.XmlContents, _Procedure.MyProcedureInfo.MyDocVersion.MultiUnitCount);
@@ -74,7 +54,7 @@ namespace VEPROMS.CSLA.Library
}
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.
{
XmlElement xec = xd.CreateElement("Slave");
@@ -98,9 +78,8 @@ namespace VEPROMS.CSLA.Library
retval = proc.ProcedureConfig.GetValue(args.Group, args.Item);
if (retval != string.Empty) return retval;
}
DocVersionInfo docVersion = proc.ActiveParent as DocVersionInfo;
if (docVersion == null) return string.Empty;
retval = docVersion.DocVersionConfig.GetValue(args.Group, args.Item);
if (!(proc.ActiveParent is DocVersionInfo docVersion)) return string.Empty;
retval = docVersion.DocVersionConfig.GetValue(args.Group, args.Item);
if (retval != string.Empty) return retval;
for (FolderInfo folder = docVersion.MyFolder; folder != null; folder = folder.MyParent)
{
@@ -110,36 +89,19 @@ namespace VEPROMS.CSLA.Library
}
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)
{
_ProcedureInfo = procedureInfo;
string xml = procedureInfo.MyContent.Config;
if (xml == string.Empty)
xml = "<Config/>";
_Xp = new XMLProperties(xml);
if (xml == string.Empty)
xml = "<Config/>";
_Xp = new XMLProperties(xml);
// Fix Slaves nodes for Parent Child
ValidateSlaves(_Xp.XmlContents, _ProcedureInfo.MyDocVersion.MultiUnitCount);
_Xp.AncestorLookup = true;
if (procedureInfo.ActiveParent != null) _Xp.LookInAncestor += new XMLPropertiesEvent(Xp_LookInAncestorFolder);
}
private int _SelectedSlave = 0;
//[Browsable(false)]
public int SelectedSlave
{
get { return _SelectedSlave; }
@@ -150,19 +112,9 @@ namespace VEPROMS.CSLA.Library
if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml);
}
//public ProcedureConfig()
//{
// _Xp = new XMLProperties();
//}
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()
public string GetValue(string group, string item) => _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 (_ProcedureInfo != null) return _ProcedureInfo.ItemID;
@@ -193,19 +145,16 @@ namespace VEPROMS.CSLA.Library
[Description("Old Sequence")]
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; }
}
[Category("Identification")]
//PROPGRID: Hide Dirty
[Browsable(false)]
[DisplayName("Dirty")]
[Description("Dirty")]
public bool Dirty
{
get { return (_Procedure != null ? _Procedure.IsDirty : false); }
}
[Category("Format Settings")]
[Category("Identification")]
//PROPGRID: Hide Dirty
[Browsable(false)]
[DisplayName("Dirty")]
[Description("Dirty")]
public bool Dirty => _Procedure != null && _Procedure.IsDirty;
[Category("Format Settings")]
[DisplayName("Format")]
[Description("Format")]
[TypeConverter(typeof(FormatList))]
@@ -222,7 +171,6 @@ namespace VEPROMS.CSLA.Library
if (_Procedure != null)
{
_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()
{
string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty;
return s;
}
#endregion
#region DelProcReason
[Category("General")]
return s == "<Config/>" || s == "<Config></Config>" ? string.Empty : s;
}
#endregion
#region DelProcReason
[Category("General")]
[DisplayName("DelProcReason")]
[RefreshProperties(RefreshProperties.All)]
[Description("Delete Procedure Reason")]
@@ -283,19 +230,6 @@ namespace VEPROMS.CSLA.Library
}
#endregion
#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")]
[DisplayName("Default Column Mode")]
[RefreshProperties(RefreshProperties.All)]
@@ -375,13 +309,13 @@ namespace VEPROMS.CSLA.Library
{
string s = _Xp["Procedure", "Rev"];
if (SelectedSlave > 0)
s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "Rev"];
s = _Xp[$"Slave[@index='{SelectedSlave}']", "Rev"];
return s;
}
set
{
if (SelectedSlave > 0)
_Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "Rev"] = value; // save selected value
_Xp[$"Slave[@index='{SelectedSlave}']", "Rev"] = value; // save selected value
else
_Xp["Procedure", "Rev"] = value;
OnPropertyChanged("Print_Rev");
@@ -399,13 +333,13 @@ namespace VEPROMS.CSLA.Library
{
string s = _Xp["Procedure", "RevDate"];
if (SelectedSlave > 0)
s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "RevDate"];
s = _Xp[$"Slave[@index='{SelectedSlave}']", "RevDate"];
return s;
}
set
{
if (SelectedSlave > 0)
_Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "RevDate"] = value; // save selected value
_Xp[$"Slave[@index='{SelectedSlave}']", "RevDate"] = value; // save selected value
else
_Xp["Procedure", "RevDate"] = value;
OnPropertyChanged("Print_RevDate");
@@ -443,7 +377,7 @@ namespace VEPROMS.CSLA.Library
{
string s = _Xp["Procedure", "ChangeBarDate"];
if (SelectedSlave > 0)
s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "ChangeBarDate"];
s = _Xp[$"Slave[@index='{SelectedSlave}']", "ChangeBarDate"];
else
{
if (s != "")
@@ -470,7 +404,7 @@ namespace VEPROMS.CSLA.Library
set
{
if (SelectedSlave > 0)
_Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "ChangeBarDate"] = value; // save selected value
_Xp[$"Slave[@index='{SelectedSlave}']", "ChangeBarDate"] = value; // save selected value
else
_Xp["Procedure", "ChangeBarDate"] = value;
OnPropertyChanged("Print_ChangeBarDate");
@@ -487,13 +421,13 @@ namespace VEPROMS.CSLA.Library
{
string s = _Xp["Procedure", "ReviewDate"];
if (SelectedSlave > 0)
s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "ReviewDate"];
s = _Xp[$"Slave[@index='{SelectedSlave}']", "ReviewDate"];
return s;
}
set
{
if (SelectedSlave > 0)
_Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "ReviewDate"] = value; // save selected value
_Xp[$"Slave[@index='{SelectedSlave}']", "ReviewDate"] = value; // save selected value
else
_Xp["Procedure", "ReviewDate"] = value;
OnPropertyChanged("Print_ReviewDate");
@@ -519,12 +453,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Print_NumCopies");
}
}
//public enum PrintPagination : int
//{
// Free = 0, Fixed,
// [Description("Automatic")]
// Auto
//}
[Category("Print Settings")]
[DisplayName("Pagination")]
[RefreshProperties(RefreshProperties.All)]
@@ -562,13 +490,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Print_Pagination");
}
}
//[TypeConverter(typeof(EnumDescConverter))]
//public enum PrintWatermark : int
//{
// None = 0, Reference, Draft, Master, Sample,
// [Description("Information Only")]
// InformationOnly
//}
[Category("Print Settings")]
[DisplayName("Watermark")]
[RefreshProperties(RefreshProperties.All)]
@@ -623,29 +544,12 @@ namespace VEPROMS.CSLA.Library
set
{
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;
_Xp["PrintSettings", "NotInMergeAll"] = ((bool)value).ToString(); // save selected value
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")]
[DisplayName("Change Bar")]
[RefreshProperties(RefreshProperties.All)]
@@ -683,23 +587,6 @@ namespace VEPROMS.CSLA.Library
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")]
[DisplayName("Change Bar Position")]
[RefreshProperties(RefreshProperties.All)]
@@ -737,27 +624,6 @@ namespace VEPROMS.CSLA.Library
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")]
[DisplayName("Change Bar Text Type")]
[RefreshProperties(RefreshProperties.All)]
+51 -64
View File
@@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using DescriptiveEnum;
namespace VEPROMS.CSLA.Library
{
@@ -12,21 +8,14 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))]
public class RODbConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{
#region DynamicTypeDescriptor
internal override bool IsReadOnly
{
get { return _RODb == null; }
}
#endregion
#region XML
private XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
#region DynamicTypeDescriptor
internal override bool IsReadOnly => _RODb == null;
#endregion
#region XML
private readonly XMLProperties _Xp;
#endregion
#region Constructors
private RODb _RODb;
private readonly RODb _RODb;
public RODbConfig(RODb roDb)
{
_RODb = roDb;
@@ -34,7 +23,7 @@ namespace VEPROMS.CSLA.Library
if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml);
}
private RODbInfo _RODbInfo;
private readonly RODbInfo _RODbInfo;
public RODbConfig(RODbInfo roDbInfo)
{
_RODbInfo = roDbInfo;
@@ -52,13 +41,10 @@ namespace VEPROMS.CSLA.Library
string xml = "<Config/>";
_Xp = new XMLProperties(xml);
}
internal string GetValue(string group, string item)
{
return _Xp[group, item];
}
#endregion
#region Local Properties
[Category("General")]
internal string GetValue(string group, string item) => _Xp[group, item];
#endregion
#region Local Properties
[Category("General")]
[DisplayName("ROName")]
[Description("ROName")]
public string ROName
@@ -71,22 +57,20 @@ namespace VEPROMS.CSLA.Library
[Description("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; }
}
public RODb MyRODb
{ get { return _RODb; } }
#endregion
#region ToString
public override string ToString()
public RODb MyRODb => _RODb;
#endregion
#region ToString
public override string ToString()
{
string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty;
return s;
}
#endregion
#region RODefaults
[Category("Referenced Objects")]
return s == "<Config/>" || s == "<Config></Config>" ? string.Empty : s;
}
#endregion
#region RODefaults
[Category("Referenced Objects")]
[DisplayName("Graphic File Extension")]
[RefreshProperties(RefreshProperties.All)]
[Description("Default File Extension")]
@@ -98,38 +82,41 @@ namespace VEPROMS.CSLA.Library
// look in roapp.ini in the FolderPath directory;
// look in top folder's config
// set to Volian default, i.e. "TIF".
string s = GetRoAppIniValue("ROAPP", "Extention");
string s = GetRoAppIniValue("Extention");
if (s == null || s == string.Empty)
s = TopFolderConfigValue("Graphics", "defaultext");
s = TopFolderConfigValue();
if (s == null || s == string.Empty)
return s = "TIF";
return s;
}
}
private string GetRoAppIniValue(string p, string p_2)
{
if (FolderPath == null) return null;
string inipath = FolderPath + @"\roapp.ini";
if (!File.Exists(inipath)) return null;
StreamReader myReader = new StreamReader(inipath);
string sLine;
int indx = -1;
while ((sLine = myReader.ReadLine()) != null)
{
if (sLine.Length > 0 && sLine.Substring(0, 1) != ";")
{
if ((indx = sLine.ToLower().IndexOf(p_2.ToLower())) >= 0)
{
indx = sLine.IndexOf("=", indx + 9);
return sLine.Substring(indx + 1, sLine.Length - indx - 1).Trim();
}
}
}
myReader.Close();
return null;
}
private string TopFolderConfigValue(string p, string p_2)
private string GetRoAppIniValue(string p_2)
{
if (FolderPath == null) return null;
string inipath = FolderPath + @"\roapp.ini";
if (!File.Exists(inipath)) return null;
using (StreamReader myReader = new StreamReader(inipath))
{
string sLine;
int indx = -1;
while ((sLine = myReader.ReadLine()) != null)
{
if (sLine.Length > 0 && sLine.Substring(0, 1) != ";")
{
if ((indx = sLine.ToLower().IndexOf(p_2.ToLower())) >= 0)
{
indx = sLine.IndexOf("=", indx + 9);
return sLine.Substring(indx + 1, sLine.Length - indx - 1).Trim();
}
}
}
myReader.Close();
}
return null;
}
private string TopFolderConfigValue()
{
FolderInfo fi = FolderInfo.GetTop();
return fi.FolderConfig.Graphics_defaultext;
@@ -145,9 +132,9 @@ namespace VEPROMS.CSLA.Library
}
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";
s = TopFolderConfigValue("Graphics", "defaultext");
s = TopFolderConfigValue();
if (s != null && s != string.Empty) return "Default Extension defined in veproms properties";
return "Used program default";
}
+38 -105
View File
@@ -159,16 +159,13 @@ namespace VEPROMS.CSLA.Library
private int _totalRoCnt = 0;
private double _pctComplete = 0;
#endregion
#endregion
#region Properties
#region Properties
public int RofstID
{
get { return _rofstID; }
}
public int RofstID => _rofstID;
public DocVersionInfo MyDocVersionInfo
public DocVersionInfo MyDocVersionInfo
{
get { return _myDocVersionInfo; }
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
public int SelectedSlave
{
get { return (!string.IsNullOrEmpty(_otherChild)) ? Convert.ToInt32(_otherChild) : _selectedSlave; }
}
// C2021-065 see if we need to get the RO information for the "Other" Child applicability value
public int SelectedSlave => (!string.IsNullOrEmpty(_otherChild)) ? Convert.ToInt32(_otherChild) : _selectedSlave;
//C2021-065 used by Barakah Alarms so that we get ROLookUp for the Other applicability
public string OtherChild
//C2021-065 used by Barakah Alarms so that we get ROLookUp for the Other applicability
public string OtherChild
{
get { return _otherChild; }
set { _otherChild = value; }
@@ -237,16 +231,13 @@ namespace VEPROMS.CSLA.Library
set { _autoCombineSingleRetValues = value; }
}
public bool ShowLoadingStatus
{
get { return _showLoadingStatus; }
}
public bool ShowLoadingStatus => _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
_rofstID = rofstID;
@@ -321,31 +312,19 @@ namespace VEPROMS.CSLA.Library
return RofstDataSearch(_rofstID, value, searchTypeID, onlyRoid16, maxNumRecords);
}
public ROFSTLookup.rochild[] GetRoChildrenByID(int id, int dbiID, bool loadChildren = false, bool loadAllChildren = false)
{
return RofstDataGetChildrenByID(_rofstID, dbiID, id, loadChildren, loadAllChildren);
}
public ROFSTLookup.rochild[] GetRoChildrenByID(int id, int dbiID, bool loadChildren = false, bool loadAllChildren = false) => RofstDataGetChildrenByID(_rofstID, dbiID, id, loadChildren, loadAllChildren);
public ROFSTLookup.rochild[] GetRoChildrenByRoid(string roid, bool loadChildren = false, bool loadAllChildren = false)
{
return RofstDataGetChildrenByRoid(_rofstID, roid, loadChildren, loadAllChildren);
}
public ROFSTLookup.rochild[] GetRoChildrenByRoid(string roid, bool loadChildren = false, bool loadAllChildren = false) => RofstDataGetChildrenByRoid(_rofstID, roid, loadChildren, loadAllChildren);
public ROFSTLookup.rochild[] GetRoChildrenByType(E_ROValueType valueTypes, bool loadChildren = false, bool loadAllChildren = false)
{
return RofstDataGetRoChildrenByType(_rofstID, valueTypes, loadChildren, loadAllChildren);
}
public ROFSTLookup.rochild[] GetRoChildrenByType(E_ROValueType valueTypes, bool loadChildren = false, bool loadAllChildren = false) => RofstDataGetRoChildrenByType(_rofstID, valueTypes, loadChildren, loadAllChildren);
#endregion
#endregion
#region (RO Database Info)
#region (RO Database Info)
public int GetRODatabaseTitleIndex(string roid)
{
return Convert.ToInt32("0x" + roid.Substring(0, 4), 16);
}
public int GetRODatabaseTitleIndex(string roid) => Convert.ToInt32("0x" + roid.Substring(0, 4), 16);
public string GetRODatabaseTitle(int idx)
public string GetRODatabaseTitle(int idx)
{
ROFSTLookup.rodbi rd = RofstDataGetDatabaseByID(_rofstID, idx);
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);
}
public ROFSTLookup.rodbi[] GetRODatabaseList(bool loadChildren = false, bool loadAllChildren = false)
{
return RofstDataGetDatabases(_rofstID, loadChildren, loadAllChildren);
}
public ROFSTLookup.rodbi[] GetRODatabaseList(bool loadChildren = false, bool loadAllChildren = false) => 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 accPageExt = string.Empty;
@@ -527,12 +503,9 @@ namespace VEPROMS.CSLA.Library
return (!string.IsNullOrEmpty(retval)) ? retval.Replace("\r\n", @"\par ") : retval;
}
public List<string> GetValueDifferences(int originalRofstID, ref List<string> delList)
{
return RofstDataGetValueDifferences(originalRofstID, _rofstID, ref delList);
}
public List<string> GetValueDifferences(int originalRofstID, ref List<string> delList) => 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,
// 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();
}
#endregion
#endregion
#region (RO Info Helper Methods)
#region (RO Info Helper Methods)
public static byte[] GetRofstLookupBytes(int rofstID)
{
return RofstDataGetRofstLookupBytes(rofstID);
}
public static byte[] GetRofstLookupBytes(int rofstID) => RofstDataGetRofstLookupBytes(rofstID);
public static DateTime GetRoFSTdts(int rofstID)
{
return GetRofstDtsByID(rofstID);
}
public static DateTime GetRoFSTdts(int rofstID) => GetRofstDtsByID(rofstID);
public DateTime GetRoFSTdts()
{
return GetRoFSTdts(_rofstID);
}
public DateTime GetRoFSTdts() => GetRoFSTdts(_rofstID);
public bool HasChildren(ref ROFSTLookup.rochild child)
public bool HasChildren(ref ROFSTLookup.rochild child)
{
LoadChildren(ref child);
return child.children.Any();
@@ -666,12 +630,9 @@ namespace VEPROMS.CSLA.Library
db.children = GetRoChildrenByID(db.ID, db.dbiID, false);
}
public static ROFSTLookup.rochild GetEmptyRoChild()
{
return new ROFSTLookup.rochild() { ID = -1, type = 0 };
}
public static ROFSTLookup.rochild GetEmptyRoChild() => new ROFSTLookup.rochild() { ID = -1, type = 0 };
public static string CalculateDuration(DateTime dtStart)
public static string CalculateDuration(DateTime dtStart)
{
string duration = string.Empty;
@@ -1736,31 +1697,6 @@ namespace VEPROMS.CSLA.Library
#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)
{
ROFSTLookup.rodbi rd = new ROFSTLookup.rodbi
@@ -2202,12 +2138,9 @@ namespace VEPROMS.CSLA.Library
return i;
}
private int NextDelimiter(string delim, string str)
{
return (!string.IsNullOrEmpty(str)) ? str.IndexOfAny(delim.ToCharArray()) : -1;
}
private int NextDelimiter(string delim, string str) => (!string.IsNullOrEmpty(str)) ? str.IndexOfAny(delim.ToCharArray()) : -1;
private int MatchingBrace(string str)
private int MatchingBrace(string str)
{
int level = 1;
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
{
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
{
@@ -2435,11 +2368,11 @@ namespace VEPROMS.CSLA.Library
}
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
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
@@ -7,21 +7,14 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))]
public class ROImageConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{
#region DynamicTypeDescriptor
internal override bool IsReadOnly
{
get { return _ROImageInfo == null; }
}
#endregion
#region XML
private XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
#region DynamicTypeDescriptor
internal override bool IsReadOnly => _ROImageInfo == null;
#endregion
#region XML
private readonly XMLProperties _Xp;
#endregion
#region Constructors
private ROImageInfo _ROImageInfo;
private readonly ROImageInfo _ROImageInfo;
public ROImageConfig(ROImageInfo rOImageInfo)
{
_ROImageInfo = rOImageInfo;
@@ -34,13 +27,10 @@ namespace VEPROMS.CSLA.Library
string xml = "<Config/>";
_Xp = new XMLProperties(xml);
}
internal string GetValue(string group, string item)
{
return _Xp[group, item];
}
#endregion
#region Local Properties
[Category("Image")]
internal string GetValue(string group, string item) => _Xp[group, item];
#endregion
#region Local Properties
[Category("Image")]
[Browsable(false)]
[DisplayName("Size")]
[RefreshProperties(RefreshProperties.All)]
@@ -62,9 +52,8 @@ namespace VEPROMS.CSLA.Library
public override string ToString()
{
string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty;
return s;
}
#endregion
}
return s == "<Config/>" || s == "<Config></Config>" ? string.Empty : s;
}
#endregion
}
}
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Drawing;
using DescriptiveEnum;
namespace VEPROMS.CSLA.Library
{
@@ -11,22 +7,15 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))]
public class RevisionConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{
#region DynamicTypeDescriptor
internal override bool IsReadOnly
{
get { return false; }//_Section == null; }
}
#endregion
#region XML
private XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
#region DynamicTypeDescriptor
internal override bool IsReadOnly => false;
#endregion
#region XML
private readonly XMLProperties _Xp;
#endregion
#region Constructors
private Revision _Revision;
private RevisionInfo _RevisionInfo;
private readonly Revision _Revision;
private readonly RevisionInfo _RevisionInfo;
[Browsable(false)]
public bool ParentLookup
{
@@ -52,18 +41,12 @@ namespace VEPROMS.CSLA.Library
if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml);
}
public RevisionConfig()
{
_Xp = new XMLProperties();
}
internal string GetValue(string group, string item)
{
return _Xp[group, item];
}
#endregion
#region Properties and Methods
// This is needed for the Data Loader
[Category("History")]
public RevisionConfig() => _Xp = new XMLProperties();
internal string GetValue(string group, string item) => _Xp[group, item];
#endregion
#region Properties and Methods
// This is needed for the Data Loader
[Category("History")]
[Browsable(false)]
[DisplayName("Start Date")]
[RefreshProperties(RefreshProperties.All)]
@@ -115,9 +98,8 @@ namespace VEPROMS.CSLA.Library
public override string ToString()
{
string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty;
return s;
}
#endregion
}
return s == "<Config/>" || s == "<Config></Config>" ? string.Empty : s;
}
#endregion
}
}
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using DescriptiveEnum;
using System.Xml;
@@ -11,18 +10,11 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))]
public class SectionConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged, IItemConfig
{
#region DynamicTypeDescriptor
internal override bool IsReadOnly
{
get { return false; }//_Section == null; }
}
#endregion
#region XML
private XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
#region DynamicTypeDescriptor
internal override bool IsReadOnly => false;
#endregion
#region XML
private readonly XMLProperties _Xp;
#endregion
#region Constructors
//PROPGRID: Hide ParentLookup
@@ -32,26 +24,13 @@ namespace VEPROMS.CSLA.Library
get { return _Xp.ParentLookup; }
set { _Xp.ParentLookup = value; }
}
//PROPGRID: Had to comment out NonSerialized to hide AncestorLookup from Property Grid
//[NonSerialized]
private bool _AncestorLookup;
//PROPGRID: Hide AncestorLookup
//[Browsable(false)]
//public bool AncestorLookup
//{
// get { return _AncestorLookup; }
// set { _AncestorLookup = value; }
//}
private Section _Section;
private SectionInfo _SectionInfo;
private readonly Section _Section;
private readonly SectionInfo _SectionInfo;
private static int _SectionConfigUnique = 0;
private static int SectionConfigUnique
{ get { return ++_SectionConfigUnique; } }
private int _MySectionConfigUnique = SectionConfigUnique;
public int MySectionConfigUnique // Absolutely Unique ID - Info
{ get { return _MySectionConfigUnique; } }
private static int SectionConfigUnique => ++_SectionConfigUnique;
private readonly int _MySectionConfigUnique = SectionConfigUnique;
public SectionConfig(Section section)
public SectionConfig(Section section)
{
_Section = section;
string xml = section.MyContent.Config;
@@ -82,9 +61,8 @@ namespace VEPROMS.CSLA.Library
if (retval != string.Empty) return retval;
proc = (ProcedureInfo)proc.ActiveParent;
}
DocVersionInfo docVersion = proc.ActiveParent as DocVersionInfo;
if (docVersion == null) return string.Empty;
retval = docVersion.DocVersionConfig.GetValue(args.Group, args.Item);
if (!(proc.ActiveParent is DocVersionInfo docVersion)) return string.Empty;
retval = docVersion.DocVersionConfig.GetValue(args.Group, args.Item);
if (retval != string.Empty) return retval;
for (FolderInfo folder = docVersion.MyFolder; folder != null; folder = folder.MyParent)
{
@@ -102,23 +80,11 @@ namespace VEPROMS.CSLA.Library
_Xp = new XMLProperties(xml);
if (_SectionInfo.ActiveParent != null) _Xp.LookInAncestor += new XMLPropertiesEvent(Xp_LookInAncestorFolder);
}
//public SectionConfig(string xml)
//{
// if (xml == string.Empty) xml = "<Config/>";
// _Xp = new XMLProperties(xml);
//}
public SectionConfig()
{
_Xp = new XMLProperties();
}
internal string GetValue(string group, string item)
{
return _Xp[group, item];
}
#endregion
#region Local Properties
//[Category("Identification")]
[Category("General")]
public SectionConfig() => _Xp = new XMLProperties();
internal string GetValue(string group, string item) => _Xp[group, item];
#endregion
#region Local Properties
[Category("General")]
[DisplayName("Number")]
[Description("Number")]
public string Number
@@ -126,7 +92,6 @@ namespace VEPROMS.CSLA.Library
get { return (_Section != null ? _Section.MyContent.Number : _SectionInfo.MyContent.Number); }
set { if (_Section != null) _Section.MyContent.Number = value; }
}
//[Category("Identification")]
[Category("General")]
[DisplayName("Title")]
[Description("Title")]
@@ -142,7 +107,7 @@ namespace VEPROMS.CSLA.Library
[Description("Old Sequence")]
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; }
}
[Category("Identification")]
@@ -152,7 +117,7 @@ namespace VEPROMS.CSLA.Library
[Description("Dirty")]
public bool Dirty
{
get { return (_Section != null ? _Section.IsDirty : false); }
get { return (_Section != null && _Section.IsDirty); }
}
[Category("Format")]
[DisplayName("Format")]
@@ -171,7 +136,6 @@ namespace VEPROMS.CSLA.Library
if (_Section != null)
{
_Section.MyContent.MyFormat = FormatList.ToFormat(value); // Can only be set if _DocVersion is set
//_Section.ActiveFormat = null;
DocStyleListConverter.MySection = _Section;
}
}
@@ -192,7 +156,7 @@ namespace VEPROMS.CSLA.Library
set
{
if (_Section != null)
_Section.MyContent.MyFormat = value == null ? null : value.GetJustFormat();
_Section.MyContent.MyFormat = value?.GetJustFormat();
}
}
[Category("Format")]
@@ -304,15 +268,13 @@ namespace VEPROMS.CSLA.Library
public override string ToString()
{
string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty;
return s;
}
#endregion
#region SectionCategory // from sequence number in 16-bit database.
[TypeConverter(typeof(EnumDescConverter))]
return s == "<Config/>" || s == "<Config></Config>" ? string.Empty : s;
}
#endregion
#region SectionCategory // from sequence number in 16-bit database.
[TypeConverter(typeof(EnumDescConverter))]
public enum SectionPagination : int
{
//Default = 0, Continuous, Separate
Continuous = 1, Separate = 2
}
[Category("Format")]
@@ -415,7 +377,7 @@ namespace VEPROMS.CSLA.Library
get
{
string tmp = _Xp["Section", "TOC_Group_Title"];
return (tmp == null)? "" : tmp;
return tmp ?? "";
}
set
{
@@ -476,23 +438,6 @@ namespace VEPROMS.CSLA.Library
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")]
//PROPGRID: Hide Subsection PH
[DisplayName("Section PrintHdr")]
@@ -536,7 +481,6 @@ namespace VEPROMS.CSLA.Library
{
get
{
//return _Xp["Section", "ShwRplWords"];
string tmp = _Xp["Section", "ShwRplWords"];
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
public enum SectionColumnMode : int
{
//[Description("Format Default")]
//Default = 0,
[Description("One Column")]
One = 1,
[Description("Two Columns")]
@@ -595,7 +537,7 @@ namespace VEPROMS.CSLA.Library
// If there is no parent value, then use the volian default
if (s == string.Empty)
{
SectionInfo si = _SectionInfo != null ? _SectionInfo : SectionInfo.Get(_Section.ItemID);
SectionInfo si = _SectionInfo ?? SectionInfo.Get(_Section.ItemID);
if (si != null)
{
E_PurchaseOptions po = (E_PurchaseOptions)(MyFormat ?? MyDefaultFormat).PlantFormat.FormatData.PurchaseOptions;
@@ -607,34 +549,23 @@ namespace VEPROMS.CSLA.Library
{
case FormatColumns.OneColumn:
return SectionColumnMode.One;
break;
case FormatColumns.TwoColumn:
return SectionColumnMode.Two;
break;
case FormatColumns.ThreeColumn:
return SectionColumnMode.Three;
break;
case FormatColumns.FourColumns:
return SectionColumnMode.Four;
break;
//default:
// return SectionColumnMode.One;
// break;
}
}
}
int rval = 0;
if (MyFormat != null)
int rval;
if (MyFormat != null)
{
rval = (int)MyFormat.MyStepSectionLayoutData.PMode;
//int rval = (int)MyFormat.MyStepSectionLayoutData.PMode;
//return (SectionColumnMode)rval;//SectionColumnMode.Two; //SectionColumnMode.Default;// default to volian default
}
else
{
//int 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
// it's format column.
@@ -646,11 +577,6 @@ namespace VEPROMS.CSLA.Library
}
else
return (SectionColumnMode)int.Parse(s);
//if (s == string.Empty)
// return SectionColumnMode.Default;
//return (SectionColumnMode)int.Parse(s);
}
set
{
@@ -670,13 +596,12 @@ namespace VEPROMS.CSLA.Library
}
else
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 (rval == 0)
{
SectionInfo si = _SectionInfo != null ? _SectionInfo : SectionInfo.Get(_Section.ItemID);
SectionInfo si = _SectionInfo ?? SectionInfo.Get(_Section.ItemID);
if (si != null)
{
switch (si.MyProcedure.ProcedureConfig.Format_Columns)
@@ -708,103 +633,6 @@ namespace VEPROMS.CSLA.Library
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")]
[DisplayName("Checkoff List Selection")]
[Description("Checkoff List Selection")]
@@ -874,13 +702,10 @@ namespace VEPROMS.CSLA.Library
{
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)
return "N";
if (_Section != null && HasSubsections)
return "N";
//if (_Section != null && _Section.MyContent.cont .Sections.Count > 0 && _Section.Steps.Count > 0)
// return "N";
return "Y";
}
}
@@ -1013,8 +838,6 @@ namespace VEPROMS.CSLA.Library
{
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>();
foreach (XmlNode xnr in _Xp.XmlContents.SelectNodes("//Enhanced")) nodesToDel.Add(xnr);
if (nodesToDel != null)
+48 -212
View File
@@ -1,19 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using DescriptiveEnum;
using System.Xml;
namespace VEPROMS.CSLA.Library
{
public partial class EnhancedDocuments : List<EnhancedDocument>
{
public void Add(int type, int itemID)
{
Add(new EnhancedDocument(type, itemID));
}
public static EnhancedDocuments Load(XMLProperties _Xp)
public void Add(int type, int itemID) => Add(new EnhancedDocument(type, itemID));
public static EnhancedDocuments Load(XMLProperties _Xp)
{
EnhancedDocuments ed = new EnhancedDocuments();
foreach (XmlNode xn in _Xp.XmlContents.SelectNodes("//Enhanced"))
@@ -31,45 +26,25 @@ namespace VEPROMS.CSLA.Library
}
public partial class EnhancedDocument
{
private int _Type;
public int Type
{
get { return _Type; }
set { _Type = value; }
}
private int _ItemID;
public int ItemID
{
get { return _ItemID; }
set { _ItemID = value; }
}
public EnhancedDocument() { ;}
public int Type { get; set; }
public int ItemID { get; set; }
public EnhancedDocument() { ;}
public EnhancedDocument(int type, int itemID)
{
Type = type;
ItemID = itemID;
}
public override string ToString()
{
return string.Format("{0}.ItemID={1}", Type, ItemID);
}
}
public override string ToString() => $"{Type}.ItemID={ItemID}";
}
[Serializable]
[TypeConverter(typeof(ExpandableObjectConverter))]
public class StepConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged, IItemConfig
{
#region DynamicTypeDescriptor
internal override bool IsReadOnly
{
get { return false; }//_Section == null; }
}
#endregion
#region XML
private XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
#region DynamicTypeDescriptor
internal override bool IsReadOnly => false;
#endregion
#region XML
private readonly XMLProperties _Xp;
#endregion
#region Constructors
//PROPGRID: Hide ParentLookup
@@ -79,18 +54,8 @@ namespace VEPROMS.CSLA.Library
get { return _Xp.ParentLookup; }
set { _Xp.ParentLookup = value; }
}
//PROPGRID: Had to comment out NonSerialized to hide AncestorLookup from Property Grid
//[NonSerialized]
//private bool _AncestorLookup;
////PROPGRID: Hide AncestorLookup
//[Browsable(false)]
//public bool AncestorLookup
//{
// get { return _AncestorLookup; }
// set { _AncestorLookup = value; }
//}
private Step _Step;
private StepInfo _StepInfo;
private readonly Step _Step;
private readonly StepInfo _StepInfo;
public StepConfig(Step step)
{
_Step = step;
@@ -111,47 +76,36 @@ namespace VEPROMS.CSLA.Library
_Xp = new XMLProperties(xml);
}
public StepConfig()
{
_Xp = new XMLProperties();
}
internal string GetValue(string group, string item)
{
return _Xp[group, item];
}
#endregion
#region Local Properties
#endregion
#region ToString
public override string ToString()
public StepConfig() => _Xp = new XMLProperties();
internal string GetValue(string group, string item) => _Xp[group, item];
#endregion
#region Local Properties
#endregion
#region ToString
public override string ToString()
{
string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty;
return s;
}
#endregion
#region StepAttr
//[Category("Step Attributes")]
//[DisplayName("Step Floating Foldout Association")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("Step Floating Foldout Association")]
public int Step_FloatingFoldout
return s == "<Config/>" || s == "<Config></Config>" ? string.Empty : s;
}
#endregion
#region StepAttr
public int Step_FloatingFoldout
{
get
{
string s = _Xp["Step", "FloatingFoldout"];
if (s == string.Empty) return 0;
int tst = 0;
try
int tst;
try
{
tst = int.Parse(s);
}
catch (Exception ex)
{
catch (Exception)
{
return 0;
}
return int.Parse(s);
return tst;
}
set
{
@@ -196,28 +150,6 @@ namespace VEPROMS.CSLA.Library
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
{
get
@@ -236,10 +168,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Step_Placekeeper");
}
}
//[Category("Step Attributes")]
//[DisplayName("Step Check Off Index")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("Step Check Off Index")]
public int Step_CheckOffIndex
{
get
@@ -248,24 +176,14 @@ namespace VEPROMS.CSLA.Library
if (s == string.Empty) return 0;
// 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
// bad character, but this was added, in case there are some other conditions.
int tst = 0;
if(int.TryParse(s,out tst))
return tst;
tst = (int) s[0];
// 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
// bad character, but this was added, in case there are some other conditions.
if (int.TryParse(s, out int tst))
return tst;
tst = (int) s[0];
tst -= '0';
return tst;
//try
//{
// tst = int.Parse(s);
//}
//catch (Exception ex)
//{
// return 0;
//}
//return int.Parse(s);
}
set
{
@@ -275,10 +193,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Step_CheckOffIndex");
}
}
//[Category("Step Attributes")]
//[DisplayName("Step Manual Pagebreak")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("Step Manual Pagebreak")]
public bool Step_ManualPagebreak
{
get
@@ -352,10 +266,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Step_SubStepPagebreak");
}
}
//[Category("Step Attributes")]
//[DisplayName("Step Change Bar Override")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("Step Change Bar Override")]
public string Step_CBOverride
{
get
@@ -440,10 +350,6 @@ namespace VEPROMS.CSLA.Library
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
public string Step_SpellCheckerChangedText
{
@@ -557,16 +463,16 @@ namespace VEPROMS.CSLA.Library
{
string s = _Xp["Step", "ImageWidth"];
if (s == string.Empty) return 0;
int tst = 0;
try
int tst;
try
{
tst = int.Parse(s);
}
catch (Exception ex)
{
catch (Exception)
{
return 0;
}
return int.Parse(s);
return tst;
}
set
{
@@ -582,16 +488,16 @@ namespace VEPROMS.CSLA.Library
{
string s = _Xp["Step", "ImageHeight"];
if (s == string.Empty) return 0;
int tst = 0;
try
int tst;
try
{
tst = int.Parse(s);
}
catch (Exception ex)
{
catch (Exception)
{
return 0;
}
return int.Parse(s);
return tst;
}
set
{
@@ -617,7 +523,6 @@ namespace VEPROMS.CSLA.Library
set
{
_MyEnhancedDocuments = value;
//OnPropertyChanged("EnhancedDocuments");
}
}
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
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));
if (tmp != null)
{
@@ -659,74 +563,6 @@ namespace VEPROMS.CSLA.Library
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
#region IItemConfig Members
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
namespace VEPROMS.CSLA.Library
@@ -9,11 +7,7 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))]
public class TransitionConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{
private XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
private readonly XMLProperties _Xp;
public TransitionConfig(string xml)
{
if (xml == string.Empty) xml = "<Config/>";
@@ -38,8 +32,7 @@ namespace VEPROMS.CSLA.Library
public override string ToString()
{
string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty;
return s;
return s == "<Config/>" || s == "<Config></Config>" ? string.Empty : s;
}
#region GeneralTransitionProperties
[Category("Formatted")] // format transition, i.e. include page number
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
namespace VEPROMS.CSLA.Library
@@ -9,11 +7,7 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))]
public class UserConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{
private XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
private readonly XMLProperties _Xp;
public UserConfig(string xml)
{
if (xml == string.Empty) xml = "<Config/>";
@@ -26,8 +20,7 @@ namespace VEPROMS.CSLA.Library
public override string ToString()
{
string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty;
return s;
return s == "<Config/>" || s == "<Config></Config>" ? string.Empty : s;
}
#region UserCategory // from user.cfg
[Category("User")]
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization;
using System.Xml;
@@ -47,12 +45,9 @@ namespace VEPROMS.CSLA.Library
set { _ParentLookup = value; }
}
[NonSerialized]
XmlDocument _XmlContents;
public XmlDocument XmlContents
{
get { return _XmlContents; }
}
private XmlNode GetGroup(string group)
readonly XmlDocument _XmlContents;
public XmlDocument XmlContents => _XmlContents;
private XmlNode GetGroup(string group)
{
XmlNodeList xl = _XmlContents.DocumentElement.SelectNodes(string.Format("//{0}", group));
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)
{
//XmlNodeList xl = xx.SelectNodes(string.Format("@{0}", item));
XmlNodeList xl = xx.SelectNodes(
string.Format("@*[translate(local-name(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')='{0}']", item.ToLower()));
switch (xl.Count)
@@ -87,11 +81,8 @@ namespace VEPROMS.CSLA.Library
throw new XmlPropertiesException("Found more than one node @{0}", item);
}
}
public string ParentValue(string group, string item)
{
return OnLookInAncestor(this, new XMLPropertiesArgs(group, item, true));
}
public string this[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]
{
get
{
@@ -162,41 +153,26 @@ namespace VEPROMS.CSLA.Library
}
public partial class XMLPropertiesArgs
{
#region Business Methods
private string _Group;
public string Group
{
get { return _Group; }
set { _Group = value; }
}
private string _Item;
public string Item
{
get { return _Item; }
set { _Item = value; }
}
private bool _AncestorLookup;
#region Business Methods
public string Group { get; set; }
public string Item { get; set; }
public bool AncestorLookup
{
get { return _AncestorLookup; }
set { _AncestorLookup = value; }
}
public bool AncestorLookup { get; set; }
#endregion
#region Factory Methods
private XMLPropertiesArgs() { ;}
#endregion
#region Factory Methods
private XMLPropertiesArgs() { ;}
public XMLPropertiesArgs(string group, string item)
{
_Group=group;
_Item=item;
_AncestorLookup = false;
Group=group;
Item=item;
AncestorLookup = false;
}
public XMLPropertiesArgs(string group, string item, bool ancestorLookup)
{
_Group = group;
_Item = item;
_AncestorLookup = ancestorLookup;
Group = group;
Item = item;
AncestorLookup = ancestorLookup;
}
#endregion
}
@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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\FigureExt.cs" />
<Compile Include="Extension\FolderExt.cs" />
<Compile Include="Extension\FontTab.cs" />
<Compile Include="Extension\FormatExt.cs" />
<Compile Include="Extension\GridExt.cs" />
<Compile Include="Extension\ItemExt.cs" />
@@ -388,6 +387,7 @@
<Compile Include="Generated\ZContentInfo.cs" />
<Compile Include="Generated\ZTransition.cs" />
<Compile Include="Generated\ZTransitionInfo.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Minimal\AnnotationstypeSections.cs" />
<Compile Include="Minimal\ChangeBarAuditHistory.cs" />
<Compile Include="Minimal\Maintenance.cs" />
@@ -1,41 +1,26 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
using Volian.Base.Library;
using JR.Utils.GUI.Forms;
using System.Threading;
namespace VEPROMS.CSLA.Library
{
public partial class frmRofstLoadStatus : Form
{
#region Fields
#region Fields
#endregion
#endregion
#region Properties
#region Properties
public string Title
{
get { return lblTitle.Text; }
}
public string Title => lblTitle.Text;
public string DisplayText
{
get { return statusProgressBar.Text; }
}
public string DisplayText => 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
// Initialize Base Component
@@ -64,14 +49,14 @@ namespace VEPROMS.CSLA.Library
lblTitle.Text = title;
this.Refresh();
Refresh();
Application.DoEvents();
// Check if Finalizing Status/Progress Bar
if (curVal >= 100)
{
Thread.Sleep(3000);
this.Close();
Close();
}
}