CSLA Config cleanup
This commit is contained in:
@@ -1,17 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.ComponentModel;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using System.Xml.Schema;
|
||||
|
||||
namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
public class DynamicPropertyDescriptor : PropertyDescriptor
|
||||
{
|
||||
private PropertyDescriptor _BasePropertyDescriptor;
|
||||
private ConfigDynamicTypeDescriptor _Instance;
|
||||
private readonly PropertyDescriptor _BasePropertyDescriptor;
|
||||
private readonly ConfigDynamicTypeDescriptor _Instance;
|
||||
|
||||
public DynamicPropertyDescriptor(ConfigDynamicTypeDescriptor instance, PropertyDescriptor basePropertyDescriptor)
|
||||
: base(basePropertyDescriptor)
|
||||
@@ -37,16 +33,15 @@ namespace VEPROMS.CSLA.Library
|
||||
{ _BasePropertyDescriptor.SetValue(component, value); }
|
||||
}
|
||||
[Serializable()]
|
||||
public class ConfigDynamicTypeDescriptor //: ICustomTypeDescriptor//, ISupportInitialize
|
||||
public class ConfigDynamicTypeDescriptor
|
||||
{
|
||||
#region Events
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
protected void OnPropertyChanged(String info)
|
||||
{
|
||||
_IsDirty = true;
|
||||
if (PropertyChanged != null)
|
||||
PropertyChanged(this, new PropertyChangedEventArgs(info));
|
||||
}
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(info));
|
||||
}
|
||||
[NonSerialized]
|
||||
private bool _IsDirty = false;
|
||||
[XmlIgnore]
|
||||
@@ -57,54 +52,11 @@ namespace VEPROMS.CSLA.Library
|
||||
set { _IsDirty = value; }
|
||||
}
|
||||
#endregion
|
||||
[NonSerialized]
|
||||
private PropertyDescriptorCollection dynamicProps;
|
||||
private bool _IsReadOnly = false;
|
||||
internal virtual bool IsReadOnly
|
||||
{
|
||||
get { return _IsReadOnly; }
|
||||
set { _IsReadOnly = value; }
|
||||
}
|
||||
public ConfigDynamicTypeDescriptor() { }
|
||||
#region "TypeDescriptor Implementation"
|
||||
public String GetClassName()
|
||||
{ return TypeDescriptor.GetClassName(this, true); }
|
||||
public AttributeCollection GetAttributes()
|
||||
{ return TypeDescriptor.GetAttributes(this, true); }
|
||||
public String GetComponentName()
|
||||
{ return TypeDescriptor.GetComponentName(this, true); }
|
||||
public TypeConverter GetConverter()
|
||||
{ return TypeDescriptor.GetConverter(this, true); }
|
||||
public EventDescriptor GetDefaultEvent()
|
||||
{ return TypeDescriptor.GetDefaultEvent(this, true); }
|
||||
public PropertyDescriptor GetDefaultProperty()
|
||||
{ return TypeDescriptor.GetDefaultProperty(this, true); }
|
||||
public object GetEditor(Type editorBaseType)
|
||||
{ return TypeDescriptor.GetEditor(this, editorBaseType, true); }
|
||||
public EventDescriptorCollection GetEvents(Attribute[] attributes)
|
||||
{ return TypeDescriptor.GetEvents(this, attributes, true); }
|
||||
public EventDescriptorCollection GetEvents()
|
||||
{ return TypeDescriptor.GetEvents(this, true); }
|
||||
public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
|
||||
{
|
||||
return GetProperties();
|
||||
}
|
||||
public PropertyDescriptorCollection GetProperties()
|
||||
{
|
||||
if (dynamicProps == null)
|
||||
{
|
||||
PropertyDescriptorCollection baseProps = TypeDescriptor.GetProperties(this, true);
|
||||
dynamicProps = new PropertyDescriptorCollection(null);
|
||||
|
||||
foreach (PropertyDescriptor oProp in baseProps)
|
||||
{
|
||||
dynamicProps.Add(new DynamicPropertyDescriptor(this, oProp));
|
||||
}
|
||||
}
|
||||
return dynamicProps;
|
||||
}
|
||||
public object GetPropertyOwner(PropertyDescriptor pd)
|
||||
{ return this; }
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user