2012-09-12 13:03:59 +00:00

71 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
{
get { return _ROImageInfo == null; }
}
#endregion
#region XML
private XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
#endregion
#region Constructors
private 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)
{
return _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();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty;
return s;
}
#endregion
}
}