C# Class MonoTouch.Dialog.Utilities.ImageLoader

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.
显示文件 Open project: SuperYeti/MonoTouch.Dialog Class Usage Examples

Public Properties

Property Type Description
BaseDir string
DefaultLoader ImageLoader

Public Methods

Method Description
DefaultRequestImage ( Uri uri, IImageUpdated notify ) : UIImage

Requests an image to be loaded using the default image loader

ImageLoader ( int cacheSize, int memoryLimit ) : System

Creates a new instance of the image loader

Purge ( ) : void

Purges the contents of the DefaultLoader

PurgeCache ( ) : void

Purges the cache of this instance of the ImageLoader, releasing all the memory used by the images in the caches.

RequestImage ( Uri uri, IImageUpdated notify ) : UIImage

Requests an image to be loaded from the network

md5 ( string input ) : string

Private Methods

Method Description
Download ( Uri uri, string target ) : bool
ImageLoader ( ) : System
NotifyImageListeners ( ) : void
QueueRequest ( Uri uri, string target, IImageUpdated notify ) : void
StartPicDownload ( Uri uri, string target ) : void
_StartPicDownload ( Uri uri, string target ) : void
hex ( int v ) : int
sizer ( UIImage img ) : int

Method Details

DefaultRequestImage() public static method

Requests an image to be loaded using the default image loader
public static DefaultRequestImage ( Uri uri, IImageUpdated notify ) : UIImage
uri System.Uri /// The URI for the image to load ///
notify IImageUpdated /// A class implementing the IImageUpdated interface that will be invoked when the image has been loaded ///
return UIImage

ImageLoader() public method

Creates a new instance of the image loader
public ImageLoader ( int cacheSize, int memoryLimit ) : System
cacheSize int /// The maximum number of entries in the LRU cache ///
memoryLimit int /// The maximum number of bytes to consume by the image loader cache. ///
return System

Purge() public static method

Purges the contents of the DefaultLoader
public static Purge ( ) : void
return void

PurgeCache() public method

Purges the cache of this instance of the ImageLoader, releasing all the memory used by the images in the caches.
public PurgeCache ( ) : void
return void

RequestImage() public method

Requests an image to be loaded from the network
public RequestImage ( Uri uri, IImageUpdated notify ) : UIImage
uri System.Uri /// The URI for the image to load ///
notify IImageUpdated /// A class implementing the IImageUpdated interface that will be invoked when the image has been loaded ///
return UIImage

md5() public static method

public static md5 ( string input ) : string
input string
return string

Property Details

BaseDir public_oe static_oe property

public static string BaseDir
return string

DefaultLoader public_oe static_oe property

This contains the default loader which is configured to be 50 images up to 4 megs of memory. Assigning to this property a new value will change the behavior. This property is lazyly computed, the first time an image is requested.
public static ImageLoader,MonoTouch.Dialog.Utilities DefaultLoader
return ImageLoader