Ejemplo n.º 1
0
 public InternalPropertyDescriptor(string name, Type dt, DynamicWithBag iw, ServiceScope ss) : base(name, null)
 {
     _name = name;
     _dt   = dt;
     _iw   = iw;
     _ss   = ss;
 }
Ejemplo n.º 2
0
        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;
            }
        }
Ejemplo n.º 3
0
            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);
                }
            }
Ejemplo n.º 4
0
            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);
                }
            }
Ejemplo n.º 5
0
        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;
            }
        }
Ejemplo n.º 6
0
            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);
                }
            }
Ejemplo n.º 7
0
 public CustomType(DynamicBindable source)
 {
     _baseType = source.GetType();
     _infra    = source._infra;
 }