Exemple #1
0
        void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            Action action;

            if (_list == null)
            {
                action = Clear;
            }
            else
            {
                action = () =>
                {
                    _version++;
                    OnCollectionChanged(e);
                };
            }

            CollectionSynchronizationContext sync;

            if (BindingBase.TryGetSynchronizedCollection(ProxiedEnumerable, out sync))
            {
                sync.Callback(ProxiedEnumerable, sync.Context, () =>
                {
                    e = e.WithCount(Count);
                    _dispatcher.Dispatch(action);
                }, false);
            }
            else
            {
                e = e.WithCount(Count);
                _dispatcher.Dispatch(action);
            }
        }
        void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            Action action;

            if (_list == null)
            {
                action = Clear;
            }
            else
            {
                action = () =>
                {
                    _version++;
                    OnCollectionChanged(e);
                };
            }

            e = e.WithCount(Count);
            if (Device.IsInvokeRequired)
            {
                Device.BeginInvokeOnMainThread(action);
            }
            else
            {
                action();
            }
        }
        void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            Action action;

            if (_list == null)
            {
                action = Clear;
            }
            else
            {
                action = () =>
                {
                    _version++;
                    OnCollectionChanged(e);
                };
            }

            CollectionSynchronizationContext sync;

            if (BindingBase.TryGetSynchronizedCollection(ProxiedEnumerable, out sync))
            {
                sync.Callback(ProxiedEnumerable, sync.Context, () =>
                {
                    e = e.WithCount(Count);
                    Device.BeginInvokeOnMainThread(action);
                }, false);
            }
            else
            {
                e = e.WithCount(Count);
                if (Device.IsInvokeRequired)
                {
                    Device.BeginInvokeOnMainThread(action);
                }
                else
                {
                    action();
                }
            }
        }