public override void ShowError(string message) { base.ShowError(message); this._currentImageTask = null; this._currentStringTask = null; }
public void DownloadImage(string uri, Action onFinished) { // return immideately if the image is cached var cachedImage = this.GetCachedImage(uri); if (cachedImage.IsCached) { onFinished(); return; } if (this._runningImageTasks.Contains(uri)) { return; } this._runningImageTasks.Add(uri); // download image var httpGet = new HttpGetImageTask(uri, image => this.OnImageDownloaded(uri, image, onFinished)); httpGet.OnError = error => this.OnError(uri, error, onFinished); httpGet.Execute(); }
private void LoadCaptcha(string key) { string imageUrl = string.Format("http://i.captcha.yandex.net/image?key={0}", key); this._currentImageTask = new HttpGetImageTask(imageUrl, this.OnImageDownloaded); this._currentImageTask.OnError = this.ShowError; this._currentImageTask.Execute(); }
private void OnImageDownloaded(BitmapSource bitmap) { this.DisplayImage(bitmap); this.HideLoading(); this._currentImageTask = null; }