Network image loader, with local file system cache and in-memory cache
By default, using the static public methods will use an in-memory cache for 50 images and 4 megs total. The behavior of the static methods can be modified by setting the public DefaultLoader property to a value that the user configured. The instance methods can be used to create different imageloader with different properties. Keep in mind that the phone does not have a lot of memory, and using the cache with the unlimited value (0) even with a number of items in the cache can consume memory very quickly. Use the Purge method to release all the memory kept in the caches on low memory conditions, or when the application is sent to the background.
		/// <summary>
		///   Requests an image to be loaded using the default image loader
		/// </summary>
		/// <param name="uri">
		/// The URI for the image to load
		/// </param>
		/// <param name="notify">
		/// A class implementing the IImageUpdated interface that will be invoked when the image has been loaded
		/// </param>
		/// <returns>
		/// If the image has already been downloaded, or is in the cache, this will return the image as a UIImage.
		/// </returns>
		public static UIImage DefaultRequestImage(Uri uri, IImageUpdated notify, IDictionary<string, string> headers = null)
		{
			if (DefaultLoader == null)
			{
				DefaultLoader = new ImageLoader(50, 4 * 1024 * 1024);
			}
			return DefaultLoader.RequestImage(uri, notify, headers);
		}
Example #2
0
		/// <summary>
		///  Requests an image to be loaded using the default image loader
		/// </summary>
		/// <param name="uri">
		/// The URI for the image to load
		/// </param>
		/// <param name="notify">
		/// A class implementing the IImageUpdated interface that will be invoked when the image has been loaded
		/// </param>
		/// <returns>
		/// If the image has already been downloaded, or is in the cache, this will return the image as a UIImage.
		/// </returns>
		public static UIImage DefaultRequestImage(Uri uri, IImageUpdated notify)
		{
			if (DefaultLoader == null)
				DefaultLoader = new ImageLoader(50, 4 * 1024 * 1024);
			return DefaultLoader.RequestImage(uri, notify);
		}