public PlaceholderReplaceWA(VirtualizingObservableCollection <T> voc, T oldValue, T newValue, int index)
     : base(VirtualActionThreadModelEnum.UseUIThread)
 {
     _VOC      = new WeakReference(voc);
     _OldValue = oldValue;
     _NewValue = newValue;
     _Index    = index;
 }
コード例 #2
0
        private async void DoRealPageGet(Object voc, ISourcePage <T> page, int pageOffset, int index, CancellationTokenSource cts)
        {
            //Debug.WriteLine("DoRealPageGet: pageOffset=" + pageOffset + " index=" + index);
            VirtualizingObservableCollection <T> realVOC        = (VirtualizingObservableCollection <T>)voc;
            List <PlaceholderReplaceWA <T> >     listOfReplaces = new List <PlaceholderReplaceWA <T> >();

            if (realVOC != null)
            {
                if (cts.IsCancellationRequested)
                {
                    return;
                }

                var data = await ProviderAsync.GetItemsAtAsync(pageOffset, page.ItemsPerPage, false);

                if (cts.IsCancellationRequested)
                {
                    return;
                }

                page.WiredDateTime = data.LoadedAt;

                int i = 0;
                foreach (var item in data.Items)
                {
                    if (cts.IsCancellationRequested)
                    {
                        RemovePageRequest(page.Page);
                        return;
                    }

                    ClearOptimizations();
                    if (page.ReplaceNeeded(i))
                    {
                        var old = page.GetAt(i);
                        if (old == null)
                        {
                        }

                        ClearOptimizations();
                        //Debug.WriteLine("Replacing:" + old.ToString() + " with " + item.ToString());

                        page.ReplaceAt(i, old, item, null, null);
                        //VirtualizationManager.Instance.RunOnUI(new PlaceholderReplaceWA<T>(realVOC, old, item, pageOffset+i));
                        listOfReplaces.Add(new PlaceholderReplaceWA <T>(realVOC, old, item, pageOffset + i));
                    }
                    else
                    {
                        page.ReplaceAt(i, default(T), item, null, null);
                    }

                    i++;
                }
            }

            page.PageFetchState = PageFetchStateEnum.Fetched;

            ClearOptimizations();
            foreach (var replace in listOfReplaces)
            {
                if (cts.IsCancellationRequested)
                {
                    RemovePageRequest(page.Page);
                    return;
                }
                VirtualizationManager.Instance.RunOnUI(replace);
            }

            RemovePageRequest(page.Page);
        }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Object"/> class.
 /// </summary>
 public Enumerator(VirtualizingObservableCollection <TT> baseCollection)
 {
     this.BaseCollection = baseCollection;
 }
 public BulkMode(VirtualizingObservableCollection <T> voc)
 {
     _voc = voc;
 }
コード例 #5
0
 public ExecuteResetWA(VirtualizingObservableCollection <T> voc)
     : base(VirtualActionThreadModelEnum.UseUIThread)
 {
     _VOC = new WeakReference(voc);
 }