Commit for development environment setup

This commit is contained in:
2023-06-19 16:12:33 -04:00
parent be72063a3c
commit bbce2ad0a6
2209 changed files with 1171775 additions and 625 deletions

View File

@@ -0,0 +1,120 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
namespace VEPROMS.CSLA.Library
{
[Serializable]
[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; }
}
#endregion
#region Constructors
private Association _Association;
public AssociationConfig(Association association)
{
_Association = association;
string xml = association.Config;
if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml);
}
private AssociationInfo _AssociationInfo;
public AssociationConfig(AssociationInfo association)
{
_AssociationInfo = association;
string xml = association.Config;
if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml);
}
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")]
[DisplayName("Default RO Prefix")]
[RefreshProperties(RefreshProperties.All)]
[Description("Setpoint Prefix")]
public string RODefaults_setpointprefix
{
get
{
string s = _Xp["RODefaults", "Setpoint"];// get the saved value
return s;
}
set
{
_Xp["RODefaults", "Setpoint"] = value; // save selected value
OnPropertyChanged("RODefaults_setpointprefix");
}
}
[Category("Referenced Objects")]
[DisplayName("Default Graphics Prefix")]
[RefreshProperties(RefreshProperties.All)]
[Description("Graphics Prefix")]
public string RODefaults_graphicsprefix
{
get
{
string s = _Xp["RODefaults", "Graphics"];// get the saved value
return s;
}
set
{
_Xp["RODefaults", "Graphics"] = value; // save selected value
}
}
#endregion
#region ROUpdate
[Category("RO Update")]
[DisplayName("Last Completed")]
[RefreshProperties(RefreshProperties.All)]
[Description("Last RO Update Completed")]
public string ROUpdate_LastCompleted
{
get
{
string s = _Xp["ROUpdate", "LastCompleted"];// get the saved value
return s;
}
set
{
_Xp["ROUpdate", "LastCompleted"] = value; // save selected value
}
}
#endregion // ROUpdate
#region ToString
public override string ToString()
{
string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></config>") return string.Empty;
return s;
}
#endregion
}
}

View File

@@ -0,0 +1,104 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
namespace VEPROMS.CSLA.Library
{
[Serializable]
[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; }
}
#endregion
#region Constructors
private Association _Association;
public AssociationConfig(Association association)
{
_Association = association;
string xml = association.Config;
if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml);
}
private AssociationInfo _AssociationInfo;
public AssociationConfig(AssociationInfo association)
{
_AssociationInfo = association;
string xml = association.Config;
if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml);
}
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")]
[DisplayName("Default RO Prefix")]
[RefreshProperties(RefreshProperties.All)]
[Description("Setpoint Prefix")]
public string RODefaults_setpointprefix
{
get
{
string s = _Xp["RODefaults", "Setpoint"];// get the saved value
return s;
}
set
{
_Xp["RODefaults", "Setpoint"] = value; // save selected value
OnPropertyChanged("RODefaults_setpointprefix");
}
}
#endregion
#region ROUpdate
[Category("RO Update")]
[DisplayName("Last Completed")]
[RefreshProperties(RefreshProperties.All)]
[Description("Last RO Update Completed")]
public string ROUpdate_LastCompleted
{
get
{
string s = _Xp["ROUpdate", "LastCompleted"];// get the saved value
return s;
}
set
{
_Xp["ROUpdate", "LastCompleted"] = value; // save selected value
}
}
#endregion // ROUpdate
#region ToString
public override string ToString()
{
string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></config>") return string.Empty;
return s;
}
#endregion
}
}

View File

