private void GetItems(SearchType p) { this.dataGridView1.Rows.Clear(); List <findItemsAdvancedResponse.eBayItem> lfi = eBayItems.GetItems(p); if (lfi == null) { return; } int row = 0; foreach (findItemsAdvancedResponse.eBayItem item in lfi) { Image thumb = null; row = this.dataGridView1.Rows.Add(new object[] { "" }); double binPrice = 0; if (item.ListingInfo.BuyItNowPrice != null) { binPrice = item.ListingInfo.BuyItNowPrice.Amount; } double shipCost = 0; if (item.ShippingInfo.ShippingServiceCost != null) { shipCost = item.ShippingInfo.ShippingServiceCost.Amount; } //string currency = item.SellingStatus.CurrentPrice.CurrencyID; object[] args = new object[] { thumb, item.ItemId, item.Title, item.SellingStatus.CurrentPrice.Amount, shipCost, (item.SellingStatus.CurrentPrice.Amount + shipCost), item.ListingInfo.EndTime.ToString() }; this.dataGridView1.Rows[row].Tag = item; this.dataGridView1.Rows[row].SetValues(args); if (item.Viewed) { this.dataGridView1.Rows[row].DefaultCellStyle.BackColor = Settings.Default.ViewedColour; } UriRow uri = new UriRow(); uri.Row = row; uri.Uri = item.GalleryURL; ParameterizedThreadStart pst = new ParameterizedThreadStart(GetThumb); Thread t = new Thread(pst); t.Start(uri); } }
private void GetThumb(object UriRow) { //lock(this) //{ Image img = Resources.end; UriRow uri = (UriRow)UriRow; if ((Settings.Default.DownloadThumbs) & (uri.Uri != null)) { //download //then invoke try { WebClient wc = new WebClient(); byte[] imgBytes = wc.DownloadData(uri.Uri); MemoryStream ms = new MemoryStream(imgBytes); img = Image.FromStream(ms); ms.Close(); Invoke(new d_ThumbArrival(ThumbArrival), new object[] { img, uri.Row }); } catch (Exception ex) { } } else { // img = Resources.end; //Invoke(new d_ThumbArrival(ThumbArrival), new object[] { img, uri.Row }); } // } }