void DomainMetadataWebResponse(object sender, ResponseEventArgs args) { ISimpleDBResponse result = args.Response; SimpleDB.Client.OnSimpleDBResponse -= DomainMetadataWebResponse; if (result is AmazonSimpleDBException) { this.Dispatcher.BeginInvoke(() => { this.DomainMetadataMessage = "Error: " + ((AmazonSimpleDBException)result).Message; }); return; } DomainMetadataResponse response = (DomainMetadataResponse)result; DomainMetadataResult domainResult = response.DomainMetadataResult; StringBuilder metadataResponse = new StringBuilder(); metadataResponse.AppendLine(string.Format(CultureInfo.InvariantCulture, "Attribute Name Count: {0}", domainResult.AttributeNameCount)); metadataResponse.AppendLine(string.Format(CultureInfo.InvariantCulture, "Attribute Value Count: {0}", domainResult.AttributeValueCount)); metadataResponse.AppendLine(string.Format(CultureInfo.InvariantCulture, "Item Count: {0}", domainResult.ItemCount)); metadataResponse.AppendLine(string.Format(CultureInfo.InvariantCulture, "TimeStamp: {0}", domainResult.Timestamp)); this.Dispatcher.BeginInvoke(() => { this.DomainMetadataMessage = metadataResponse.ToString(); }); }
void DeleteDomainWebResponse(object sender, ResponseEventArgs args) { ISimpleDBResponse result = args.Response; SimpleDB.Client.OnSimpleDBResponse -= DeleteDomainWebResponse; if (result is AmazonSimpleDBException) { this.Dispatcher.BeginInvoke(() => { this.DomainDeleteMessage = "Error: " + ((AmazonSimpleDBException)result).Message; }); return; } else { this.Dispatcher.BeginInvoke(() => { this.DomainDeleteMessage = "Domain deleted successfully."; }); } }
void BatchPutAttributeWebResponse(object sender, ResponseEventArgs args) { ISimpleDBResponse result = args.Response; SimpleDB.Client.OnSimpleDBResponse -= BatchPutAttributeWebResponse; this.Dispatcher.BeginInvoke(() => { BatchPutAttributesResponse response = result as BatchPutAttributesResponse; if (null != response) { this.BatchPutMessage = "Batch attributes put successfully"; } else { AmazonSimpleDBException exception = result as AmazonSimpleDBException; if (null != exception) { this.BatchPutMessage = "Error: " + exception.Message; } } }); }
void ListDomainWebResponse(object sender, ResponseEventArgs args) { ISimpleDBResponse result = args.Response; SimpleDB.Client.OnSimpleDBResponse -= ListDomainWebResponse; if (result is AmazonSimpleDBException) { this.Dispatcher.BeginInvoke(() => { this.ListDomainMessage = "Error: " + ((AmazonSimpleDBException)result).Message; }); return; } ListDomainsResponse response = (ListDomainsResponse)result; this.Dispatcher.BeginInvoke(() => { DomainNameList.Clear(); response.ListDomainsResult.DomainName.ForEach(b => DomainNameList.Add(b)); this.ListDomainMessage = "No of Domains: " + response.ListDomainsResult.DomainName.Count; }); }
private void btnBatchDeleteAttributes_Click(object sender, RoutedEventArgs e) { SimpleDBResponseEventHandler <object, ResponseEventArgs> responseHandler = null; responseHandler = delegate(object senderOriginal, ResponseEventArgs args) { ISimpleDBResponse result = args.Response; SimpleDB.Client.OnSimpleDBResponse -= responseHandler; this.Dispatcher.BeginInvoke(() => { BatchDeleteAttributesResponse response = result as BatchDeleteAttributesResponse; if (null != response) { this.BatchDeleteMessage = "Batch attributes deleted successfully"; } else { AmazonSimpleDBException exception = result as AmazonSimpleDBException; if (null != exception) { this.BatchDeleteMessage = "Error: " + exception.Message; } } }); }; this.BatchDeleteMessage = "Please wait..."; SimpleDB.Client.OnSimpleDBResponse += responseHandler; BatchDeleteAttributesRequest deleteRequest = new BatchDeleteAttributesRequest() { DomainName = this.DomainName }; List <DeleteableItem> deleteItem = deleteRequest.Item; //List<Amazon.SimpleDB.Model.Attribute> attributeItem1 = new List<Amazon.SimpleDB.Model.Attribute>(); //List<Amazon.SimpleDB.Model.Attribute> attributeItem2 = new List<Amazon.SimpleDB.Model.Attribute>(); List <AttributeAndValue> aAndV1 = GetListAttributeAndValueFromString(this.AttributesAndValuesToPut); DeleteableItem item1 = new DeleteableItem { ItemName = "OneAttribute" }; DeleteableItem item2 = new DeleteableItem { ItemName = "TwoAttribute" }; int index = 0; foreach (var item in aAndV1) { if (index <= aAndV1.Count / 2) { item1.Attribute.Add(new Amazon.SimpleDB.Model.Attribute().WithName(item.Attribute).WithValue(item.Value)); } else { item2.Attribute.Add(new Amazon.SimpleDB.Model.Attribute().WithName(item.Attribute).WithValue(item.Value)); } index++; } //attributeItem1.Add(new Amazon.SimpleDB.Model.Attribute().WithName("Category").WithValue("Clothes")); //attributeItem1.Add(new Amazon.SimpleDB.Model.Attribute().WithName("Subcategory").WithValue("Sweater")); //attributeItem2.Add(new Amazon.SimpleDB.Model.Attribute().WithName("Size").WithValue("Small")); //attributeItem2.Add(new Amazon.SimpleDB.Model.Attribute().WithName("Color").WithValue("Siamese")); #region Commented //Commented because of changes in the Attribute property definition change during resolving FxCop warnings. //deleteItem.Add(new DeleteableItem() { Attribute = attributeItem1, ItemName = "OneAttribute" }); //deleteItem.Add(new DeleteableItem() { Attribute = attributeItem2, ItemName = "TwoAttribute" }); #endregion Commented deleteItem.Add(item1); deleteItem.Add(item2); SimpleDB.Client.BatchDeleteAttributes(deleteRequest); }
public ResponseEventArgs(ISimpleDBResponse response) { this.Response = response; }