public InternalPropertyDescriptor(string name, Type dt, DynamicWithBag iw, ServiceScope ss) : base(name, null) { _name = name; _dt = dt; _iw = iw; _ss = ss; }
public DynamicBindable(DynamicWithBag infra) { _initScope = CEF.CurrentServiceScope; _infra = infra ?? throw new ArgumentNullException("infra"); var es = infra as INotifyPropertyChanged; if (es == null) { es = infra.GetWrappedObject() as INotifyPropertyChanged; } _eventSource = es; if (_eventSource != null) { _eventSource.PropertyChanged += eventSource_PropertyChanged; } var dst = infra as DynamicWithValuesAndBag; if (dst != null) { dst.DirtyStateChange += Dst_DirtyStateChange; } _errorSource = infra as IDataErrorInfo; if (_errorSource == null) { _errorSource = infra.GetWrappedObject() as IDataErrorInfo; } }
public override void SetValue(object component, object value) { using (CEF.UseServiceScope(_ss)) { DynamicWithBag iw = null; if (component is DynamicBindable db) { iw = db.Wrapped; } if (iw == null) { iw = _iw; } iw.SetValue(_name, value, _dt); } }
public override void ResetValue(object component) { using (CEF.UseServiceScope(_ss)) { DynamicWithBag iw = null; if (component is DynamicBindable db) { iw = db.Wrapped; } if (iw == null) { iw = _iw; } iw.SetValue(_name, iw.GetOriginalValue(_name, false), _dt); } }
private bool _disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!_disposedValue) { if (disposing) { _eventSource.PropertyChanged -= eventSource_PropertyChanged; var dst = _infra as DynamicWithValuesAndBag; if (dst != null) { dst.DirtyStateChange -= Dst_DirtyStateChange; } } _infra = null; _eventSource = null; _disposedValue = true; } }
public override object GetValue(object component) { using (CEF.UseServiceScope(_ss)) { DynamicWithBag iw = null; if (component is DynamicBindable db) { iw = db.Wrapped; } if (iw == null) { iw = _iw; } if (iw.HasProperty(_name)) { return(iw.GetValue(_name)); } return(null); } }
public CustomType(DynamicBindable source) { _baseType = source.GetType(); _infra = source._infra; }