DownloadAsync() 공개 메소드

Downloads the content from Amazon S3 and writes it to the specified file. If the key is not specified in the request parameter, the file name will used as the key name.
public DownloadAsync ( TransferUtilityDownloadRequest request, CancellationToken cancellationToken = default(CancellationToken) ) : Task
request TransferUtilityDownloadRequest /// Contains all the parameters required to download an Amazon S3 object. ///
cancellationToken System.Threading.CancellationToken /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. ///
리턴 Task
 public async Task DownloadFile(IStorageFile storageFile, string bucket, string key, AWSCredentials credentials, CancellationToken cancellationToken)
 {
     var s3Client = new AmazonS3Client(credentials, RegionEndpoint.USEast1);
     using (var transferUtility = new TransferUtility(s3Client))
     {
         var downloadRequest = new TransferUtilityDownloadRequest
         {
             BucketName = bucket,
             Key = key,
             StorageFile = storageFile
         };
         downloadRequest.WriteObjectProgressEvent += OnWriteObjectProgressEvent;
         await transferUtility.DownloadAsync(downloadRequest, cancellationToken);
     }
 }
        public async Task DownloadFile(IStorageFile storageFile, string key, CancellationToken cancellationToken)
        {
            
            BasicAWSCredentials credentials = new BasicAWSCredentials("AKIAJTADDHY7T7GZXX5Q", "n4xV5B25mt7e6br84H2G9SXBx8eDYTQJgCxoaF49");
            var s3Client = new AmazonS3Client(credentials, RegionEndpoint.USEast1);
            
            //files = await Windows.Storage.DownloadsFolder.CreateFileAsync(); 
            using (var transferUtility = new TransferUtility(s3Client))
            {
                var downloadRequest = new TransferUtilityDownloadRequest
                {
                    BucketName = ExistingBucketName,
                    Key = key,
                    StorageFile = storageFile
                };
                downloadRequest.WriteObjectProgressEvent += OnWriteObjectProgressEvent;
                await transferUtility.DownloadAsync(downloadRequest, cancellationToken);
            }

           
            
        }