63 lines
2.0 KiB
C#
63 lines
2.0 KiB
C#
using System;
|
|
using System.ComponentModel;
|
|
using System.Xml.Serialization;
|
|
|
|
namespace VEPROMS.CSLA.Library
|
|
{
|
|
public class DynamicPropertyDescriptor : PropertyDescriptor
|
|
{
|
|
private readonly PropertyDescriptor _BasePropertyDescriptor;
|
|
private readonly ConfigDynamicTypeDescriptor _Instance;
|
|
|
|
public DynamicPropertyDescriptor(ConfigDynamicTypeDescriptor instance, PropertyDescriptor basePropertyDescriptor)
|
|
: base(basePropertyDescriptor)
|
|
{
|
|
_Instance = instance;
|
|
_BasePropertyDescriptor = basePropertyDescriptor;
|
|
}
|
|
public override bool CanResetValue(object component)
|
|
{ return _BasePropertyDescriptor.CanResetValue(component); }
|
|
public override Type ComponentType
|
|
{ get { return _BasePropertyDescriptor.ComponentType; } }
|
|
public override object GetValue(object component)
|
|
{ return _BasePropertyDescriptor.GetValue(component); }
|
|
public override bool IsReadOnly
|
|
{ get { return _Instance.IsReadOnly; } }
|
|
public override Type PropertyType
|
|
{ get { return _BasePropertyDescriptor.PropertyType; } }
|
|
public override void ResetValue(object component)
|
|
{ _BasePropertyDescriptor.ResetValue(component); }
|
|
public override bool ShouldSerializeValue(object component)
|
|
{ return _BasePropertyDescriptor.ShouldSerializeValue(component); }
|
|
public override void SetValue(object component, object value)
|
|
{ _BasePropertyDescriptor.SetValue(component, value); }
|
|
}
|
|
[Serializable()]
|
|
public class ConfigDynamicTypeDescriptor
|
|
{
|
|
#region Events
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
protected void OnPropertyChanged(String info)
|
|
{
|
|
_IsDirty = true;
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(info));
|
|
}
|
|
[NonSerialized]
|
|
private bool _IsDirty = false;
|
|
[XmlIgnore]
|
|
[Browsable(false)]
|
|
public bool IsDirty
|
|
{
|
|
get { return _IsDirty; }
|
|
set { _IsDirty = value; }
|
|
}
|
|
#endregion
|
|
private bool _IsReadOnly = false;
|
|
internal virtual bool IsReadOnly
|
|
{
|
|
get { return _IsReadOnly; }
|
|
set { _IsReadOnly = value; }
|
|
}
|
|
}
|
|
}
|