Better handling of parent information in Get and Set

This commit is contained in:
Jsj 2008-03-26 18:26:01 +00:00
parent 6acc548cf3
commit 1108280311
3 changed files with 1346 additions and 705 deletions

View File

@ -26,12 +26,16 @@ namespace VEPROMS.CSLA.Library
{
get { return _Xp; }
}
//PROPGRID: Hide ParentLookup
[Browsable(false)]
public bool ParentLookup
{
get { return _Xp.ParentLookup; }
set { _Xp.ParentLookup = value; }
}
private bool _AncestorLookup;
//PROPGRID: Hide AncestorLookup
[Browsable(false)]
public bool AncestorLookup
{
get { return _AncestorLookup; }
@ -91,7 +95,6 @@ namespace VEPROMS.CSLA.Library
{
return _Xp[group, item];
}
//[Category("Identification")]
[Category("General")]
[DisplayName("Name")]
[Description("Name")]
@ -100,8 +103,9 @@ namespace VEPROMS.CSLA.Library
get { return (_DocVersion != null ? _DocVersion.Name : _DocVersionInfo.Name); }
set { if (_DocVersion != null) _DocVersion.Name = value; }
}
//[Category("Identification")]
[Category("General")]
//PROPGRID: Hide Title
[Browsable(false)]
[DisplayName("Title")]
[Description("Title")]
public string Title
@ -109,7 +113,6 @@ namespace VEPROMS.CSLA.Library
get { return (_DocVersion != null ? _DocVersion.Title : _DocVersionInfo.Title); }
set { if (_DocVersion != null) _DocVersion.Title = value; }
}
//[Category("Format")]
[Category("Format Settings")]
[DisplayName("Format")]
[Description("Format")]
@ -118,8 +121,6 @@ namespace VEPROMS.CSLA.Library
{
get
{
//if (_DocVersion != null) return FormatList.ToString(_DocVersion.FormatID);
//if (_DocVersionInfo != null) return FormatList.ToString(_DocVersionInfo.FormatID);
if (_DocVersion != null && _DocVersion.MyFormat != null) return _DocVersion.MyFormat.PlantFormat.FormatData.Name;
if (_DocVersionInfo != null && _DocVersionInfo.MyFormat != null) return _DocVersionInfo.MyFormat.PlantFormat.FormatData.Name;
return null;
@ -129,17 +130,14 @@ namespace VEPROMS.CSLA.Library
if (_DocVersion != null) _DocVersion.MyFormat = FormatList.ToFormat(value); // Can only be set if _DocVersion is set
}
}
//[Category("Format")]
[Category("Format Settings")]
[DisplayName("Default Format")]
[Description("Format")]
[Description("Default Format")]
[TypeConverter(typeof(FormatList))]
public string DefaultFormatSelection
{
get
{
//if (_DocVersion != null) return FormatList.ToString(_DocVersion.FormatID);
//if (_DocVersionInfo != null) return FormatList.ToString(_DocVersionInfo.FormatID);
if (_DocVersion != null && _DocVersion.MyFolder != null && _DocVersion.MyFolder.ActiveParent != null) return _DocVersion.MyFolder.ActiveFormat.PlantFormat.FormatData.Name;
if (_DocVersionInfo != null && _DocVersionInfo.MyFolder != null && _DocVersionInfo.MyFolder.ActiveParent != null) return _DocVersionInfo.MyFolder.ActiveFormat.PlantFormat.FormatData.Name;
return null;
@ -155,9 +153,7 @@ namespace VEPROMS.CSLA.Library
//<Config><RODefaults Setpoint="SP1" Graphics="IG1" ROPATH="g:\ops\vehlp\ro" /><PrintSettings ChangeBar="3" ChangeBarLoc="1" ChangeBarText="3" numcopies="1" Watermark="1" userformat=" " disableduplex="False" /><format plant="OHLP" /></Config>
#region RODefaults // From proc.ini
//[Category("RODefaults")]
[Category("Referenced Objects")]
//[DisplayName("Setpoint Prefix")]
[DisplayName("Default RO Prefix")]
[RefreshProperties(RefreshProperties.All)]
[Description("Setpoint Prefix")]
@ -165,17 +161,36 @@ namespace VEPROMS.CSLA.Library
{
get
{
return _Xp["RODefaults", "Setpoint"];
string s = _Xp["RODefaults", "Setpoint"];// 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("RODefaults", "Setpoint"); // get the parent value
// If there is no parent value, then use the volian default
if (s == string.Empty)
s = "SP1";// default to volian default
return s;
}
set
{
_Xp["RODefaults", "Setpoint"] = value;
// 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("RODefaults", "Setpoint"); // get the parent value
if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default
parval = "SP1";
if (parval.Equals(value))
_Xp["RODefaults", "Setpoint"] = string.Empty; // reset to parent value
else
_Xp["RODefaults", "Setpoint"] = value; // save selected value
OnPropertyChanged("RODefaults_setpointprefix");
}
}
//[Category("RODefaults")]
[Category("Referenced Objects")]
//[DisplayName("Graphics Prefix")]
[DisplayName("Default Graphics Prefix")]
[RefreshProperties(RefreshProperties.All)]
[Description("Graphics Prefix")]
@ -183,17 +198,36 @@ namespace VEPROMS.CSLA.Library
{
get
{
return _Xp["RODefaults", "Graphics"];
string s = _Xp["RODefaults", "Graphics"];// 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("RODefaults", "Graphics"); // get the parent value
// If there is no parent value, then use the volian default
if (s == string.Empty)
s = "IG1";// default to volian default
return s;
}
set
{
_Xp["RODefaults", "Graphics"] = value;
// 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("RODefaults", "Graphics"); // get the parent value
if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default
parval = "IG1";
if (parval.Equals(value))
_Xp["RODefaults", "Graphics"] = string.Empty; // reset to parent value
else
_Xp["RODefaults", "Graphics"] = value; // save selected value
OnPropertyChanged("RODefaults_graphicsprefix");
}
}
//[Category("Graphics")]
[Category("Referenced Objects")]
//[DisplayName("Default File Extension")]
[DisplayName("Graphic File Extension")]
[RefreshProperties(RefreshProperties.All)]
[Description("Default File Extension")]
@ -201,17 +235,40 @@ namespace VEPROMS.CSLA.Library
{
get
{
return _Xp["Graphics", "defaultext"];
string s = _Xp["Graphics", "defaultext"];// 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("Graphics", "defaultext"); // get the parent value
// If there is no parent value, then use the volian default
if (s == string.Empty)
return s = "TIF";// default to volian default
return s;
}
set
{
_Xp["Graphics", "defaultext"] = value;
// 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("Graphics", "defaultext"); // get the parent value
if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default
parval = "TIF";
if (parval.Equals(value))
_Xp["Graphics", "defaultext"] = string.Empty; // reset to parent value
else
_Xp["Graphics", "defaultext"] = value; // save selected value
OnPropertyChanged("Graphics_defaultext");
}
}
#endregion
#region PrintSettingsCategory // From curset.dat
[Category("Print Settings")]
//PROPGRID: Hide Printer
[Browsable(false)]
[DisplayName("Number of Copies")]
[RefreshProperties(RefreshProperties.All)]
[Description("Number of Copies")]
@ -230,6 +287,8 @@ namespace VEPROMS.CSLA.Library
}
}
[Category("Print Settings")]
//PROPGRID: Hide Printer
[Browsable(false)]
[DisplayName("Printer")]
[RefreshProperties(RefreshProperties.All)]
[Description("Printer")]
@ -246,12 +305,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Print_Printer");
}
}
//public enum PrintWatermark : int
//{
// None = 0, Reference, Draft, Master, Sample,
// [Description("Information Only")]
// InformationOnly
//}
[TypeConverter(typeof(EnumDescConverter))]
public enum PrintWatermark : int
{
@ -259,7 +312,6 @@ namespace VEPROMS.CSLA.Library
[Description("Information Only")]
InformationOnly
}
//[TypeConverter(typeof(EnumDescConverter))]
[Category("Print Settings")]
[DisplayName("Watermark")]
@ -270,18 +322,35 @@ namespace VEPROMS.CSLA.Library
get
{
string s = _Xp["PrintSettings", "Watermark"];
if (s == string.Empty || s.Equals("-1")) return PrintWatermark.Draft;
return (PrintWatermark)int.Parse(_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 == PrintWatermark.Draft) _Xp["PrintSettings", "Watermark"] = string.Empty;
else _Xp["PrintSettings", "Watermark"] = ((int)value).ToString();
// 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 Duplex Printing")]
[DisplayName("Disable Automatic Duplexing")]
[RefreshProperties(RefreshProperties.All)]
[Description("Disable Duplex Printing")]
@ -290,12 +359,31 @@ namespace VEPROMS.CSLA.Library
get
{
string s = _Xp["PrintSettings", "disableduplex"];
if (s == string.Empty) return false;
return bool.Parse(_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
{
_Xp["PrintSettings", "disableduplex"] = value.ToString();
// 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");
}
}
@ -304,10 +392,6 @@ namespace VEPROMS.CSLA.Library
// Without Change Bars
// With Default Change Bars
// With User Specified Change Bars
//public enum PrintChangeBar : int
//{
// NoDefault = 0, Without, WithDefault, WithUserSpecified
//}
[TypeConverter(typeof(EnumDescConverter))]
public enum PrintChangeBar : int
{
@ -321,9 +405,7 @@ namespace VEPROMS.CSLA.Library
WithUserSpecified
}
//[Category("Print Settings")]
[Category("Format Settings")]
//[DisplayName("Change Bar")]
[DisplayName("Change Bars")]
[RefreshProperties(RefreshProperties.All)]
[Description("Change Bar Use")]
@ -332,28 +414,34 @@ namespace VEPROMS.CSLA.Library
get
{
string s = _Xp["PrintSettings", "ChangeBar"];
if (s == string.Empty || s.Equals("-1")) return PrintChangeBar.SelectBeforePrinting;//PrintChangeBar.NoDefault;
return (PrintChangeBar)int.Parse(_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 == PrintChangeBar.NoDefault) _Xp["PrintSettings", "ChangeBar"] = string.Empty;
if (value == PrintChangeBar.SelectBeforePrinting) _Xp["PrintSettings", "ChangeBar"] = string.Empty;
else _Xp["PrintSettings", "ChangeBar"] = ((int)value).ToString();
// 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");
}
}
//public string Print_ChangeBarstr
//{
// get
// {
// return EnumDescConverter.GetEnumDescription(
// string s = _Xp["PrintSettings", "ChangeBar"];
// if (s == string.Empty) return PrintChangeBar.SelectBeforePrinting;//PrintChangeBar.NoDefault;
// return (PrintChangeBar)int.Parse(_Xp["PrintSettings", "ChangeBar"]);
// }
//}
// User Specified Change Bar Location from16-bit code:
// With Text
// Outside Box
@ -371,9 +459,7 @@ namespace VEPROMS.CSLA.Library
[Description("To the Left of the Text")]
LeftOfText
}
//[Category("Print Settings")]
[Category("Format Settings")]
//[DisplayName("Change Bar Location")]
[DisplayName("Change Bar Position")]
[RefreshProperties(RefreshProperties.All)]
[Description("User Specified Change Bar Location")]
@ -382,13 +468,31 @@ namespace VEPROMS.CSLA.Library
get
{
string s = _Xp["PrintSettings", "ChangeBarLoc"];
if (s == string.Empty || s.Equals("-1")) return PrintChangeBarLoc.WithText;
return (PrintChangeBarLoc)int.Parse(_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 == PrintChangeBarLoc.WithText) _Xp["PrintSettings", "ChangeBarLoc"] = string.Empty;
else _Xp["PrintSettings", "ChangeBarLoc"] = ((int)value).ToString();
// 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");
}
}
@ -399,10 +503,6 @@ namespace VEPROMS.CSLA.Library
// Change ID
// No Change Bar Message
// User Defined Message
//public enum PrintChangeBarText : int
//{
// DateChgID = 0, RevNum, ChgID, None, UserDef
//}
[TypeConverter(typeof(EnumDescConverter))]
public enum PrintChangeBarText : int
{
@ -417,9 +517,7 @@ namespace VEPROMS.CSLA.Library
[Description("Custom Change Bar Text")]
UserDef
}
//[Category("Print Settings")]
[Category("Format Settings")]
//[DisplayName("Change Bar Text")]
[DisplayName("Change Bar Text Type")]
[Description("Change Bar Text")]
public PrintChangeBarText Print_ChangeBarText
@ -427,19 +525,35 @@ namespace VEPROMS.CSLA.Library
get
{
string s = _Xp["PrintSettings", "ChangeBarText"];
if (s == string.Empty || s.Equals("-1")) return PrintChangeBarText.DateChgID;
return (PrintChangeBarText)int.Parse(_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 == PrintChangeBarText.DateChgID) _Xp["PrintSettings", "ChangeBarText"] = string.Empty;
else _Xp["PrintSettings", "ChangeBarText"] = ((int)value).ToString();
// 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")]
[Category("Format Settings")]
//[DisplayName("User Change Bar Message1")]
[DisplayName("Custom Change Bar Message Line One")]
[RefreshProperties(RefreshProperties.All)]
[Description("User Change Bar Message1")]
@ -447,17 +561,36 @@ namespace VEPROMS.CSLA.Library
{
get
{
return _Xp["PrintSettings", "usercbmess1"];
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)
return "";// default to volian default
return s;
}
set
{
_Xp["PrintSettings", "usercbmess1"] = value;
// 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("Print Settings")]
[Category("Format Settings")]
//[DisplayName("User Change Bar Message2")]
[DisplayName("Custom Change Bar Message Line Two")]
[RefreshProperties(RefreshProperties.All)]
[Description("User Change Bar Message2")]
@ -465,15 +598,38 @@ namespace VEPROMS.CSLA.Library
{
get
{
return _Xp["PrintSettings", "usercbmess2"];
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)
return "";// default to volian default
return s;
}
set
{
_Xp["PrintSettings", "usercbmess2"] = value;
// 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");
}
}
[Category("Print Settings")]
//PROPGRID: Hide User Format
[Browsable(false)]
[DisplayName("User Format")]
[RefreshProperties(RefreshProperties.All)]
[Description("User Format")]
@ -502,17 +658,36 @@ namespace VEPROMS.CSLA.Library
get
{
string s = _Xp["PrintSettings", "Pagination"];
if (s == string.Empty || s.Equals("-1")) return PrintPagination.Auto;
return (PrintPagination)int.Parse(_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 == PrintPagination.Auto) _Xp["PrintSettings", "Pagination"] = string.Empty;
else _Xp["PrintSettings", "Pagination"] = ((int)value).ToString();
// 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");
}
}
#endregion
#region DELETE_ME
/*
#region ColorCategory // From veproms.ini
// Note that not all possibilities from 16-bit will be added here, until
@ -1050,5 +1225,6 @@ OnPropertyChanged("Default_BkColor");
}
}
*/
#endregion
}
}

