Пример #1
0
        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));
                });
        }
Пример #2
0
 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);
         });
     }
 }
Пример #3
0
 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");
         });
     }
 }
Пример #4
0
 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");
         });
     }
 }
Пример #5
0
        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;
                });
            }
        }
Пример #6
0
 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);
         });
     }
 }
Пример #7
0
        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.";
                });
            }
        }