From 44b6d0e1770087d519c9187f02eb3fb889b24ff3 Mon Sep 17 00:00:00 2001 From: Kathy Date: Tue, 27 Jan 2009 15:33:17 +0000 Subject: [PATCH] --- .../Config/AssocConfig.cs | 102 ++++++++++++++++++ .../Config/DocVersionConfig.cs | 74 ------------- 2 files changed, 102 insertions(+), 74 deletions(-) create mode 100644 PROMS/VEPROMS.CSLA.Library/Config/AssocConfig.cs diff --git a/PROMS/VEPROMS.CSLA.Library/Config/AssocConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/AssocConfig.cs new file mode 100644 index 00000000..03ca611c --- /dev/null +++ b/PROMS/VEPROMS.CSLA.Library/Config/AssocConfig.cs @@ -0,0 +1,102 @@ +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 = ""; + _Xp = new XMLProperties(xml); + } + private AssociationInfo _AssociationInfo; + public AssociationConfig(AssociationInfo association) + { + _AssociationInfo = association; + string xml = association.Config; + if (xml == string.Empty) xml = ""; + _Xp = new XMLProperties(xml); + } + public AssociationConfig(string xml) + { + _Xp = new XMLProperties(xml); + } + public AssociationConfig() + { + string xml = ""; + _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 ToString + public override string ToString() + { + string s = _Xp.ToString(); + if (s == "" || s == "") return string.Empty; + return s; + } + #endregion + } +} diff --git a/PROMS/VEPROMS.CSLA.Library/Config/DocVersionConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/DocVersionConfig.cs index 8b5e13e9..276a4398 100644 --- a/PROMS/VEPROMS.CSLA.Library/Config/DocVersionConfig.cs +++ b/PROMS/VEPROMS.CSLA.Library/Config/DocVersionConfig.cs @@ -163,43 +163,6 @@ namespace VEPROMS.CSLA.Library #region RODefaults // From proc.ini [Category("Referenced Objects")] - [DisplayName("RO Path")] - [RefreshProperties(RefreshProperties.All)] - [Description("Path to RO.FST")] - public string RODefaults_ropath - { - get - { - string s = _Xp["RODefaults", "ROPATH"];// 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", "ROPATH"); // get the parent value - // If there is no parent value, then use the volian default - if (s == string.Empty) - s = ""; // no default for empty for path - - 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("RODefaults", "ROPATH"); // 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["RODefaults", "ROPATH"] = string.Empty; // reset to parent value - else - _Xp["RODefaults", "ROPATH"] = value; // save selected value - - OnPropertyChanged("RODefaults_ropath"); - } - } - [Category("Referenced Objects")] [DisplayName("Default RO Prefix")] [RefreshProperties(RefreshProperties.All)] [Description("Setpoint Prefix")] @@ -273,43 +236,6 @@ namespace VEPROMS.CSLA.Library OnPropertyChanged("RODefaults_graphicsprefix"); } } - [Category("Referenced Objects")] - [DisplayName("Graphic File Extension")] - [RefreshProperties(RefreshProperties.All)] - [Description("Default File Extension")] - public string Graphics_defaultext - { - get - { - 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 - { - // 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")]