Exemple #1
0
 /// <param name="fetchDataCallback">Callback used when more data is requested for the cache</param>
 /// <param name="updateCountCallback">Callback used to calculate the total number of items that exist outside the cache</param>
 /// <param name="cacheBatchSize">Cache batch size</param>
 public VirtualizedDataSource(FetchDataCallbackHandler <T> fetchDataCallback, UpdateCountCallbackHandler updateCountCallback, int cacheBatchSize = 10)
 {
     // The ItemCacheManager does most of the heavy lifting. We pass it a callback that it will use to actually fetch data, and the max size of a request
     _itemCache = new ItemCacheManager <T>(fetchDataCallback, cacheBatchSize);
     _itemCache.CacheChanged += ItemCache_CacheChanged;
     _updateCountCallback     = updateCountCallback;
     UpdateCount();
 }
Exemple #2
0
 public ENRZDataContext(FetchDataCallbackHandler back, int num, uint rollNum, string targetHost)
 {
     FetchCallback   = back;
     number          = num;
     rollNumber      = rollNum;
     this.targetHost = targetHost;
     InitType        = InitSelector.Default;
 }
 public IncrementalLoadingContext(FetchDataCallbackHandler callback, int typeNumber, uint rollNumber, string targetHost)
 {
     FetchCallback   = callback;
     number          = typeNumber;
     this.rollNumber = rollNumber;
     this.targetHost = targetHost;
     InitType        = InitSelector.Default;
 }
 public DoubanIncrementalContext(FetchDataCallbackHandler callback, int offset = 0, InitSelector type = InitSelector.Default)
 {
     FetchCallback = callback;
     this.offset   = offset;
     InitType      = type;
     if (InitType == InitSelector.Special)
     {
         LoadPreviewAsync();
     }
 }
Exemple #5
0
 public ENRZDataContext(FetchDataCallbackHandler back, uint rollNum, string targetHost, InitSelector type)
 {
     FetchCallback   = back;
     number          = 0;
     rollNumber      = rollNum;
     this.targetHost = targetHost;
     InitType        = type;
     if (InitType == InitSelector.Special)
     {
         LoadPreview();
     }
 }
 public IncrementalLoadingContext(FetchDataCallbackHandler callback, uint rollNumber, string targetHost, InitSelector type)
 {
     FetchCallback   = callback;
     number          = 0;
     this.rollNumber = rollNumber;
     this.targetHost = targetHost;
     InitType        = type;
     if (InitType == InitSelector.Special)
     {
         LoadPreview();
     }
 }
Exemple #7
0
        public ItemCacheManager(FetchDataCallbackHandler <T> callback, int batchsize = 50)
        {
            _cacheBlocks       = new List <CacheEntryBlock <T> >();
            _request           = new ItemIndexRangeList();
            _cachedResults     = new ItemIndexRangeList();
            _fetchDataCallback = callback;
            _maxBatchFetchSize = batchsize;

            // set up a timer that is used to delay fetching data so that we can catch up if the list is scrolling fast
            _timer       = new DispatcherTimer();
            _timer.Tick += (sender, args) => { FetchData(); };

            _timer.Interval = new TimeSpan(20 * 10000);
        }
 public DoubanLazyLoadContext(FetchDataCallbackHandler callback)
 {
     FetchCallback = callback;
 }