コード例 #1
0
        public PropertyDispatching(
            TSource source,
            string propertyName,
            IOcDispatcher destinationOcDispatcher,
            IOcDispatcher sourceOcDispatcher        = null,
            int destinationOcDispatcherPriority     = 0,
            int sourceOcDispatcherPriority          = 0,
            object destinationOcDispatcherParameter = null,
            object sourceOcDispatcherParameter      = null)
        {
            _sourceOcDispatcher      = sourceOcDispatcher;
            _destinationOcDispatcher = destinationOcDispatcher;
            _source       = source;
            _propertyName = propertyName;

            _destinationOcDispatcherPriority  = destinationOcDispatcherPriority;
            _sourceOcDispatcherPriority       = sourceOcDispatcherPriority;
            _destinationOcDispatcherParameter = destinationOcDispatcherParameter;
            _sourceOcDispatcherParameter      = sourceOcDispatcherParameter;

            PropertyChanged += (sender, args) =>
            {
                if (args == Utils.SetValueRequestHandlerPropertyChangedEventArgs)
                {
                    throw new ObservableComputationsException(
                              $"Cannot set property {nameof(PropertyDispatching<TSource, TResult>)}.{nameof(SetValueRequestHandler)}, since that it is predefined");
                }
            };
        }
コード例 #2
0
        public ScalarDispatching(
            IReadScalar <TResult> source,
            IOcDispatcher destinationOcDispatcher,
            IOcDispatcher sourceOcDispatcher        = null,
            int destinationOcDispatcherPriority     = 0,
            int sourceOcDispatcherPriority          = 0,
            object destinationOcDispatcherParameter = null,
            object sourceOcDispatcherParameter      = null)
        {
            _destinationOcDispatcher = destinationOcDispatcher;
            _source             = source;
            _sourceOcDispatcher = sourceOcDispatcher;
            _changeValueAction  = () =>
            {
                TResult newValue = _source.Value;
                void setNewValue() => setValue(newValue);

                _destinationOcDispatcher.Invoke(
                    setNewValue,
                    _destinationOcDispatcherPriority,
                    _destinationOcDispatcherParameter,
                    this);
            };

            _destinationOcDispatcherPriority  = destinationOcDispatcherPriority;
            _sourceOcDispatcherPriority       = sourceOcDispatcherPriority;
            _destinationOcDispatcherParameter = destinationOcDispatcherParameter;
            _sourceOcDispatcherParameter      = sourceOcDispatcherParameter;
        }
コード例 #3
0
        public ThrottlingDispatcher(TimeSpan timeSpan, IOcDispatcher destinationOcDispatcher)
        {
            _timeSpan = timeSpan;
            _destinationOcDispatcher = destinationOcDispatcher;

            _actions = new Subject <Action>();
            _cleanUp = _actions.Throttle(timeSpan).Subscribe(action =>
            {
                _destinationOcDispatcher.Invoke(action, 0, null, this);
            });
        }
コード例 #4
0
 public CollectionDispatching(
     IReadScalar <INotifyCollectionChanged> sourceScalar,
     IOcDispatcher destinationOcDispatcher,
     IOcDispatcher sourceOcDispatcher        = null,
     int destinationOcDispatcherPriority     = 0,
     int sourceOcDispatcherPriority          = 0,
     object destinationOcDispatcherParameter = null,
     object sourceOcDispatcherParameter      = null)
     : this(destinationOcDispatcherPriority, sourceOcDispatcherPriority, destinationOcDispatcherParameter, sourceOcDispatcherParameter)
 {
     _destinationOcDispatcher = destinationOcDispatcher;
     _sourceOcDispatcher      = sourceOcDispatcher;
     _sourceScalar            = sourceScalar;
 }
コード例 #5
0
        public PropertyDispatching(
            Expression <Func <TResult> > propertyExpression,
            IOcDispatcher destinationOcDispatcher,
            IOcDispatcher sourceOcDispatcher        = null,
            int destinationOcDispatcherPriority     = 0,
            int sourceOcDispatcherPriority          = 0,
            object destinationOcDispatcherParameter = null,
            object sourceOcDispatcherParameter      = null) : this()
        {
            _sourceOcDispatcher      = sourceOcDispatcher;
            _destinationOcDispatcher = destinationOcDispatcher;
            _propertyExpression      = propertyExpression;

            _destinationOcDispatcherPriority  = destinationOcDispatcherPriority;
            _sourceOcDispatcherPriority       = sourceOcDispatcherPriority;
            _destinationOcDispatcherParameter = destinationOcDispatcherParameter;
            _sourceOcDispatcherParameter      = sourceOcDispatcherParameter;

            lockChangeSetValueHandle();
        }
コード例 #6
0
 public static void Invoke(this IOcDispatcher ocDispatcher, Action action, int priority = 0, object parameter = null, object context = null)
 {
     ocDispatcher.Invoke(action, priority, parameter, context);
 }
コード例 #7
0
 public UserInputThrottlingOcDispatcher(IOcDispatcher destinationOcDispatcher) : base(TimeSpan.FromMilliseconds(250), destinationOcDispatcher)
 {
 }