CSLA Config cleanup
This commit is contained in:
@@ -7,21 +7,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||
public class ImageConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
|
||||
{
|
||||
#region DynamicTypeDescriptor
|
||||
internal override bool IsReadOnly
|
||||
{
|
||||
get { return _ImageInfo == null; }
|
||||
}
|
||||
#endregion
|
||||
#region XML
|
||||
private XMLProperties _Xp;
|
||||
private XMLProperties Xp
|
||||
{
|
||||
get { return _Xp; }
|
||||
}
|
||||
#region DynamicTypeDescriptor
|
||||
internal override bool IsReadOnly => _ImageInfo == null;
|
||||
#endregion
|
||||
#region XML
|
||||
private readonly XMLProperties _Xp;
|
||||
#endregion
|
||||
#region Constructors
|
||||
private ImageInfo _ImageInfo;
|
||||
private readonly ImageInfo _ImageInfo;
|
||||
public ImageConfig(ImageInfo imageInfo)
|
||||
{
|
||||
if (imageInfo == null)
|
||||
@@ -40,13 +33,10 @@ namespace VEPROMS.CSLA.Library
|
||||
string xml = "<Config/>";
|
||||
_Xp = new XMLProperties(xml);
|
||||
}
|
||||
internal string GetValue(string group, string item)
|
||||
{
|
||||
return _Xp[group, item];
|
||||
}
|
||||
#endregion
|
||||
#region Local Properties
|
||||
[Category("Image")]
|
||||
internal string GetValue(string group, string item) => _Xp[group, item];
|
||||
#endregion
|
||||
#region Local Properties
|
||||
[Category("Image")]
|
||||
[Browsable(false)]
|
||||
[DisplayName("DataSize")]
|
||||
[RefreshProperties(RefreshProperties.All)]
|
||||
@@ -57,16 +47,16 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
string s = _Xp["Image", "DataSize"];
|
||||
if (s == string.Empty) return 0;
|
||||
int tst = 0;
|
||||
int tst;
|
||||
try
|
||||
{
|
||||
tst = int.Parse(s);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return int.Parse(s);
|
||||
return tst;
|
||||
}
|
||||
set
|
||||
{
|
||||
@@ -87,16 +77,16 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
string s = _Xp["Image", "Width"];
|
||||
if (s == string.Empty) return 0;
|
||||
int tst = 0;
|
||||
int tst;
|
||||
try
|
||||
{
|
||||
tst = int.Parse(s);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return int.Parse(s);
|
||||
return tst;
|
||||
}
|
||||
set
|
||||
{
|
||||
@@ -117,16 +107,16 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
string s = _Xp["Image", "Height"];
|
||||
if (s == string.Empty) return 0;
|
||||
int tst = 0;
|
||||
int tst;
|
||||
try
|
||||
{
|
||||
tst = int.Parse(s);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return int.Parse(s);
|
||||
return tst;
|
||||
}
|
||||
set
|
||||
{
|
||||
@@ -141,9 +131,8 @@ namespace VEPROMS.CSLA.Library
|
||||
public override string ToString()
|
||||
{
|
||||
string s = _Xp.ToString();
|
||||
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty;
|
||||
return s;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
return s == "<Config/>" || s == "<Config></Config>" ? string.Empty : s;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user