예제 #1
0
		public UrlImageStore(string storeName, ProcessImageDelegate processImage)
		{
			StoreName = storeName;
			ProcessImage = processImage;
			
			lcts = new LimitedConcurrencyLevelTaskScheduler (CONCURRENT_THREADS);
            factory = new TaskFactory(lcts);
			
			if (!Directory.Exists(Path.Combine(baseDir, "Library/Caches/Pictures/")))
				Directory.CreateDirectory(Path.Combine(baseDir, "Library/Caches/Pictures/"));
			
			picDir = Path.Combine(baseDir, "Library/Caches/Pictures/" + storeName);			
		}
        public UrlImageStore(string storeName, ProcessImageDelegate processImage)
        {
            this.StoreName    = storeName;
            this.ProcessImage = processImage;

            lcts    = new LimitedConcurrencyLevelTaskScheduler(CONCURRENT_THREADS);
            factory = new TaskFactory(lcts);

            if (!Directory.Exists(Path.Combine(baseDir, "Library/Caches/Pictures/")))
            {
                Directory.CreateDirectory(Path.Combine(baseDir, "Library/Caches/Pictures/"));
            }

            picDir = Path.Combine(baseDir, "Library/Caches/Pictures/" + storeName);
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MonoTouch.UrlImageStore.UrlImageStore"/> class.
        /// Creates a folder for cached images, if it doesn't exist already.
        /// </summary>
        /// <param name="storeName">Store name.</param>
        /// <param name="processImage">Process image delegate.</param>
        public UrlImageStore(string storeName, ProcessImageDelegate processImage)
        {
            StoreName = storeName;
            ProcessImage = processImage;

            lcts = new LimitedConcurrencyLevelTaskScheduler (CONCURRENT_THREADS);
            taskFactory = new TaskFactory (lcts);

            // create cached folder if it doesn't already exist
            if (!Directory.Exists (Path.Combine (baseDir, "Library/Caches/Pictures/" + storeName)))
                Directory.CreateDirectory (Path.Combine (baseDir, "Library/Caches/Pictures/" + storeName));

            cachedImageDir = Path.Combine (baseDir, "Library/Caches/Pictures/" + storeName);

            Console.WriteLine ("UrlImageStore: Setting up image store at {0}", cachedImageDir);
        }
        public UrlImageStore(int capacity, string storeName, ProcessImageDelegate processImage)
        {
            this.Capacity     = capacity;
            this.StoreName    = storeName;
            this.ProcessImage = processImage;

            cache = new LRUCache <TKey, UIImage>(capacity);

            if (!Directory.Exists(Path.Combine(baseDir, "Caches/Pictures/")))
            {
                Directory.CreateDirectory(Path.Combine(baseDir, "Caches/Pictures/"));
            }

            picDir = Path.Combine(baseDir, "Caches/Pictures/" + storeName);

            if (!Directory.Exists(picDir))
            {
                Directory.CreateDirectory(picDir);
            }
        }
        public UrlImageStore(int capacity, string storeName, Drawable defaultImage, ProcessImageDelegate processImage, int maxConcurrency = 2)
        {
            //this.queue = new Queue<UrlImageStoreRequest<TKey>>();
            this.Capacity       = capacity;
            this.StoreName      = storeName;
            this.ProcessImage   = processImage;
            this.DefaultImage   = defaultImage;
            this.MaxConcurrency = maxConcurrency;
            //this.taskScheduler = new LimitedConcurrencyLevelTaskScheduler(maxConcurrency);
            //this.taskFactory = new TaskFactory(this.taskScheduler);

            cache = new LRUCache <TKey, Drawable>(capacity);

            if (!Directory.Exists(Path.Combine(baseDir, "Caches/Pictures/" + storeName)))
            {
                Directory.CreateDirectory(Path.Combine(baseDir, "Caches/Pictures/" + storeName));
            }

            picDir = Path.Combine(baseDir, "Caches/Pictures/" + storeName).TrimEnd('/') + "/";



            queuedActions = new ConcurrentQueue <Action>();
        }