Ejemplo n.º 1
0
        public ValueAccessResult SetValue(TValue value)
        {
            ValueAccesHelper.EnsureValueAccessor(ValueSetter);

            var       lh        = ValueAccesHelper.PrepareLogHandler();
            Exception exception = null;

            using (new LogHandlerScope(lh))
            {
                try
                {
                    ValueSetter(value);
                }
                catch (Exception e)
                {
                    exception = e;
                }
            }

            return(new ValueAccessResult(lh.Records, exception));
        }
Ejemplo n.º 2
0
        public ValueAccessResult GetValue(out TValue value, TValue fallback = default(TValue))
        {
            ValueAccesHelper.EnsureValueAccessor(ValueGetter);

            var       lh        = ValueAccesHelper.PrepareLogHandler();
            Exception exception = null;

            using (new LogHandlerScope(lh))
            {
                try
                {
                    value = ValueGetter();
                }
                catch (Exception e)
                {
                    value     = fallback;
                    exception = e;
                }
            }

            return(new ValueAccessResult(lh.Records, exception));
        }
Ejemplo n.º 3
0
 protected ValueEntry(TOwner owner)
 {
     this.owner        = owner;
     valueAccessHelper = new ValueAccesHelper <TValue>(() => Value, v => Value = v);
 }
Ejemplo n.º 4
0
 protected CollectionDrawer()
 {
     itemCountGetter = new ValueAccesHelper <int>(() => TypedDrawingValue.Count);
 }