public static void DoGetAlbumDetails(Album album) { if (AreCredentialsMissing) { if (errorMessageShown) return; errorMessageShown = true; // so we don't show the message again MessageBox.Show("To retrieve album details, Music Explorer requires access to the Amazon Associates Web Service. " + "This service is free, but requires you to register for an associates account. " + "See http://aws.amazon.com/associates for details. Once you have an account, enter " + "your Account Number and Access Key ID in the Options->Amazon Credentials dialog box.", "Not all album details available"); return; } ItemLookup search = new ItemLookup(); search.AssociateTag = Properties.Settings.Default.AmazonAwsAccountNumber; search.AWSAccessKeyId = Properties.Settings.Default.AmazonAwsAccessKeyId; ItemLookupRequest request = new ItemLookupRequest(); request.ItemId = new string[] { album.Asin }; request.IdType = ItemLookupRequestIdType.ASIN; request.ResponseGroup = new string[] { "Images", "ItemAttributes", "BrowseNodes" }; search.Request = new ItemLookupRequest[] { request }; ItemLookupResponse response = amazonWebService.ItemLookup(search); AmazonAws.Items items = response.Items[0]; if (items.Item == null) return; if (items.Item.Length == 0) return; AmazonAws.Item item = items.Item[0]; if (item == null) return; if (item.MediumImage == null) album.ImageUrl = null; else album.ImageUrl = item.MediumImage.URL; if (item.ItemAttributes != null) album.Label = item.ItemAttributes.Label; if (item.ItemAttributes.NumberOfDiscs != null) album.Discs = int.Parse(item.ItemAttributes.NumberOfDiscs); album.Genre = GetGenre(item); }
/// <remarks/> public void ItemLookupAsync(ItemLookup ItemLookup1, object userState) { if ((this.ItemLookupOperationCompleted == null)) { this.ItemLookupOperationCompleted = new System.Threading.SendOrPostCallback(this.OnItemLookupOperationCompleted); } this.InvokeAsync("ItemLookup", new object[] { ItemLookup1}, this.ItemLookupOperationCompleted, userState); }
/// <remarks/> public void ItemLookupAsync(ItemLookup ItemLookup1) { this.ItemLookupAsync(ItemLookup1, null); }