//Not consider to memory cache,just display from file immediately public void DisplayFromFile(Image image, string path, params DisplayOption[] option) { DisplayOption opt = GetOptionFromParams(option); DisplayLoadingImage(image, opt); if (File.Exists(path)) { AsyncTask.GetInstance() .SetDoInBackground(delegate { byte[] data = File.ReadAllBytes(path); return(data); }).SetOnPostExecute(result => DisplayFromBytes((byte[])result, image, path, opt)) .Excute(); } else { DisplayErrorImage(image, opt); } }
void DisplayFromDiscCache(Image image, string uri, DisplayOption option) { if (discCache != null) { AsyncTask.GetInstance() .SetDoInBackground(delegate { return(discCache.Get(uri)); }).SetOnPostExecute(delegate(object result) { byte[] data = (byte[])result; if (DisplayFromBytes(data, image, uri, option)) { //LogUtils.Log("image load from disc cache"); } else { DisplayFromHttp(image, uri, option); } }).Excute(); } }