コード例 #1
0
        /// <summary>
        /// Pushes the given item to the worker queue. Items with high priority are renderer
        /// or gallery items, ie. large images in gallery and pane views and images requested
        /// by custom renderers. Items with 0 priority are regular thumbnails.
        /// </summary>
        /// <param name="item">The item to add to the worker queue.</param>
        /// <param name="priority">Priority of the item in the queue.</param>
        private void RunWorker(CacheRequest item, int priority)
        {
            // Get the current synchronization context
            if (context == null)
            {
                context = SynchronizationContext.Current;
            }

            // Already being processed?
            if (item.RequestType == RequestType.Thumbnail)
            {
                if (processing.ContainsKey(item.Guid))
                {
                    return;
                }
                else
                {
                    processing.Add(item.Guid, false);
                }
            }
            else if (item.RequestType == RequestType.Renderer)
            {
                if (processingRendererItem == item.Guid)
                {
                    return;
                }
                else
                {
                    bw.CancelAsync(priority);
                    processingRendererItem = item.Guid;
                }
            }
            else if (item.RequestType == RequestType.Gallery)
            {
                if (processingGalleryItem == item.Guid)
                {
                    return;
                }
                else
                {
                    bw.CancelAsync(priority);
                    processingGalleryItem = item.Guid;
                }
            }

            // Raise the ThumbnailCaching event
            if (mImageListView != null)
            {
                mImageListView.OnThumbnailCachingInternal(item.Guid, item.Size);
            }

            // Add the item to the queue for processing
            bw.RunWorkerAsync(item, priority, item.RequestType != RequestType.Thumbnail);
        }
コード例 #2
0
        /// <summary>
        /// Pushes the given item to the worker queue.
        /// </summary>
        /// <param name="item">The cache item.</param>
        private void RunWorker(CacheRequest item)
        {
            // Get the current synchronization context
            if (context == null)
            {
                context = SynchronizationContext.Current;
            }

            // Already being processed?
            if (processing.ContainsKey(item.Guid))
            {
                return;
            }
            else
            {
                processing.Add(item.Guid, false);
            }

            // Add the item to the queue for processing
            bw.RunWorkerAsync(item);
        }
コード例 #3
0
        /// <summary>
        /// Pushes the given item to the worker queue.
        /// </summary>
        /// <param name="extension">File extension.</param>
        private void RunWorker(string extension)
        {
            // Get the current synchronization context
            if (context == null)
            {
                context = SynchronizationContext.Current;
            }

            // Already being processed?
            if (processing.ContainsKey(extension))
            {
                return;
            }
            else
            {
                processing.Add(extension, false);
            }

            // Add the item to the queue for processing
            bw.RunWorkerAsync(extension);
        }