void ListBucketWebResponse(object sender, ResponseEventArgs args) { AmazonS3Exception result = args.Response as AmazonS3Exception; S3Common.client.OnS3Response -= ListBucketWebResponse; if (null != result) { S3ErrorResponse(result); return; } ListBucketsResponse response = args.Response as ListBucketsResponse; this.Dispatcher.BeginInvoke(() => { BucketNames.Clear(); this.BucketNameSelected = false; response.Buckets.ToList().ForEach(b => BucketNames.Add(b.BucketName)); }); }
void PutBucketPolicyWebResponse(object sender, ResponseEventArgs args) { AmazonS3Exception result = args.Response as AmazonS3Exception; S3Common.client.OnS3Response -= PutBucketPolicyWebResponse; if (null != result) { S3ErrorResponse(result); return; } PutBucketPolicyResponse policyResponse = args.Response as PutBucketPolicyResponse; if (null != policyResponse) { if (!string.IsNullOrEmpty(policyResponse.AmazonId2) && (!string.IsNullOrEmpty(policyResponse.RequestId))) { this.Dispatcher.BeginInvoke(() => { GetBucketResult = string.Format(CultureInfo.InvariantCulture, "Policy Created Successfully for Bucket {0}", SelectedBucketName); }); } } else { this.Dispatcher.BeginInvoke(() => { GetBucketResult = string.Format(CultureInfo.InvariantCulture, "Unsuccessfully creation of Policy for Bucket {0}", SelectedBucketName); }); } }
void GetBucketPolicyWebResponse(object sender, ResponseEventArgs args) { AmazonS3Exception result = args.Response as AmazonS3Exception; S3Common.client.OnS3Response -= GetBucketPolicyWebResponse; if (null != result) { S3ErrorResponse(result); return; } GetBucketPolicyResponse policyResponse = args.Response as GetBucketPolicyResponse; if (null != policyResponse) { if (!string.IsNullOrEmpty(policyResponse.AmazonId2) && (!string.IsNullOrEmpty(policyResponse.RequestId))) { this.Dispatcher.BeginInvoke(() => { GetBucketResult = policyResponse.Policy; }); } } else { this.Dispatcher.BeginInvoke(() => { GetBucketResult = string.Format(CultureInfo.InvariantCulture, "Error Processing GetPolicy Request"); }); } }
void GetBucketLocationWebResponse(object sender, ResponseEventArgs args) { AmazonS3Exception response = args.Response as AmazonS3Exception; S3Common.client.OnS3Response -= GetBucketLocationWebResponse; if (null != response) { S3ErrorResponse(response); return; } GetBucketLocationResponse locationResponse = args.Response as GetBucketLocationResponse; if (null != locationResponse) { if (!string.IsNullOrEmpty(locationResponse.AmazonId2) && (!string.IsNullOrEmpty(locationResponse.RequestId))) { this.Dispatcher.BeginInvoke(() => { GetBucketResult = String.Format(CultureInfo.InvariantCulture, "The Location of {0} Bucket: {1}", SelectedBucketName, locationResponse.Location); }); } } else { this.Dispatcher.BeginInvoke(() => { GetBucketResult = string.Format(CultureInfo.InvariantCulture, "Error Processing GetBucketLocation Request"); }); } }
void DeleteBucketWebResponse(object sender, ResponseEventArgs args) { AmazonS3Exception response = args.Response as AmazonS3Exception; S3Common.client.OnS3Response -= DeleteBucketWebResponse; if (null != response) { S3ErrorResponse(response); return; } DeleteBucketResponse deleteBucketResult = args.Response as DeleteBucketResponse; if (null != deleteBucketResult) { if (!string.IsNullOrEmpty(deleteBucketResult.AmazonId2) && (!string.IsNullOrEmpty(deleteBucketResult.RequestId))) { this.Dispatcher.BeginInvoke(() => { DeleteBucketText = string.Format(CultureInfo.InvariantCulture, "{0} bucket deleted Successfully", SelectedBucketName); this.BucketNameSelected = false; }); } } else { this.Dispatcher.BeginInvoke(() => { DeleteBucketText = string.Format(CultureInfo.InvariantCulture, "Unsuccessful deletetion of Bucket: {0}", SelectedBucketName); this.BucketNameSelected = false; }); } }
void CreateBucketWebResponse(object sender, ResponseEventArgs args) { AmazonS3Exception response = args.Response as AmazonS3Exception; S3Common.client.OnS3Response -= CreateBucketWebResponse; if (null != response) { S3ErrorResponse(response); return; } PutBucketResponse putBucketResponse = args.Response as PutBucketResponse; if (null != putBucketResponse) { if (!string.IsNullOrEmpty(putBucketResponse.AmazonId2) && (!string.IsNullOrEmpty(putBucketResponse.RequestId))) { this.Dispatcher.BeginInvoke(() => { GetBucketResult = string.Format(CultureInfo.InvariantCulture, "{0} bucket created Successfully", CreateBucketName); }); } } else { this.Dispatcher.BeginInvoke(() => { GetBucketResult = string.Format(CultureInfo.InvariantCulture, "Unsuccessul Creation of Bucket: {0}", CreateBucketName); }); } }
private void Client_CopyObjectResponse(object sender, ResponseEventArgs args) { AmazonS3Exception result = args.Response as AmazonS3Exception; S3Common.client.OnS3Response -= (Client_CopyObjectResponse); if (null != result) { S3ErrorResponse(result); return; } CopyObjectResponse response = args.Response as CopyObjectResponse; if (null != response) { this.Dispatcher.BeginInvoke(() => { this.CopyObjectResult = response.IsRequestSuccessful ? "Successfully copied the source object." : "Error copying object."; }); } }