예제 #1
0
 public WebImageThreadPoolObject(WebImage webImage, WebImageSearchItem searchItem)
 {
     _webImage = webImage;
     _searchItem = searchItem;
 }
예제 #2
0
        /// <summary>
        /// Process a batch of searchTerms and calls the callback whenever an image is downloaded. With this only one thread is started.
        /// </summary>
        /// <param name="searchTerms">The list of terms to search for</param>
        /// <param name="callback">The method to call when the image has been downloaded</param>
        /// <returns>The running Thread</returns>
        public static WebImageThreadManager ProcessImageBatchBySingleThread(List<WebImageSearchItem> searchItems, ImageRecievedCallaback callback)
        {
            WebImage wi = new WebImage(searchItems, callback);
            Thread t = new Thread(new ThreadStart(wi.threadStartForProcessImageBatchBySingleThread));
            t.Start();

            return new WebImageThreadManager(t);
        }
예제 #3
0
 /// <summary>
 /// Process a batch of searchTerms and calls the callback whenever an image is downloaded. With this many image request are sent at the same time.        
 /// </summary>
 /// <param name="searchTerms">The list of terms to search for</param>
 /// <param name="callback">The method to call when the image has been downloaded</param>
 /// <param name="maxThreadCount">The amount of image requests that can run at the same time</param>
 /// <returns></returns>
 public static WebImageThreadManager ProcessImageBatchWithThreadPool(List<WebImageSearchItem> searchItems, int maxImages, ImageRecievedCallaback callback, int maxThreadCount)
 {
     WebImage wi = new WebImage(searchItems, maxImages, callback);
     return new WebImageThreadManager(wi.StartProcessImageBatchWithThreadPool(maxThreadCount));
 }
예제 #4
0
        /// <summary>
        /// Fetches images from the web for a search term.
        /// </summary>
        /// <param name="searchTerm"></param>
        /// <param name="maxImages"></param>
        /// <param name="callback"></param>
        /// <returns></returns>
        public static WebImageThreadManager GetImagesWithSingleThread(string searchTerm, int maxImages, ImageRecievedCallaback callback)
        {
            WebImage wi = new WebImage(searchTerm, maxImages, callback);
            Thread t = new Thread(new ThreadStart(wi.threadStartForProcessImageBatchBySingleThread));
            t.Start();

            return new WebImageThreadManager(t);
        }