121 lines
2.8 KiB
C#
121 lines
2.8 KiB
C#
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
|
|
}
|
|
}
|