/// <summary> /// Purges invisible items from the cache. /// </summary> /// <param name="force">true to purge the cache now, regardless of /// memory usage; otherwise false to automatically purge the cache /// depending on memory usage.</param> public void PurgeInvisible(bool force) { if (mImageListView == null) { return; } Dictionary <Guid, bool> visible = mImageListView.GetVisibleItems(); if (visible.Count == 0) { return; } foreach (KeyValuePair <Guid, CacheItem> item in thumbCache) { if (!visible.ContainsKey(item.Key)) { removedItems.Add(item.Key); MemoryUsedByRemoved += GetImageMemorySize(item.Value.Image); } } Purge(force); }