Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ImageListViewCacheThumbnail"/> class.
        /// </summary>
        /// <param name="owner">The owner control.</param>
        public ImageListViewCacheThumbnail(ImageListView owner)
        {
            context                = null;
            bw                     = new QueuedBackgroundWorker();
            bw.ProcessingMode      = ProcessingMode.LIFO;
            bw.IsBackground        = true;
            bw.ThreadName          = "Thumbnail Cache Worker Thread";
            bw.DoWork             += bw_DoWork;
            bw.RunWorkerCompleted += bw_RunWorkerCompleted;

            checkProcessingCallback = new SendOrPostCallback(CanContinueProcessing);

            mImageListView        = owner;
            diskCache             = new PersistentCache();
            diskCache.Size        = 100 * 1024 * 1024; // 100 MB disk cache
            CacheMode             = CacheMode.OnDemand;
            CacheLimitAsItemCount = 0;
            CacheLimitAsMemory    = 20 * 1024 * 1024;
            RetryOnError          = false;

            thumbCache             = new Dictionary <Guid, CacheItem>();
            editCache              = new Dictionary <Guid, bool>();
            processing             = new Dictionary <Guid, bool>();
            processingRendererItem = Guid.Empty;
            processingGalleryItem  = Guid.Empty;

            rendererItem = null;
            galleryItem  = null;

            MemoryUsed          = 0;
            MemoryUsedByRemoved = 0;
            removedItems        = new List <Guid>();

            disposed = false;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ImageListViewCacheMetadata"/> class.
        /// </summary>
        /// <param name="owner">The owner control.</param>
        public ImageListViewCacheMetadata(ImageListView owner)
        {
            context                = null;
            bw                     = new QueuedBackgroundWorker();
            bw.IsBackground        = true;
            bw.ThreadName          = "Metadata Cache Worker Thread";
            bw.DoWork             += bw_DoWork;
            bw.RunWorkerCompleted += bw_RunWorkerCompleted;

            checkProcessingCallback = new SendOrPostCallback(CanContinueProcessing);

            mImageListView = owner;
            RetryOnError   = false;

            editCache    = new Dictionary <Guid, bool> ();
            processing   = new Dictionary <Guid, bool> ();
            removedItems = new Dictionary <Guid, bool> ();

            disposed = false;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ImageListViewCacheShellInfo"/> class.
        /// </summary>
        /// <param name="owner">The owner control.</param>
        public ImageListViewCacheShellInfo(ImageListView owner)
        {
            context                = null;
            bw                     = new QueuedBackgroundWorker();
            bw.Threads             = 1;
            bw.IsBackground        = true;
            bw.ThreadName          = "Shell Info Cache Worker Thread";
            bw.DoWork             += bw_DoWork;
            bw.RunWorkerCompleted += bw_RunWorkerCompleted;

            checkProcessingCallback = new SendOrPostCallback(CanContinueProcessing);

            mImageListView = owner;
            RetryOnError   = false;

            shellCache = new Dictionary <string, CacheItem> ();
            processing = new Dictionary <string, bool> ();

            disposed = false;
        }