// download one image from the url in the meta private void threadDownloadOneImage(ImageMetas metas) { try { using (WebClient webClient = new WebClient()) { var uri = new Uri(metas.Url.Replace("https://", "http://")); webClient.DownloadDataCompleted += ((o, e) => { if (e.Error == null) { var image = new CachedImg(); image.Metas = (ImageMetas)e.UserState; image.Bytes = e.Result; imagesQueue.Enqueue(image); } else { Debug.Log(e.Error); } }); webClient.DownloadDataAsync(uri, metas); } } catch (Exception e) { Debug.Log("error downloading " + metas.Url); Debug.Log(e); } }