Exemplo n.º 1
0
            private void SetState(IVirtualList list, QueuedBackgroundWorkerState loadingState)
            {
                if (list == List && loadingState == LoadingState)
                {
                    return;
                }

                List         = list;
                LoadingState = loadingState;
                var loadingIndicator = LoadingIndicator;
                var oldIsVisible     = loadingIndicator != null;
                var newIsVisible     = LoadingState != QueuedBackgroundWorkerState.Standby;

                if (oldIsVisible == newIsVisible)
                {
                    if (newIsVisible)
                    {
                        loadingIndicator.SetState(List, LoadingState);
                    }
                }
                else if (newIsVisible)
                {
                    AdornerManager.SetAdorner(_itemsControl, new VirtualListLoadingIndicator(List, LoadingState));
                }
                else
                {
                    AdornerManager.SetAdorner(_itemsControl, null);
                }
            }
Exemplo n.º 2
0
        void SetState(IVirtualList list, QueuedBackgroundWorkerState loadingState)
        {
            if (_list == list && _loadingState == loadingState)
            {
                return;
            }

            _list         = list;
            _loadingState = loadingState;
            HasError      = _loadingState == QueuedBackgroundWorkerState.StoppedByError;
            ErrorMessage  = HasError ? _list.LastLoadingError.ToString() : null;
        }
            public void Dispose()
            {
                if (LoadingIndicator != null)
                    AdornerManager.SetAdorner(_itemsControl, null);

                if (_itemsControl != null)
                {
                    DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(ItemsControl.ItemsSourceProperty, typeof(ItemsControl));
                    dpd.RemoveValueChanged(_itemsControl, OnItemsSourceChanged);
                    _itemsControl = null;
                }
                if (_list != null)
                {
                    _list.LoadingStateChanged -= OnLoadingStateChanged;
                    _list = null;
                }
                _loadingState = QueuedBackgroundWorkerState.Standby;
                GC.SuppressFinalize(this);
            }
Exemplo n.º 4
0
            public void Dispose()
            {
                if (LoadingIndicator != null)
                {
                    AdornerManager.SetAdorner(_itemsControl, null);
                }

                if (_itemsControl != null)
                {
                    var dpd = DependencyPropertyDescriptor.FromProperty(ItemsControl.ItemsSourceProperty, typeof(ItemsControl));
                    dpd.RemoveValueChanged(_itemsControl, OnItemsSourceChanged);
                    _itemsControl = null;
                }
                if (_list != null)
                {
                    _list.LoadingStateChanged -= OnLoadingStateChanged;
                    _list = null;
                }
                _loadingState = QueuedBackgroundWorkerState.Standby;
                GC.SuppressFinalize(this);
            }
Exemplo n.º 5
0
 private void SetState(IVirtualList list)
 {
     SetState(list, list == null ? QueuedBackgroundWorkerState.Standby : list.LoadingState);
 }
Exemplo n.º 6
0
 private VirtualListLoadingIndicator(IVirtualList list, QueuedBackgroundWorkerState loadingState)
 {
     SetState(list, loadingState);
 }
            private void SetState(IVirtualList list, QueuedBackgroundWorkerState loadingState)
            {
                if (list == List && loadingState == LoadingState)
                    return;

                List = list;
                LoadingState = loadingState;
                VirtualListLoadingIndicator loadingIndicator = LoadingIndicator;
                bool oldIsVisible = loadingIndicator != null;
                bool newIsVisible = LoadingState != QueuedBackgroundWorkerState.Standby;
                if (oldIsVisible == newIsVisible)
                {
                    if (newIsVisible)
                        loadingIndicator.SetState(List, LoadingState);
                }
                else if (newIsVisible)
                {
                    AdornerManager.SetAdorner(_itemsControl, new VirtualListLoadingIndicator(List, LoadingState));
                }
                else
                {
                    AdornerManager.SetAdorner(_itemsControl, null);
                }
            }
 private void SetState(IVirtualList list)
 {
     SetState(list, list == null ? QueuedBackgroundWorkerState.Standby : list.LoadingState);
 }
        void SetState(IVirtualList list, QueuedBackgroundWorkerState loadingState)
        {
            if (_list == list && _loadingState == loadingState)
                return;

            _list = list;
            _loadingState = loadingState;
            HasError = _loadingState == QueuedBackgroundWorkerState.StoppedByError;
            ErrorMessage = HasError ? _list.LastLoadingError.ToString() : null;
        }
 private VirtualListLoadingIndicator(IVirtualList list, QueuedBackgroundWorkerState loadingState)
 {
     SetState(list, loadingState);
 }
Exemplo n.º 11
0
            private void OnLoadingStateChanged(object sender, EventArgs e)
            {
                IVirtualList list = (IVirtualList)sender;

                SetState(list.LoadingState);
            }