Skip to content

Commit a94024e

Browse files
committed
use async all the way up
1 parent ddcfef6 commit a94024e

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

articles/cognitive-services/Computer-vision/QuickStarts/CSharp-analyze.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ namespace CSHttpClientSample
5656
// the Analyze method endpoint
5757
static string uriBase = endpoint + "vision/v2.1/analyze";
5858

59-
static void Main()
59+
static async Task Main()
6060
{
6161
// Get the path and filename to process from the user.
6262
Console.WriteLine("Analyze an image:");
@@ -67,8 +67,8 @@ namespace CSHttpClientSample
6767
if (File.Exists(imageFilePath))
6868
{
6969
// Call the REST API method.
70-
Console.WriteLine("\nWait a moment for the results to appear.\n");
71-
MakeAnalysisRequest(imageFilePath).Wait();
70+
Console.WriteLine("\nWait for the results to appear.\n");
71+
await MakeAnalysisRequest(imageFilePath);
7272
}
7373
else
7474
{

articles/cognitive-services/Computer-vision/QuickStarts/CSharp-hand-text.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ namespace CSHttpClientSample
6060
// the Batch Read method endpoint
6161
static string uriBase = endpoint + "vision/v2.1/read/core/asyncBatchAnalyze";
6262

63-
static void Main()
63+
static async Task Main()
6464
{
6565
// Get the path and filename to process from the user.
6666
Console.WriteLine("Text Recognition:");
@@ -72,7 +72,7 @@ namespace CSHttpClientSample
7272
{
7373
// Call the REST API method.
7474
Console.WriteLine("\nWait a moment for the results to appear.\n");
75-
ReadText(imageFilePath).Wait();
75+
await ReadText(imageFilePath);
7676
}
7777
else
7878
{

articles/cognitive-services/Computer-vision/QuickStarts/CSharp-print-text.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ namespace CSHttpClientSample
5959
// the OCR method endpoint
6060
static string uriBase = endpoint + "vision/v2.1/ocr";
6161

62-
static void Main()
62+
static async Task Main()
6363
{
6464
// Get the path and filename to process from the user.
6565
Console.WriteLine("Optical Character Recognition:");
@@ -70,7 +70,7 @@ namespace CSHttpClientSample
7070
{
7171
// Call the REST API method.
7272
Console.WriteLine("\nWait a moment for the results to appear.\n");
73-
MakeOCRRequest(imageFilePath).Wait();
73+
await MakeOCRRequest(imageFilePath);
7474
}
7575
else
7676
{

articles/cognitive-services/Computer-vision/QuickStarts/CSharp-thumb.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ namespace CSHttpClientSample
5656
// the GenerateThumbnail method endpoint
5757
static string uriBase = endpoint + "vision/v2.1/generateThumbnail";
5858

59-
static void Main()
59+
static async Task Main()
6060
{
6161
// Get the path and filename to process from the user.
6262
Console.WriteLine("Thumbnail:");
@@ -68,7 +68,7 @@ namespace CSHttpClientSample
6868
{
6969
// Call the REST API method.
7070
Console.WriteLine("\nWait a moment for the results to appear.\n");
71-
MakeThumbNailRequest(imageFilePath).Wait();
71+
await MakeThumbNailRequest(imageFilePath);
7272
}
7373
else
7474
{

articles/cognitive-services/Computer-vision/Vision-API-How-to-Topics/HowtoAnalyzeVideo_Vision.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ namespace BasicConsoleSample
160160
const string ApiKey = "<your API key>";
161161
const string Endpoint = "https://<your API region>.api.cognitive.microsoft.com";
162162

163-
private static void Main(string[] args)
163+
private static async Task Main(string[] args)
164164
{
165165
// Create grabber.
166166
FrameGrabber<DetectedFace[]> grabber = new FrameGrabber<DetectedFace[]>();
@@ -201,14 +201,14 @@ namespace BasicConsoleSample
201201
grabber.TriggerAnalysisOnInterval(TimeSpan.FromMilliseconds(3000));
202202

203203
// Start running in the background.
204-
grabber.StartProcessingCameraAsync().Wait();
204+
await grabber.StartProcessingCameraAsync();
205205

206206
// Wait for key press to stop.
207207
Console.WriteLine("Press any key to stop...");
208208
Console.ReadKey();
209209

210210
// Stop, blocking until done.
211-
grabber.StopProcessingAsync().Wait();
211+
await grabber.StopProcessingAsync();
212212
}
213213
}
214214
}

0 commit comments

Comments
 (0)