private void DownloadImage(List <CoverInfo> coverInfos) { _bitmapImages.Clear(); _webClients = new Dictionary <HttpWebClient, int>(); for (int i = 0; i < coverInfos.Count; i++) { _bitmapImages.Add(new BitmapImage()); } _count = coverInfos.Count; _markCount = 0; _coverInfos = coverInfos; for (int m = 0; m < coverInfos.Count; m++) { HttpWebClient _clientByImage = new HttpWebClient();//图片异步下载 _clientByImage.OpenReadCompleted += new OpenReadCompletedEventHandler(_clientByImage_OpenReadCompleted); _clientByImage.OpenReadAsync(coverInfos[m].CoverImgUrl); _webClients.Add(_clientByImage, m); } }
private void DownloadImage(List<CoverInfo> coverInfos) { _bitmapImages.Clear(); _webClients = new Dictionary<HttpWebClient, int>(); for (int i = 0; i < coverInfos.Count; i++) { _bitmapImages.Add(new BitmapImage()); } _count = coverInfos.Count; _markCount = 0; _coverInfos = coverInfos; for (int m = 0; m < coverInfos.Count; m++) { HttpWebClient _clientByImage = new HttpWebClient();//图片异步下载 _clientByImage.OpenReadCompleted += new OpenReadCompletedEventHandler(_clientByImage_OpenReadCompleted); _clientByImage.OpenReadAsync(coverInfos[m].CoverImgUrl); _webClients.Add(_clientByImage, m); } }