Files
SourceCode/PROMS/VEPROMS.CSLA.Library/Config/ROImageConfig.cs
T
2026-08-28 11:15:35 -04:00

60 lines
1.4 KiB
C#

using System;
using System.ComponentModel;
namespace VEPROMS.CSLA.Library
{
[Serializable]
[TypeConverter(typeof(ExpandableObjectConverter))]
public class ROImageConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{
#region DynamicTypeDescriptor
internal override bool IsReadOnly => _ROImageInfo == null;
#endregion
#region XML
private readonly XMLProperties _Xp;
#endregion
#region Constructors
private readonly ROImageInfo _ROImageInfo;
public ROImageConfig(ROImageInfo rOImageInfo)
{
_ROImageInfo = rOImageInfo;
string xml = rOImageInfo.Config;
if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml);
}
public ROImageConfig()
{
string xml = "<Config/>";
_Xp = new XMLProperties(xml);
}
internal string GetValue(string group, string item) => _Xp[group, item];
#endregion
#region Local Properties
[Category("Image")]
[Browsable(false)]
[DisplayName("Size")]
[RefreshProperties(RefreshProperties.All)]
[Description("Size")]
public string Image_Size
{
get
{
return _Xp["Image", "Size"];
}
set
{
_Xp["Image", "Size"] = value;
OnPropertyChanged("Image_Size");
}
}
#endregion
#region ToString
public override string ToString()
{
string s = _Xp.ToString();
return s == "<Config/>" || s == "<Config></Config>" ? string.Empty : s;
}
#endregion
}
}