@@ -0,0 +1,798 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using DescriptiveEnum;
namespace VEPROMS.CSLA.Library
{
[Serializable]
[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; }
}
#endregion
#region Constructors
//PROPGRID: Hide ParentLookup
[Browsable(false)]
public bool ParentLookup
{
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;
public ProcedureConfig(Procedure procedure)
{
_Procedure = procedure;
string xml = procedure.MyContent.Config;
if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml);
if (procedure.MyProcedureInfo.ActiveParent != null) _Xp.LookInAncestor += new XMLPropertiesEvent(Xp_LookInAncestorFolder);
}
private string Xp_LookInAncestorFolder(object sender, XMLPropertiesArgs args)
{
if (args.AncestorLookup || ParentLookup)
{
string retval;
// There may be levels of procedures, i.e. procedures within a procedure.
ProcedureInfo proc = _Procedure != null ? _Procedure.MyProcedureInfo : _ProcedureInfo;
while (proc.ActiveParent.IsProcedure)
{
retval = proc.ProcedureConfig.GetValue(args.Group, args.Item);
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 (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;
}
//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);
_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; }
set { _SelectedSlave = value; }
}
public ProcedureConfig(string xml)
{
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;
}
#endregion
#region Local Properties
[Category("General")]
[DisplayName("Number")]
[Description("Number")]
public string Number
{
get { return (_Procedure != null ? _Procedure.MyContent.Number : _ProcedureInfo.MyContent.Number); }
set { if (_Procedure != null) _Procedure.MyContent.Number = value; }
}
[Category("General")]
[DisplayName("Title")]
[Description("Title")]
public string Title
{
get { return (_Procedure != null ? _Procedure.MyContent.Text : _ProcedureInfo.MyContent.Text); }
set { if (_Procedure != null) _Procedure.MyContent.Text = value; }
}
[Category("Identification")]
//PROPGRID: Hide Old Sequence
[Browsable(false)]
[DisplayName("Old Sequence")]
[Description("Old Sequence")]
public string OldSequence
{
get { return (_Procedure != null ? _Procedure.MyContent.MyZContent.OldStepSequence : (_ProcedureInfo.MyContent.MyZContent == null ? null : _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")]
[DisplayName("Format")]
[Description("Format")]
[TypeConverter(typeof(FormatList))]
public string FormatSelection
{
get
{
if (_Procedure != null && _Procedure.MyContent.MyFormat != null) return _Procedure.MyContent.MyFormat.FullName; //.PlantFormat.FormatData.Name;
if (_ProcedureInfo != null && _ProcedureInfo.MyContent.MyFormat != null) return _ProcedureInfo.MyContent.MyFormat.FullName;//.PlantFormat.FormatData.Name;
return null;
}
set
{
if (_Procedure != null)
{
_Procedure.MyContent.MyFormat = FormatList.ToFormat(value); // Can only be set if _DocVersion is set
//_Procedure.ActiveFormat = null;
}
}
}
[Category("Format Settings")]
[DisplayName("Default Format")]
[Description("Default Format")]
[TypeConverter(typeof(FormatList))]
public string DefaultFormatSelection
{
get
{
if (_Procedure != null && _Procedure.MyProcedureInfo.ActiveParent != null && _Procedure.MyProcedureInfo.ActiveParent.ActiveFormat != null) return _Procedure.MyProcedureInfo.ActiveParent.ActiveFormat.FullName;
if (_ProcedureInfo != null && _ProcedureInfo.MyParent != null && _ProcedureInfo.MyParent.ActiveFormat != null) return _ProcedureInfo.MyParent.ActiveFormat.FullName;
return null;
}
}
public Procedure MyProcedure
{ get { return _Procedure; } }
#endregion
#region ToString
public override string ToString()
{
string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty;
return s;
}
#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)]
[Description("Column Layout")]
public FormatColumns Format_Columns
{
get
{
string s = _Xp["Format", "Columns"];
//If there is no value to get, then get the parent value (a.k.a. default value).
if (s == string.Empty)
s = _Xp.ParentValue("Format", "Columns"); // get the parent value
// If there is no parent value, then use the volian default
if (s == string.Empty)
return FormatColumns.TwoColumn;// At the procedure level, default to Two column
return (FormatColumns)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 parval = _Xp.ParentValue("Format", "Columns"); // get the parent value
if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default
parval = ((int)(FormatColumns.Default)).ToString();
if (parval.Equals(((int)value).ToString()))
_Xp["Format", "Columns"] = string.Empty; // reset to parent value
else
_Xp["Format", "Columns"] = ((int)value).ToString(); // save selected value
OnPropertyChanged("Format_Columns");
}
}
[Category("Format")]
//PROPGRID: Hide Plant Format Name (using Format and Default Format)
[Browsable(false)]
[DisplayName("Plant Format Name")]
[RefreshProperties(RefreshProperties.All)]
[Description("Default Plant Format")]
public string Format_Plant
{
get
{
return _Xp["format", "plant"];
}
set
{
_Xp["format", "plant"] = value;
OnPropertyChanged("Format_Plant");
}
}
#endregion
#region PrintSettingsCategory // originally from first entry in fix file and curset.dat
[Category("Print Settings")] //Note that this print setting is stored under 'Procedure' element
[Browsable(false)]
[DisplayName("Revision Number")]
[RefreshProperties(RefreshProperties.All)]
[Description("Revision Number")]
public string Print_Rev
{
get
{
string s = _Xp["Procedure", "Rev"];
if (SelectedSlave > 0)
s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "Rev"];
return s;
}
set
{
if (SelectedSlave > 0)
_Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "Rev"] = value; // save selected value
else
_Xp["Procedure", "Rev"] = value;
OnPropertyChanged("Print_Rev");
}
}
[Category("Print Settings")] //Note that this print setting is stored under 'Procedure' element
[Browsable(false)]
[DisplayName("Revision Date")]
[RefreshProperties(RefreshProperties.All)]
[Description("Revision Date")]
public string Print_RevDate
{
get
{
string s = _Xp["Procedure", "RevDate"];
if (SelectedSlave > 0)
s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "RevDate"];
return s;
}
set
{
if (SelectedSlave > 0)
_Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "RevDate"] = value; // save selected value
else
_Xp["Procedure", "RevDate"] = value;
OnPropertyChanged("Print_RevDate");
}
}
[Category("Print Settings")] //Note that this print setting is stored under 'Procedure' element
[Browsable(false)]
[DisplayName("Review Date")]
[RefreshProperties(RefreshProperties.All)]
[Description("Review Date")]
public string Print_ReviewDate
{
get
{
string s = _Xp["Procedure", "ReviewDate"];
if (SelectedSlave > 0)
s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "ReviewDate"];
return s;
}
set
{
if (SelectedSlave > 0)
_Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "ReviewDate"] = value; // save selected value
else
_Xp["Procedure", "ReviewDate"] = value;
OnPropertyChanged("Print_ReviewDate");
}
}
[Category("Print Settings")]
//PROPGRID: Hide Number of Copies
[Browsable(false)]
[DisplayName("Number of Copies")]
[RefreshProperties(RefreshProperties.All)]
[Description("Number of Copies")]
public int Print_NumCopies
{
get
{
string s = _Xp["PrintSettings", "numcopies"];
if (s == string.Empty) return 1;
return int.Parse(_Xp["PrintSettings", "numcopies"]);
}
set
{
_Xp["PrintSettings", "numcopies"] = value.ToString();
OnPropertyChanged("Print_NumCopies");
}
}
//public enum PrintPagination : int
//{
// Free = 0, Fixed,
// [Description("Automatic")]
// Auto
//}
[Category("Print Settings")]
[DisplayName("Pagination")]
[RefreshProperties(RefreshProperties.All)]
[Description("Pagination")]
public PrintPagination Print_Pagination
{
get
{
string s = _Xp["PrintSettings", "Pagination"];
//If there is no value to get, then get the parent value (a.k.a. default value).
if (s == string.Empty)
s = _Xp.ParentValue("PrintSettings", "Pagination"); // get the parent value
// If there is no parent value, then use the volian default
if (s == string.Empty)
return PrintPagination.Auto;// default to volian default
return (PrintPagination)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 parval = _Xp.ParentValue("PrintSettings", "Pagination"); // get the parent value
if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default
parval = ((int)(PrintPagination.Auto)).ToString();
if (parval.Equals(((int)value).ToString()))
_Xp["PrintSettings", "Pagination"] = string.Empty; // reset to parent value
else
_Xp["PrintSettings", "Pagination"] = ((int)value).ToString(); // save selected value
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)]
[Description("Watermark")]
public PrintWatermark Print_Watermark
{
get
{
string s = _Xp["PrintSettings", "Watermark"];
//If there is no value to get, then get the parent value (a.k.a. default value).
if (s == string.Empty)
s = _Xp.ParentValue("PrintSettings", "Watermark"); // get the parent value
// If there is no parent value, then use the volian default
if (s == string.Empty)
return PrintWatermark.Draft;// default to volian default
return (PrintWatermark)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 parval = _Xp.ParentValue("PrintSettings", "Watermark"); // get the parent value
if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default
parval = ((int)(PrintWatermark.Draft)).ToString();
if (parval.Equals(((int)value).ToString()))
_Xp["PrintSettings", "Watermark"] = string.Empty; // reset to parent value
else
_Xp["PrintSettings", "Watermark"] = ((int)value).ToString(); // save selected value
OnPropertyChanged("Print_Watermark");
}
}
[Category("Print Settings")]
[DisplayName("Disable Automatic Duplexing")]
[RefreshProperties(RefreshProperties.All)]
[Description("Disable Duplex Printing")]
public bool Print_DisableDuplex
{
get
{
string s = _Xp["PrintSettings", "disableduplex"];
//If there is no value to get, then get the parent value (a.k.a. default value).
if (s == string.Empty)
s = _Xp.ParentValue("PrintSettings", "disableduplex"); // get the parent value
// If there is no parent value, then use the volian default
if (s == string.Empty)
s = "false";// default to volian default
return bool.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 parval = _Xp.ParentValue("PrintSettings", "disableduplex"); // get the parent value
if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default
parval = "false";
if (parval.Equals(value.ToString()))
_Xp["PrintSettings", "disableduplex"] = string.Empty; // reset to parent value
else
_Xp["PrintSettings", "disableduplex"] = value.ToString(); // save selected value
OnPropertyChanged("Print_DisableDuplex");
}
}
// 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)]
[Description("Change Bar Use")]
public PrintChangeBar Print_ChangeBar
{
get
{
string s = _Xp["PrintSettings", "ChangeBar"];
//If there is no value to get, then get the parent value (a.k.a. default value).
if (s == string.Empty)
s = _Xp.ParentValue("PrintSettings", "ChangeBar"); // get the parent value
// If there is no parent value, then use the volian default
if (s == string.Empty)
return PrintChangeBar.SelectBeforePrinting;// default to volian default
return (PrintChangeBar)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 parval = _Xp.ParentValue("PrintSettings", "ChangeBar"); // get the parent value
if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default
parval = ((int)(PrintChangeBar.SelectBeforePrinting)).ToString();
if (parval.Equals(((int)value).ToString()))
_Xp["PrintSettings", "ChangeBar"] = string.Empty; // reset to parent value
else
_Xp["PrintSettings", "ChangeBar"] = ((int)value).ToString(); // save selected value
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)]
[Description("User Specified Change Bar Location")]
public PrintChangeBarLoc Print_ChangeBarLoc
{
get
{
string s = _Xp["PrintSettings", "ChangeBarLoc"];
//If there is no value to get, then get the parent value (a.k.a. default value).
if (s == string.Empty)
s = _Xp.ParentValue("PrintSettings", "ChangeBarLoc"); // get the parent value
// If there is no parent value, then use the volian default
if (s == string.Empty)
return PrintChangeBarLoc.WithText;// default to volian default
return (PrintChangeBarLoc)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 parval = _Xp.ParentValue("PrintSettings", "ChangeBarLoc"); // get the parent value
if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default
parval = ((int)(PrintChangeBarLoc.WithText)).ToString();
if (parval.Equals(((int)value).ToString()))
_Xp["PrintSettings", "ChangeBarLoc"] = string.Empty; // reset to parent value
else
_Xp["PrintSettings", "ChangeBarLoc"] = ((int)value).ToString(); // save selected value
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)]
[Description("Change Bar Text")]
public PrintChangeBarText Print_ChangeBarText
{
get
{
string s = _Xp["PrintSettings", "ChangeBarText"];
//If there is no value to get, then get the parent value (a.k.a. default value).
if (s == string.Empty)
s = _Xp.ParentValue("PrintSettings", "ChangeBarText"); // get the parent value
// If there is no parent value, then use the volian default
if (s == string.Empty)
return PrintChangeBarText.DateChgID;// default to volian default
return (PrintChangeBarText)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 parval = _Xp.ParentValue("PrintSettings", "ChangeBarText"); // get the parent value
if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default
parval = ((int)(PrintChangeBarText.DateChgID)).ToString();
if (parval.Equals(((int)value).ToString()))
_Xp["PrintSettings", "ChangeBarText"] = string.Empty; // reset to parent value
else
_Xp["PrintSettings", "ChangeBarText"] = ((int)value).ToString(); // save selected value
OnPropertyChanged("Print_ChangeBarText");
}
}
[Category("Print Settings")]
//PROPGRID: Hide User Format
[Browsable(false)]
[DisplayName("User Format")]
[RefreshProperties(RefreshProperties.All)]
[Description("User Format")]
public string Print_UserFormat
{
get
{
return _Xp["PrintSettings", "userformat"];
}
set
{
_Xp["PrintSettings", "userformat"] = value;
OnPropertyChanged("Print_UserFormat");
}
}
[Category("Format Settings")]
[DisplayName("Custom Change Bar Message Line One")]
[RefreshProperties(RefreshProperties.All)]
[Description("User Change Bar Message1")]
public string Print_UserCBMess1
{
get
{
string s = _Xp["PrintSettings", "usercbmess1"];// get the saved value
//If there is no value to get, then get the parent value (a.k.a. default value).
if (s == string.Empty)
s = _Xp.ParentValue("PrintSettings", "usercbmess1"); // get the parent value
// If there is no parent value, then use the volian default
if (s == string.Empty)
s = "";// default to volian default
return 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 parval = _Xp.ParentValue("PrintSettings", "usercbmess1"); // get the parent value
if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default
parval = "";
if (parval.Equals(value))
_Xp["PrintSettings", "usercbmess1"] = string.Empty; // reset to parent value
else
_Xp["PrintSettings", "usercbmess1"] = value; // save selected value
OnPropertyChanged("Print_UserCBMess1");
}
}
[Category("Format Settings")]
[DisplayName("Custom Change Bar Message Line Two")]
[RefreshProperties(RefreshProperties.All)]
[Description("User Change Bar Message2")]
public string Print_UserCBMess2
{
get
{
string s = _Xp["PrintSettings", "usercbmess2"];// get the saved value
//If there is no value to get, then get the parent value (a.k.a. default value).
if (s == string.Empty)
s = _Xp.ParentValue("PrintSettings", "usercbmess2"); // get the parent value
// If there is no parent value, then use the volian default
if (s == string.Empty)
s = "";// default to volian default
return 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 parval = _Xp.ParentValue("PrintSettings", "usercbmess2"); // get the parent value
if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default
parval = "";
if (parval.Equals(value))
_Xp["PrintSettings", "usercbmess2"] = string.Empty; // reset to parent value
else
_Xp["PrintSettings", "usercbmess2"] = value; // save selected value
OnPropertyChanged("Print_UserCBMess2");
}
}
// the following is for internal use only:
[Browsable(false)]
public string SectionStart
{
get
{
return _Xp["Procedure", "SectionStart"];
}
set
{
_Xp["Procedure", "SectionStart"] = value;
OnPropertyChanged("Proceduret_SectionStart");
}
}
#endregion
#region IItemConfig Members
[Category("Master/Slave Settings")]
[DisplayName("Applicability")]
[RefreshProperties(RefreshProperties.All)]
[Description("Scope Applicability")]
public Volian.Base.Library.BigNum MasterSlave_Applicability
{
get
{
string s = _Xp["MasterSlave", "Applicability"];
return new Volian.Base.Library.BigNum(s);
}
set
{
_Xp["MasterSlave", "Applicability"] = value.FlagList;
OnPropertyChanged("MasterSlave_Applicability");
}
}
#endregion
}
public interface IItemConfig
{
Volian.Base.Library.BigNum MasterSlave_Applicability { get; set;}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,777 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using DescriptiveEnum;
namespace VEPROMS.CSLA.Library
{
[Serializable]
[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; }
}
#endregion
#region Constructors
//PROPGRID: Hide ParentLookup
[Browsable(false)]
public bool ParentLookup
{
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 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; } }
public SectionConfig(Section section)
{
_Section = section;
string xml = section.MyContent.Config;
if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml);
if (section.MySectionInfo.ActiveParent != null) _Xp.LookInAncestor += new XMLPropertiesEvent(Xp_LookInAncestorFolder);
}
private string Xp_LookInAncestorFolder(object sender, XMLPropertiesArgs args)
{
if (args.AncestorLookup || ParentLookup)
{
string retval;
// There may be levels of sections, i.e. sections within a section.
SectionInfo sect = _Section != null ? _Section.MySectionInfo : _SectionInfo;
while (sect.ActiveParent.IsSection)
{
retval = sect.SectionConfig.GetValue(args.Group, args.Item);
if (retval != string.Empty) return retval;
sect = (sect.ActiveParent as SectionInfo) ?? SectionInfo.Get((sect.ActiveParent as ItemInfo).ItemID);
}
// There may be levels of procedures, i.e. procedures within a procedure.
ProcedureInfo proc = sect.MyProcedure;
retval = proc.ProcedureConfig.GetValue(args.Group, args.Item);
if (retval != string.Empty) return retval;
while (proc.ActiveParent.IsProcedure)
{
retval = proc.ProcedureConfig.GetValue(args.Group, args.Item);
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 (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 SectionConfig(SectionInfo sectionInfo)
{
_SectionInfo = sectionInfo;
string xml = sectionInfo.MyContent.Config;
if (xml == string.Empty) xml = "<Config/>";
_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")]
[DisplayName("Number")]
[Description("Number")]
public string Number
{
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")]
public string Title
{
get { return (_Section != null ? _Section.MyContent.Text : _SectionInfo.MyContent.Text); }
set { if (_Section != null) _Section.MyContent.Text = value; }
}
[Category("Identification")]
//PROPGRID: Hide Old Sequence
[Browsable(false)]
[DisplayName("Old Sequence")]
[Description("Old Sequence")]
public string OldSequence
{
get { return (_Section != null ? _Section.MyContent.MyZContent.OldStepSequence : (_SectionInfo.MyContent.MyZContent == null ? null : _SectionInfo.MyContent.MyZContent.OldStepSequence)); }
set { if (_Section != null) _Section.MyContent.MyZContent.OldStepSequence = value; }
}
[Category("Identification")]
//PROPGRID: Hide Dirty
[Browsable(false)]
[DisplayName("Dirty")]
[Description("Dirty")]
public bool Dirty
{
get { return (_Section != null ? _Section.IsDirty : false); }
}
[Category("Format")]
[DisplayName("Format")]
[Description("Format")]
[TypeConverter(typeof(FormatList))]
public string FormatSelection
{
get
{
if (_Section != null && _Section.MyContent.MyFormat != null) return _Section.MyContent.MyFormat.FullName;
if (_SectionInfo != null && _SectionInfo.MyContent.MyFormat != null) return _SectionInfo.MyContent.MyFormat.FullName;
return null;
}
set
{
if (_Section != null)
{
_Section.MyContent.MyFormat = FormatList.ToFormat(value); // Can only be set if _DocVersion is set
//_Section.ActiveFormat = null;
DocStyleListConverter.MySection = _Section;
}
}
}
[Browsable(false)]
public FormatInfo MyFormat
{
get
{
if (_Section != null)
{
SectionInfo sectionInfo = SectionInfo.Get(_Section.ItemID);
return sectionInfo.LocalFormat;
}
if (_SectionInfo != null)return _SectionInfo.LocalFormat;
return null;
}
set
{
if (_Section != null)
_Section.MyContent.MyFormat = value == null ? null : value.GetJustFormat();
}
}
[Category("Format")]
[DisplayName("Default Format")]
[Description("Default Format")]
[TypeConverter(typeof(FormatList))]
public string DefaultFormatSelection
{
get
{
if (_Section != null && _Section.MySectionInfo.ActiveParent != null && _Section.MySectionInfo.ActiveParent.ActiveFormat != null) return _Section.MySectionInfo.ActiveParent.ActiveFormat.FullName;
if (_SectionInfo != null && _SectionInfo.MyParent != null && _SectionInfo.MyParent.ActiveFormat != null) return _SectionInfo.MyParent.ActiveFormat.FullName;
return null;
}
}
[Browsable(false)]
public FormatInfo MyDefaultFormat
{
get
{
if (_Section != null) return _Section.MySectionInfo.ActiveParent.ActiveFormat;
return _SectionInfo.ActiveParent.ActiveFormat;
}
}
//[Browsable(false)]
[Category("Format")]
[DisplayName("Section Type")]
[Description("Section Type")]
[TypeConverter(typeof(DocStyleListConverter))]
public string MySectionType
{
get
{
if (_Section != null)
{
return DocStyleListConverter.ToString(_Section.MyContent.Type);
}
return string.Empty;
}
set
{
if (_Section != null)
_Section.MyContent.Type = DocStyleListConverter.ToSectionType(value);
}
}
[Browsable(false)]
public int? SectionType
{
get
{
if (_Section != null)
{
return _Section.MyContent.Type-10000;
}
return null;
}
set
{
if (_Section != null)
_Section.MyContent.Type = value+10000;
}
}
public Section MySection
{ get { return _Section; } }
[Category("Format")]
[DisplayName("Keep Word Document Margins")]
[RefreshProperties(RefreshProperties.All)]
[Description("Section WordMargin")]
public string Section_WordMargin
{
get
{
string tmp = _Xp["Section", "WordMargin"];
return tmp == null || tmp == "" ? "N" : tmp;
}
set
{
_Xp["Section", "WordMargin"] = value;
OnPropertyChanged("Section_WordMargin");
}
}
#endregion
#region ToString
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))]
public enum SectionPagination : int
{
//Default = 0, Continuous, Separate
Continuous = 1, Separate = 2
}
[Category("Format")]
[DisplayName("Section Pagination")]
[RefreshProperties(RefreshProperties.All)]
[Description("Section Pagination")]
public SectionPagination Section_Pagination
{
get
{
string s = _Xp["Section", "Pagination"];
//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", "Pagination"); // get the parent value
//If there is no parent value, then use the volian default
if (s == string.Empty)
{
if (MyFormat != null)
{
bool rval = MyFormat.MyStepSectionLayoutData.BreakOnSections;
return (rval) ? SectionPagination.Separate : SectionPagination.Continuous;// default to volian default
}
else
{
bool rval = MyDefaultFormat.MyStepSectionLayoutData.BreakOnSections;
return (rval) ? SectionPagination.Separate : SectionPagination.Continuous;// default to volian default
}
}
return (SectionPagination)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 parval = _Xp.ParentValue("Section", "Pagination"); // get the parent value
if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default
{
bool rval = _Section.MySectionInfo.ActiveFormat.MyStepSectionLayoutData.BreakOnSections;
parval = (rval) ? ((int)(SectionPagination.Separate)).ToString() : ((int)(SectionPagination.Continuous)).ToString();
//parval = ((int)(SectionPagination.Default)).ToString();
}
if (parval.Equals(((int)value).ToString()))
_Xp["Section", "Pagination"] = string.Empty; // reset to parent value
else
_Xp["Section", "Pagination"] = ((int)value).ToString(); // save selected value
OnPropertyChanged("Section_Pagination");
}
}
[Category("View Settings")]
//PROPGRID: Hide Include in Background/Deviation
[DisplayName("Include in Background/Deviation")]
[RefreshProperties(RefreshProperties.All)]
[Description("Section LinkEnhanced")]
public string Section_LnkEnh
{
get
{
return _Xp["Section", "LnkEnh"];
}
set
{
_Xp["Section", "LnkEnh"] = value;
OnPropertyChanged("Section_LnkEnh");
}
}
[Category("General")]
//PROPGRID: Hide Include On Table Of Contents
[DisplayName("Include On Table Of Contents")]
[RefreshProperties(RefreshProperties.All)]
[Description("Section TOC")]
public string Section_TOC
{
get
{
string tmp = _Xp["Section", "TOC"];
return tmp == null || tmp == "" ? "N" : tmp;
}
set
{
_Xp["Section", "TOC"] = value;
OnPropertyChanged("Section_TOC");
}
}
[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")]
[RefreshProperties(RefreshProperties.All)]
[Description("Section PrintHdr")]
public string Section_PrintHdr
{
get
{
// if null - return a "Y"
string tmp = _Xp["Section", "PrintHdr"];
return tmp == null || tmp == "" ? "Y" : tmp;
}
set
{
_Xp["Section", "PrintHdr"] = value;
OnPropertyChanged("Section_PrintHdr");
}
}
[Browsable(false)]
[DisplayName("Section OriginalSteps")]
[RefreshProperties(RefreshProperties.All)]
[Description("Section OriginalSteps")]
public string Section_OriginalSteps
{
get
{
return _Xp["Section", "OriginalSteps"];
}
set
{
_Xp["Section", "OriginalSteps"] = value;
OnPropertyChanged("Section_OriginalSteps");
}
}
[Category("Section")]
//PROPGRID: Hide Section NumPages
[Browsable(false)]
[DisplayName("Section NumPages")]
[RefreshProperties(RefreshProperties.All)]
[Description("Section NumPages")]
public string Section_NumPages
{
get
{
return _Xp["Section", "NumPages"];
}
set
{
_Xp["Section", "NumPages"] = value;
OnPropertyChanged("Section_NumPages");
}
}
[TypeConverter(typeof(EnumDescConverter))]
public enum SectionColumnMode : int
{
//[Description("Format Default")]
//Default = 0,
[Description("Single Column")]
One = 1,
[Description("Dual Column")]
Two = 2,
[Description("Triple Column")]
Three = 3,
[Description("Quad Column")]
Four = 4
}
[Category("Format")]
[DisplayName("Columns")]
[RefreshProperties(RefreshProperties.All)]
[Description("Section ColumnMode")]
public SectionColumnMode Section_ColumnMode
{
get
{
string s = _Xp["Section", "ColumnMode"];
//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", "ColumnMode"); // get the parent value
// If there is no parent value, then use the volian default
if (s == string.Empty)
{
int rval = 0;
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.
if (rval == 0)
{
SectionInfo si = _SectionInfo != null? _SectionInfo: SectionInfo.Get(_Section.ItemID);
if (si != null)
{
switch (si.MyProcedure.ProcedureConfig.Format_Columns)
{
case FormatColumns.OneColumn:
return SectionColumnMode.One;
break;
case FormatColumns.TwoColumn:
return SectionColumnMode.Two;
break;
default:
return SectionColumnMode.One;
break;
}
}
else
return SectionColumnMode.One; // 16bit's default if nothing defined
}
return (SectionColumnMode)rval;
}
else
return (SectionColumnMode)int.Parse(s);
//if (s == string.Empty)
// return SectionColumnMode.Default;
//return (SectionColumnMode)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 parval = _Xp.ParentValue("Section", "ColumnMode"); // get the parent value
if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default
{
int rval = 0;
// Use Inherited Format (ActiveFormat for Section) if MyFormat is Null
if (MyFormat == null)
{
FormatInfo myFormat = _Section == null ? _SectionInfo.ActiveFormat : SectionInfo.Get(_Section.ItemID).ActiveFormat;
rval = (int)myFormat.MyStepSectionLayoutData.PMode;
}
else
rval =(int)MyFormat.MyStepSectionLayoutData.PMode;
parval = ((rval > 0)?((SectionColumnMode)rval).ToString() : "2"); // if PMode is zero default to 2 column mode
//parval = ((SectionColumnMode)rval).ToString();
//parval = ((int)(SectionColumnMode.Default)).ToString();
}
if (parval.Equals(((int)value).ToString()))
_Xp["Section", "ColumnMode"] = string.Empty; // reset to parent value
else
_Xp["Section", "ColumnMode"] = ((int)value).ToString(); // save selected value
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")]
public int Section_CheckoffListSelection
{
get
{
string s = _Xp["Section", "CheckoffSelection"];
if (s != null && !s.Equals(string.Empty))
return Convert.ToInt32(s);
return 0;
}
set
{
string s = value.ToString();
_Xp["Section", "CheckoffSelection"] = s;
}
}
[Category("Format")]
[DisplayName("Checkoff Header Selection")]
[RefreshProperties(RefreshProperties.All)]
[Description("Checkoff Header Selection")]
public int Section_CheckoffHeaderSelection
{
get
{
string s = _Xp["Section", "CheckoffHeading"];
if (s != null && !s.Equals(string.Empty))
return Convert.ToInt32(s);
return 0;
}
set
{
string s = value.ToString();
_Xp["Section", "CheckoffHeading"] = s;
}
}
#endregion
#region SubSectionCategory // from sequence number in 16-bit database.
[Category("SubSection")]
//PROPGRID: Hide SubSection Edit
[Browsable(false)]
[DisplayName("SubSection Edit")]
[RefreshProperties(RefreshProperties.All)]
[Description("SubSection Edit")]
public string SubSection_Edit
{
get
{
// if null - return a "Y"
string tmp = _Xp["SubSection", "Edit"];
return tmp == null || tmp == "" ? "N" : tmp;
}
set
{
_Xp["SubSection", "Edit"] = value;
OnPropertyChanged("SubSection_Edit");
}
}
[Category("SubSection")]
//PROPGRID: Hide Subsection AutoIndent
[Browsable(false)]
[DisplayName("SubSection AutoIndent")]
[RefreshProperties(RefreshProperties.All)]
[Description("SubSection AutoIndent")]
public string SubSection_AutoIndent
{
get
{
// if null - return a "Y"
string tmp = _Xp["SubSection", "AutoIndent"];
return tmp==null||tmp==""?"Y":tmp;
}
set
{
_Xp["SubSection", "AutoIndent"] = value;
OnPropertyChanged("SubSection_AutoIndent");
}
}
#endregion
#region LibDocCategory // from library document file during migration
[Category("LibraryDocument")]
//PROPGRID: Hide Libary Document Comment
[Browsable(false)]
[DisplayName("LibraryDocument Comment")]
[RefreshProperties(RefreshProperties.All)]
[Description("LibraryDocument Comment")]
public string LibDoc_Comment
{
get
{
return _Xp["LibraryDocument", "Comment"];
}
set
{
_Xp["LibraryDocument", "Comment"] = value;
OnPropertyChanged("LibDoc_Comment");
}
}
#endregion
#region IItemConfig Members
[Category("Master/Slave Settings")]
[DisplayName("Applicability")]
[RefreshProperties(RefreshProperties.All)]
[Description("Scope Applicability")]
public Volian.Base.Library.BigNum MasterSlave_Applicability
{
get
{
string s = _Xp["MasterSlave", "Applicability"];
return new Volian.Base.Library.BigNum(s);
}
set
{
_Xp["MasterSlave", "Applicability"] = value.FlagList;
OnPropertyChanged("MasterSlave_Applicability");
}
}
#endregion
}
}

View File

@@ -0,0 +1,753 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using DescriptiveEnum;
namespace VEPROMS.CSLA.Library
{
[Serializable]
[TypeConverter(typeof(ExpandableObjectConverter))]
public class SectionConfig : 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; }
}
#endregion
#region Constructors
//PROPGRID: Hide ParentLookup
[Browsable(false)]
public bool ParentLookup
{
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 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; } }
public SectionConfig(Section section)
{
_Section = section;
string xml = section.MyContent.Config;
if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml);
if (section.MySectionInfo.ActiveParent != null) _Xp.LookInAncestor += new XMLPropertiesEvent(Xp_LookInAncestorFolder);
}
private string Xp_LookInAncestorFolder(object sender, XMLPropertiesArgs args)
{
if (args.AncestorLookup || ParentLookup)
{
string retval;
SectionInfo sect = _Section != null ? _Section.MySectionInfo : _SectionInfo;
while (sect.ActiveParent.GetType() == typeof(SectionInfo))
{
retval = sect.SectionConfig.GetValue(args.Group, args.Item);
if (retval != string.Empty) return retval;
sect = (SectionInfo)sect.ActiveParent;
}
ProcedureInfo proc = ProcedureInfo.Get(((ItemInfo)sect.ActiveParent).ItemID);
//ProcedureInfo proc = (ProcedureInfo)sect.ActiveParent;
retval = proc.ProcedureConfig.GetValue(args.Group, args.Item);
if (retval != string.Empty) return retval;
while (proc.ActiveParent.GetType() == typeof(ProcedureInfo))
{
retval = proc.ProcedureConfig.GetValue(args.Group, args.Item);
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 (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 SectionConfig(SectionInfo sectionInfo)
{
_SectionInfo = sectionInfo;
string xml = sectionInfo.MyContent.Config;
if (xml == string.Empty) xml = "<Config/>";
_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")]
[DisplayName("Number")]
[Description("Number")]
public string Number
{
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")]
public string Title
{
get { return (_Section != null ? _Section.MyContent.Text : _SectionInfo.MyContent.Text); }
set { if (_Section != null) _Section.MyContent.Text = value; }
}
[Category("Identification")]
//PROPGRID: Hide Old Sequence
[Browsable(false)]
[DisplayName("Old Sequence")]
[Description("Old Sequence")]
public string OldSequence
{
get { return (_Section != null ? _Section.MyContent.MyZContent.OldStepSequence : (_SectionInfo.MyContent.MyZContent == null ? null : _SectionInfo.MyContent.MyZContent.OldStepSequence)); }
set { if (_Section != null) _Section.MyContent.MyZContent.OldStepSequence = value; }
}
[Category("Identification")]
//PROPGRID: Hide Dirty
[Browsable(false)]
[DisplayName("Dirty")]
[Description("Dirty")]
public bool Dirty
{
get { return (_Section != null ? _Section.IsDirty : false); }
}
[Category("Format")]
[DisplayName("Format")]
[Description("Format")]
[TypeConverter(typeof(FormatList))]
public string FormatSelection
{
get
{
if (_Section != null && _Section.MyContent.MyFormat != null) return _Section.MyContent.MyFormat.FullName;
if (_SectionInfo != null && _SectionInfo.MyContent.MyFormat != null) return _SectionInfo.MyContent.MyFormat.FullName;
return null;
}
set
{
if (_Section != null)
{
_Section.MyContent.MyFormat = FormatList.ToFormat(value); // Can only be set if _DocVersion is set
//_Section.ActiveFormat = null;
DocStyleListConverter.MySection = _Section;
}
}
}
[Browsable(false)]
public FormatInfo MyFormat
{
get
{
if (_Section != null)
{
SectionInfo sectionInfo = SectionInfo.Get(_Section.ItemID);
return sectionInfo.LocalFormat;
}
if (_SectionInfo != null)return _SectionInfo.LocalFormat;
return null;
}
set
{
if (_Section != null)
_Section.MyContent.MyFormat = value == null ? null : value.Get();
}
}
[Category("Format")]
[DisplayName("Default Format")]
[Description("Default Format")]
[TypeConverter(typeof(FormatList))]
public string DefaultFormatSelection
{
get
{
if (_Section != null && _Section.MySectionInfo.ActiveParent != null && _Section.MySectionInfo.ActiveParent.ActiveFormat != null) return _Section.MySectionInfo.ActiveParent.ActiveFormat.FullName;
if (_SectionInfo != null && _SectionInfo.MyParent != null && _SectionInfo.MyParent.ActiveFormat != null) return _SectionInfo.MyParent.ActiveFormat.FullName;
return null;
}
}
[Browsable(false)]
public FormatInfo MyDefaultFormat
{
get
{
if (_Section != null) return _Section.MySectionInfo.ActiveParent.ActiveFormat;
return _SectionInfo.ActiveParent.ActiveFormat;
}
}
//[Browsable(false)]
[Category("Format")]
[DisplayName("Section Type")]
[Description("Section Type")]
[TypeConverter(typeof(DocStyleListConverter))]
public string MySectionType
{
get
{
if (_Section != null)
{
return DocStyleListConverter.ToString(_Section.MyContent.Type);
}
return string.Empty;
}
set
{
if (_Section != null)
_Section.MyContent.Type = DocStyleListConverter.ToSectionType(value);
}
}
[Browsable(false)]
public int? SectionType
{
get
{
if (_Section != null)
{
return _Section.MyContent.Type-10000;
}
return null;
}
set
{
if (_Section != null)
_Section.MyContent.Type = value+10000;
}
}
public Section MySection
{ get { return _Section; } }
[Category("Format")]
[DisplayName("Keep Word Document Margins")]
[RefreshProperties(RefreshProperties.All)]
[Description("Section WordMargin")]
public string Section_WordMargin
{
get
{
string tmp = _Xp["Section", "WordMargin"];
return tmp == null || tmp == "" ? "N" : tmp;
}
set
{
_Xp["Section", "WordMargin"] = value;
OnPropertyChanged("Section_WordMargin");
}
}
#endregion
#region ToString
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))]
public enum SectionPagination : int
{
//Default = 0, Continuous, Separate
Continuous = 1, Separate = 2
}
[Category("Format")]
[DisplayName("Section Pagination")]
[RefreshProperties(RefreshProperties.All)]
[Description("Section Pagination")]
public SectionPagination Section_Pagination
{
get
{
string s = _Xp["Section", "Pagination"];
//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", "Pagination"); // get the parent value
//If there is no parent value, then use the volian default
if (s == string.Empty)
{
if (MyFormat != null)
{
bool rval = MyFormat.MyStepSectionLayoutData.BreakOnSections;
return (rval) ? SectionPagination.Separate : SectionPagination.Continuous;// default to volian default
}
else
{
bool rval = MyDefaultFormat.MyStepSectionLayoutData.BreakOnSections;
return (rval) ? SectionPagination.Separate : SectionPagination.Continuous;// default to volian default
}
}
return (SectionPagination)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 parval = _Xp.ParentValue("Section", "Pagination"); // get the parent value
if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default
{
bool rval = _Section.MySectionInfo.ActiveFormat.MyStepSectionLayoutData.BreakOnSections;
parval = (rval) ? ((int)(SectionPagination.Separate)).ToString() : ((int)(SectionPagination.Continuous)).ToString();
//parval = ((int)(SectionPagination.Default)).ToString();
}
if (parval.Equals(((int)value).ToString()))
_Xp["Section", "Pagination"] = string.Empty; // reset to parent value
else
_Xp["Section", "Pagination"] = ((int)value).ToString(); // save selected value
OnPropertyChanged("Section_Pagination");
}
}
[Category("View Settings")]
//PROPGRID: Hide Include in Background/Deviation
[DisplayName("Include in Background/Deviation")]
[RefreshProperties(RefreshProperties.All)]
[Description("Section LinkEnhanced")]
public string Section_LnkEnh
{
get
{
return _Xp["Section", "LnkEnh"];
}
set
{
_Xp["Section", "LnkEnh"] = value;
OnPropertyChanged("Section_LnkEnh");
}
}
[Category("General")]
//PROPGRID: Hide Include On Table Of Contents
[DisplayName("Include On Table Of Contents")]
[RefreshProperties(RefreshProperties.All)]
[Description("Section TOC")]
public string Section_TOC
{
get
{
string tmp = _Xp["Section", "TOC"];
return tmp == null || tmp == "" ? "N" : tmp;
}
set
{
_Xp["Section", "TOC"] = value;
OnPropertyChanged("Section_TOC");
}
}
[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")]
[RefreshProperties(RefreshProperties.All)]
[Description("Section PrintHdr")]
public string Section_PrintHdr
{
get
{
// if null - return a "Y"
string tmp = _Xp["Section", "PrintHdr"];
return tmp == null || tmp == "" ? "Y" : tmp;
}
set
{
_Xp["Section", "PrintHdr"] = value;
OnPropertyChanged("Section_PrintHdr");
}
}
[Browsable(false)]
[DisplayName("Section OriginalSteps")]
[RefreshProperties(RefreshProperties.All)]
[Description("Section OriginalSteps")]
public string Section_OriginalSteps
{
get
{
return _Xp["Section", "OriginalSteps"];
}
set
{
_Xp["Section", "OriginalSteps"] = value;
OnPropertyChanged("Section_OriginalSteps");
}
}
[Category("Section")]
//PROPGRID: Hide Section NumPages
[Browsable(false)]
[DisplayName("Section NumPages")]
[RefreshProperties(RefreshProperties.All)]
[Description("Section NumPages")]
public string Section_NumPages
{
get
{
return _Xp["Section", "NumPages"];
}
set
{
_Xp["Section", "NumPages"] = value;
OnPropertyChanged("Section_NumPages");
}
}
[TypeConverter(typeof(EnumDescConverter))]
public enum SectionColumnMode : int
{
//[Description("Format Default")]
//Default = 0,
[Description("Single Column")]
One = 1,
[Description("Dual Column")]
Two = 2,
[Description("Triple Column")]
Three = 3,
[Description("Quad Column")]
Four = 4
}
[Category("Format")]
[DisplayName("Columns")]
[RefreshProperties(RefreshProperties.All)]
[Description("Section ColumnMode")]
public SectionColumnMode Section_ColumnMode
{
get
{
string s = _Xp["Section", "ColumnMode"];
//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", "ColumnMode"); // get the parent value
// If there is no parent value, then use the volian default
if (s == string.Empty)
{
int rval = 0;
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.
if (rval == 0)
{
SectionInfo si = _SectionInfo != null? _SectionInfo: SectionInfo.Get(_Section.ItemID);
if (si != null)
{
switch (si.MyProcedure.ProcedureConfig.Format_Columns)
{
case FormatColumns.OneColumn:
return SectionColumnMode.One;
break;
case FormatColumns.TwoColumn:
return SectionColumnMode.Two;
break;
default:
return SectionColumnMode.One;
break;
}
}
else
return SectionColumnMode.One; // 16bit's default if nothing defined
}
return (SectionColumnMode)rval;
}
else
return (SectionColumnMode)int.Parse(s);
//if (s == string.Empty)
// return SectionColumnMode.Default;
//return (SectionColumnMode)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 parval = _Xp.ParentValue("Section", "ColumnMode"); // get the parent value
if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default
{
int rval = 0;
// Use Inherited Format (ActiveFormat for Section) if MyFormat is Null
if (MyFormat == null)
{
FormatInfo myFormat = _Section == null ? _SectionInfo.ActiveFormat : SectionInfo.Get(_Section.ItemID).ActiveFormat;
rval = (int)myFormat.MyStepSectionLayoutData.PMode;
}
else
rval =(int)MyFormat.MyStepSectionLayoutData.PMode;
parval = ((rval > 0)?((SectionColumnMode)rval).ToString() : "2"); // if PMode is zero default to 2 column mode
//parval = ((SectionColumnMode)rval).ToString();
//parval = ((int)(SectionColumnMode.Default)).ToString();
}
if (parval.Equals(((int)value).ToString()))
_Xp["Section", "ColumnMode"] = string.Empty; // reset to parent value
else
_Xp["Section", "ColumnMode"] = ((int)value).ToString(); // save selected value
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")]
public int Section_CheckoffListSelection
{
get
{
string s = _Xp["Section", "CheckoffSelection"];
if (s != null && !s.Equals(string.Empty))
return Convert.ToInt32(s);
return 0;
}
set
{
string s = value.ToString();
_Xp["Section", "CheckoffSelection"] = s;
}
}
[Category("Format")]
[DisplayName("Checkoff Header Selection")]
[RefreshProperties(RefreshProperties.All)]
[Description("Checkoff Header Selection")]
public int Section_CheckoffHeaderSelection
{
get
{
string s = _Xp["Section", "CheckoffHeading"];
if (s != null && !s.Equals(string.Empty))
return Convert.ToInt32(s);
return 0;
}
set
{
string s = value.ToString();
_Xp["Section", "CheckoffHeading"] = s;
}
}
#endregion
#region SubSectionCategory // from sequence number in 16-bit database.
[Category("SubSection")]
//PROPGRID: Hide SubSection Edit
[Browsable(false)]
[DisplayName("SubSection Edit")]
[RefreshProperties(RefreshProperties.All)]
[Description("SubSection Edit")]
public string SubSection_Edit
{
get
{
// if null - return a "Y"
string tmp = _Xp["SubSection", "Edit"];
return tmp == null || tmp == "" ? "N" : tmp;
}
set
{
_Xp["SubSection", "Edit"] = value;
OnPropertyChanged("SubSection_Edit");
}
}
[Category("SubSection")]
//PROPGRID: Hide Subsection AutoIndent
[Browsable(false)]
[DisplayName("SubSection AutoIndent")]
[RefreshProperties(RefreshProperties.All)]
[Description("SubSection AutoIndent")]
public string SubSection_AutoIndent
{
get
{
// if null - return a "Y"
string tmp = _Xp["SubSection", "AutoIndent"];
return tmp==null||tmp==""?"Y":tmp;
}
set
{
_Xp["SubSection", "AutoIndent"] = value;
OnPropertyChanged("SubSection_AutoIndent");
}
}
#endregion
#region LibDocCategory // from library document file during migration
[Category("LibraryDocument")]
//PROPGRID: Hide Libary Document Comment
[Browsable(false)]
[DisplayName("LibraryDocument Comment")]
[RefreshProperties(RefreshProperties.All)]
[Description("LibraryDocument Comment")]
public string LibDoc_Comment
{
get
{
return _Xp["LibraryDocument", "Comment"];
}
set
{
_Xp["LibraryDocument", "Comment"] = value;
OnPropertyChanged("LibDoc_Comment");
}
}
#endregion
}
}

View File

@@ -0,0 +1,240 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using DescriptiveEnum;
namespace VEPROMS.CSLA.Library
{
[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; }
}
#endregion
#region Constructors
//PROPGRID: Hide ParentLookup
[Browsable(false)]
public bool ParentLookup
{
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;
public StepConfig(Step step)
{
_Step = step;
string xml = step.MyContent.Config;
if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml);
}
public StepConfig(StepInfo stepInfo)
{
_StepInfo = stepInfo;
string xml = stepInfo.MyContent.Config;
if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml);
}
public StepConfig(string xml)
{
if (xml == string.Empty) xml = "<Config/>";
_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()
{
string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty;
return s;
}
#endregion
#region StepAttr
//[Category("Step Attributes")]
//[DisplayName("Step Continuous Action Summary")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("Step Continuous Action Summary")]
public bool Step_CAS
{
get
{
string s = _Xp["Step", "ContActSum"];
//If there is no value to get, then get the parent value (a.k.a. default value).
if (s == string.Empty) return false;
if (s == "True") return true;
return false;
}
set
{
string s = _Xp["Step", "ContActSum"];
if (value.ToString() == s) return;
_Xp["Step", "ContActSum"] = value.ToString();
OnPropertyChanged("Step_CAS");
}
}
//[Category("Step Attributes")]
//[DisplayName("Step Check Off Index")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("Step Check Off Index")]
public int Step_CheckOffIndex
{
get
{
string s = _Xp["Step", "CheckOffIndex"];
if (s == string.Empty) return 0;
return int.Parse(s);
}
set
{
string s = _Xp["Step", "CheckOffIndex"];
if (value.ToString() == s) return;
_Xp["Step", "CheckOffIndex"] = value.ToString();
OnPropertyChanged("Step_CheckOffIndex");
}
}
//[Category("Step Attributes")]
//[DisplayName("Step Manual Pagebreak")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("Step Manual Pagebreak")]
public bool Step_ManualPagebreak
{
get
{
string s = _Xp["Step", "ManualPagebreak"];
if (s == string.Empty) return false;
if (s == "True") return true;
return false;
}
set
{
string s = _Xp["Step", "ManualPagebreak"];
if (value.ToString() == s) return;
_Xp["Step", "ManualPagebreak"] = value.ToString();
OnPropertyChanged("Step_ManualPagebreak");
}
}
public bool Step_NewManualPagebreak
{
get
{
string s = _Xp["Step", "NewManualPagebreak"];
if (s == string.Empty) return false;
if (s == "True") return true;
return false;
}
set
{
string s = _Xp["Step", "NewManualPagebreak"];
if (value.ToString() == s) return;
_Xp["Step", "NewManualPagebreak"] = value.ToString();
OnPropertyChanged("Step_NewManualPagebreak");
}
}
//[Category("Step Attributes")]
//[DisplayName("Step Change Bar Override")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("Step Change Bar Override")]
public string Step_CBOverride
{
get
{
string s = _Xp["Step", "CBOverride"];
if (s == string.Empty) return null;
return s;
}
set
{
string s = _Xp["Step", "CBOverride"];
if (value != null && value.ToString() == s) return;
if (value == null && s != null) _Xp["Step", "CBOverride"] = null;
else _Xp["Step", "CBOverride"] = value.ToString();
OnPropertyChanged("Step_CBOverride");
}
}
public string Step_MultipleChangeID
{
get
{
string s = _Xp["Step", "MultipleChangeID"];
if (s == string.Empty) return null;
return s;
}
set
{
string s = _Xp["Step", "MultipleChangeID"];
if (value != null && value.ToString() == s) return;
if (value == null && s != null) _Xp["Step", "MultipleChangeID"] = null;
else _Xp["Step", "MultipleChangeID"] = value.ToString();
OnPropertyChanged("Step_MultipleChangeID");
}
}
#endregion
#region IItemConfig Members
[Category("Master/Slave Settings")]
[DisplayName("Applicability")]
[RefreshProperties(RefreshProperties.All)]
[Description("Scope Applicability")]
public Volian.Base.Library.BigNum MasterSlave_Applicability
{
get
{
string s = _Xp["MasterSlave", "Applicability"];
return new Volian.Base.Library.BigNum(s);
}
set
{
if (value != null)
_Xp["MasterSlave", "Applicability"] = value.FlagList;
else
_Xp["MasterSlave", "Applicability"] = null;
OnPropertyChanged("MasterSlave_Applicability");
}
}
#endregion
}
}