//------------------------------------------------------------------------------- #region +GetBlockByIndex インデックス指定でブロック分サークル取得 //------------------------------------------------------------------------------- // public void GetBlockByIndex(int index) { int blockIndex = index / NUM_PER_BLOCK; lock (_indexToBlockDic) { if (_indexToBlockDic.ContainsKey(blockIndex)) { return; } } var res = _catalogData.GetCirclesFromIndex(blockIndex * NUM_PER_BLOCK, NUM_PER_BLOCK); var data = res.Select(cc => { var tdd = new ThumbDispData(cc.SpaceStr, cc.updateId, cc, _checkList); tdd.GetImageAsync(); return tdd; }).ToArray(); lock (_indexToBlockDic) { _indexToBlockDic.Add(blockIndex, data); } }
//------------------------------------------------------------------------------- #region -GetBlockAsync ブロック分のサークル取得 //------------------------------------------------------------------------------- // private async void GetAndSetBlockAsync(int blockIndex) { var res = await _catalogData.GetCirclesFromIndexAsync(blockIndex * NUM_PER_BLOCK, NUM_PER_BLOCK); var data = res.Select(cc => { var tdd = new ThumbDispData(cc.SpaceStr, cc.updateId, cc, _checkList); tdd.GetImageAsync(); return tdd; }).ToArray(); lock (_indexToBlockDic) { if (!_indexToBlockDic.ContainsKey(blockIndex)) { _indexToBlockDic.Add(blockIndex, data); } } lock (_gettingBlock) { _gettingBlock.Remove(blockIndex); } for (int i = 0; i < data.Length; i++) { OnNofityCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, data[i], null, blockIndex * NUM_PER_BLOCK + i)); } RemoveFarData(blockIndex); }