using System; using System.ComponentModel; namespace VEPROMS.CSLA.Library { [Serializable] [TypeConverter(typeof(ExpandableObjectConverter))] public class AssociationConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged { #region DynamicTypeDescriptor internal override bool IsReadOnly => _Association == null; #endregion #region XML private readonly XMLProperties _Xp; #endregion #region Constructors private readonly Association _Association; public AssociationConfig(Association association) { _Association = association; string xml = association.Config; if (xml == string.Empty) xml = ""; _Xp = new XMLProperties(xml); } private readonly 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) => _Xp[group, item]; #endregion public Association MyAssociation => _Association; #region RODefaults // From proc.ini [Category("Referenced Objects")] [DisplayName("Default RO Prefix")] [RefreshProperties(RefreshProperties.All)] [Description("Setpoint Prefix")] 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 } } // B2017-125 save status of loading RO Figues [Category("RO Update")] [DisplayName("Loading Figures")] [RefreshProperties(RefreshProperties.All)] [Description("Loading Figures Status")] public string ROUpdate_LoadingFigures { get { string s = _Xp["ROUpdate", "LoadingFigures"];// get the saved value return s; } set { _Xp["ROUpdate", "LoadingFigures"] = value; // save selected value } } [Category("RO Update")] [DisplayName("Previous ROFSTID")] [RefreshProperties(RefreshProperties.All)] [Description("Previous ROFSTID")] public string ROUpdate_PrevROFSTID { get { string s = _Xp["ROUpdate", "PrevROFSTID"];// get the saved value return s; } set { _Xp["ROUpdate", "PrevROFSTID"] = value; // save selected value } } #endregion // ROUpdate #region ToString public override string ToString() { string s = _Xp.ToString(); return s == "" || s == "" ? string.Empty : s; } #endregion } }