Esempio n. 1
0
            public void OnNext(BindingValue <T> value)
            {
                if (Dispatcher.UIThread.CheckAccess())
                {
                    _owner.SetDirectValueUnchecked(_property, value);
                }
                else
                {
                    // To avoid allocating closure in the outer scope we need to capture variables
                    // locally. This allows us to skip most of the allocations when on UI thread.
                    var instance = _owner;
                    var property = _property;
                    var newValue = value;

                    Dispatcher.UIThread.Post(() => instance.SetDirectValueUnchecked(property, newValue));
                }
            }