{
Console.WriteLine("Finished PutObject operation with simple callback");
Console.Write("\n\n");
}
public static void CallbackWithClient(IAsyncResult asyncResult)
{
try {
AmazonS3Client s3Client = (AmazonS3Client) asyncResult.AsyncState;
PutObjectResponse response = s3Client.EndPutObject(asyncResult);
Console.WriteLine("Finished PutObject operation with client call
back");
Console.WriteLine("Service Response:");
Console.WriteLine("-----------------");
Console.WriteLine(response);
Console.Write("\n\n");
}
catch (AmazonS3Exception s3Exception) {
//
// Code to process exception
//
}
}
public static void CallbackWithState(IAsyncResult asyncResult)
{
try {
ClientState state = asyncResult.AsyncState as ClientState;
AmazonS3Client s3Client = (AmazonS3Client)state.Client;
PutObjectResponse response = state.Client.EndPutObject(asyncResult);
Console.WriteLine(
"Finished PutObject operation with state callback that started
at {0}",
(DateTime.Now - state.Start).ToString() + state.Start);
Console.WriteLine("Service Response:");
Console.WriteLine("-----------------");
Console.WriteLine(response);
Console.Write("\n\n");
}
catch (AmazonS3Exception s3Exception) {
//
// Code to process exception
//
}
}
public static void TestPutObjectAsync()
{
// Create a client
AmazonS3Client client = new AmazonS3Client();
PutObjectResponse response;
IAsyncResult asyncResult;
//
Version v2.0.0
22
AWS SDK for .NET Developer Guide
Asynchronous API for .NET 3.5
Kommentare zu diesen Handbüchern