File diff suppressed because it is too large Load Diff

View File

@ -32,13 +32,18 @@ namespace VEPROMS.CSLA.Library
}
#endregion
#region Constructors
//PROPGRID: Hide ParentLookup
[Browsable(false)]
public bool ParentLookup
{
get { return _Xp.ParentLookup; }
set { _Xp.ParentLookup = value; }
}
[NonSerialized]
//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; }
@ -64,7 +69,7 @@ namespace VEPROMS.CSLA.Library
{
retval = proc.ProcedureConfig.GetValue(args.Group, args.Item);
if (retval != string.Empty) return retval;
proc = (Procedure) proc.ActiveParent;
proc = (Procedure)proc.ActiveParent;
}
DocVersion docVersion = (DocVersion)proc.ActiveParent;
retval = docVersion.DocVersionConfig.GetValue(args.Group, args.Item);
@ -115,7 +120,6 @@ namespace VEPROMS.CSLA.Library
}
#endregion
#region Local Properties
//[Category("Identification")]
[Category("General")]
[DisplayName("Number")]
[Description("Number")]
@ -124,7 +128,6 @@ namespace VEPROMS.CSLA.Library
get { return (_Procedure != null ? _Procedure.MyContent.Number : _ProcedureInfo.MyContent.Number); }
set { if (_Procedure != null) _Procedure.MyContent.Number = value; }
}
//[Category("Identification")]
[Category("General")]
[DisplayName("Title")]
[Description("Title")]
@ -134,21 +137,24 @@ namespace VEPROMS.CSLA.Library
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)); }
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 ); }
get { return (_Procedure != null ? _Procedure.IsDirty : false); }
}
//[Category("Format")]
[Category("Format Settings")]
[DisplayName("Format")]
[Description("Format")]
@ -157,8 +163,6 @@ namespace VEPROMS.CSLA.Library
{
get
{
//if (_DocVersion != null) return FormatList.ToString(_DocVersion.FormatID);
//if (_DocVersionInfo != null) return FormatList.ToString(_DocVersionInfo.FormatID);
if (_Procedure != null && _Procedure.MyContent.MyFormat != null) return _Procedure.MyContent.MyFormat.PlantFormat.FormatData.Name;
if (_ProcedureInfo != null && _ProcedureInfo.MyContent.MyFormat != null) return _ProcedureInfo.MyContent.MyFormat.PlantFormat.FormatData.Name;
return null;
@ -168,18 +172,14 @@ namespace VEPROMS.CSLA.Library
if (_Procedure != null) _Procedure.MyContent.MyFormat = FormatList.ToFormat(value); // Can only be set if _DocVersion is set
}
}
//[Category("Format")]
[Category("Format Settings")]
//[DisplayName("Format")]
[DisplayName("Default Format")]
[Description("Format")]
[Description("Default Format")]
[TypeConverter(typeof(FormatList))]
public string DefaultFormatSelection
{
get
{
//if (_Folder != null) return FormatList.ToString(_Folder.FormatID);
//if (_FolderInfo != null) return FormatList.ToString(_FolderInfo.FormatID);
if (_Procedure != null && _Procedure.ActiveParent != null && _Procedure.ActiveParent.ActiveFormat != null) return _Procedure.ActiveParent.ActiveFormat.PlantFormat.FormatData.Name;
if (_ProcedureInfo != null && _ProcedureInfo.MyParent != null && _ProcedureInfo.MyParent.ActiveFormat != null) return _ProcedureInfo.MyParent.ActiveFormat.PlantFormat.FormatData.Name;
return null;
@ -208,9 +208,7 @@ namespace VEPROMS.CSLA.Library
[Description("Quad Column")]
FourColumns
}
//[Category("Format")]
[Category("General")]
//[DisplayName("Column Layout")]
[DisplayName("Default Column Mode")]
[RefreshProperties(RefreshProperties.All)]
[Description("Column Layout")]
@ -219,18 +217,37 @@ namespace VEPROMS.CSLA.Library
get
{
string s = _Xp["format", "columns"];
if (s == string.Empty || s.Equals("-1")) return FormatColumns.Default;//(FormatColumns)0;
return (FormatColumns)int.Parse(_Xp["format", "columns"]);
//return Enum.Parse(typeof(FormatColumns),_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.Default;// default to volian default
return (FormatColumns)int.Parse(s);
}
set
{
if (value == 0) _Xp["format", "columns"] = string.Empty;
else _Xp["format", "columns"] = ((int)value).ToString();
// 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")]
@ -249,6 +266,8 @@ namespace VEPROMS.CSLA.Library
#endregion
#region PrintSettingsCategory // From curset.dat
[Category("Print Settings")]
//PROPGRID: Hide Number of Copies
[Browsable(false)]
[DisplayName("Number of Copies")]
[RefreshProperties(RefreshProperties.All)]
[Description("Number of Copies")]
@ -280,14 +299,32 @@ namespace VEPROMS.CSLA.Library
{
get
{
string s = _Xp["PrintSettings", "Pagination"];
if (s == string.Empty || s.Equals("-1")) return PrintPagination.Auto;
return (PrintPagination)int.Parse(_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 == PrintPagination.Auto) _Xp["PrintSettings", "Pagination"] = string.Empty;
else _Xp["PrintSettings", "Pagination"] = ((int)value).ToString();
// 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");
}
}
@ -307,18 +344,35 @@ namespace VEPROMS.CSLA.Library
get
{
string s = _Xp["PrintSettings", "Watermark"];
if (s == string.Empty || s.Equals("-1")) return PrintWatermark.Draft;
return (PrintWatermark)int.Parse(_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 == PrintWatermark.Draft) _Xp["PrintSettings", "Watermark"] = string.Empty;
else _Xp["PrintSettings", "Watermark"] = ((int)value).ToString();
// 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 Duplex Printing")]
[DisplayName("Disable Automatic Duplexing")]
[RefreshProperties(RefreshProperties.All)]
[Description("Disable Duplex Printing")]
@ -327,12 +381,31 @@ namespace VEPROMS.CSLA.Library
get
{
string s = _Xp["PrintSettings", "disableduplex"];
if (s == string.Empty) return false;
return bool.Parse(_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
{
_Xp["PrintSettings", "disableduplex"] = value.ToString();
// 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");
}
}
@ -353,13 +426,6 @@ namespace VEPROMS.CSLA.Library
[Description("Use Custom Change Bars")]
WithUserSpecified
}
//{
// [Description("Select When Printed")]NoDefault = 0,
// [Description("None")]Without,
// [Description("Default")]WithDefault,
// [Description("User Specified")]WithUserSpecified
//}
//[Category("Print Settings")]
[Category("Format Settings")]
[DisplayName("Change Bar")]
[RefreshProperties(RefreshProperties.All)]
@ -369,14 +435,31 @@ namespace VEPROMS.CSLA.Library
get
{
string s = _Xp["PrintSettings", "ChangeBar"];
if (s == string.Empty || s.Equals("-1")) return PrintChangeBar.SelectBeforePrinting;//PrintChangeBar.NoDefault;
return (PrintChangeBar)int.Parse(_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 == PrintChangeBar.NoDefault) _Xp["PrintSettings", "ChangeBar"] = string.Empty;
if (value == PrintChangeBar.SelectBeforePrinting) _Xp["PrintSettings", "ChangeBar"] = string.Empty;
else _Xp["PrintSettings", "ChangeBar"] = ((int)value).ToString();
// 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");
}
}
@ -397,9 +480,7 @@ namespace VEPROMS.CSLA.Library
[Description("To the Left of the Text")]
LeftOfText
}
//[Category("Print Settings")]
[Category("Format Settings")]
//[DisplayName("Change Bar Location")]
[DisplayName("Change Bar Position")]
[RefreshProperties(RefreshProperties.All)]
[Description("User Specified Change Bar Location")]
@ -408,13 +489,31 @@ namespace VEPROMS.CSLA.Library
get
{
string s = _Xp["PrintSettings", "ChangeBarLoc"];
if (s == string.Empty || s.Equals("-1")) return PrintChangeBarLoc.WithText;
return (PrintChangeBarLoc)int.Parse(_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 == PrintChangeBarLoc.WithText) _Xp["PrintSettings", "ChangeBarLoc"] = string.Empty;
else _Xp["PrintSettings", "ChangeBarLoc"] = ((int)value).ToString();
// 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");
}
}
@ -439,9 +538,7 @@ namespace VEPROMS.CSLA.Library
[Description("Custom Change Bar Text")]
UserDef
}
//[Category("Print Settings")]
[Category("Format Settings")]
//[DisplayName("Change Bar Text")]
[DisplayName("Change Bar Text Type")]
[RefreshProperties(RefreshProperties.All)]
[Description("Change Bar Text")]
@ -450,18 +547,38 @@ namespace VEPROMS.CSLA.Library
get
{
string s = _Xp["PrintSettings", "ChangeBarText"];
if (s == string.Empty || s.Equals("-1")) return PrintChangeBarText.DateChgID;
return (PrintChangeBarText)int.Parse(_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 == PrintChangeBarText.DateChgID) _Xp["PrintSettings", "ChangeBarText"] = string.Empty;
else _Xp["PrintSettings", "ChangeBarText"] = ((int)value).ToString();
// 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")]
@ -478,9 +595,7 @@ namespace VEPROMS.CSLA.Library
}
}
//[Category("Print Settings")]
[Category("Format Settings")]
//[DisplayName("User Change Bar Message1")]
[DisplayName("Custom Change Bar Message Line One")]
[RefreshProperties(RefreshProperties.All)]
[Description("User Change Bar Message1")]
@ -488,18 +603,37 @@ namespace VEPROMS.CSLA.Library
{
get
{
return _Xp["PrintSettings", "usercbmess1"];
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
{
_Xp["PrintSettings", "usercbmess1"] = value;
// 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("Print Settings")]
[Category("Format Settings")]
//[DisplayName("User Change Bar Message2")]
[DisplayName("Custom Change Bar Message Line Two")]
[RefreshProperties(RefreshProperties.All)]
[Description("User Change Bar Message2")]
@ -507,11 +641,32 @@ namespace VEPROMS.CSLA.Library
{
get
{
return _Xp["PrintSettings", "usercbmess2"];
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
{
_Xp["PrintSettings", "usercbmess2"] = value;
// 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");
}
}