File tree Expand file tree Collapse file tree 5 files changed +12
-12
lines changed
articles/cognitive-services/Computer-vision Expand file tree Collapse file tree 5 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ namespace CSHttpClientSample
56
56
// the Analyze method endpoint
57
57
static string uriBase = endpoint + " vision/v2.1/analyze" ;
58
58
59
- static void Main ()
59
+ static async Task Main ()
60
60
{
61
61
// Get the path and filename to process from the user.
62
62
Console .WriteLine (" Analyze an image:" );
@@ -67,8 +67,8 @@ namespace CSHttpClientSample
67
67
if (File .Exists (imageFilePath ))
68
68
{
69
69
// Call the REST API method.
70
- Console .WriteLine (" \n Wait a moment for the results to appear.\n " );
71
- MakeAnalysisRequest (imageFilePath ). Wait ( );
70
+ Console .WriteLine (" \n Wait for the results to appear.\n " );
71
+ await MakeAnalysisRequest (imageFilePath );
72
72
}
73
73
else
74
74
{
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ namespace CSHttpClientSample
60
60
// the Batch Read method endpoint
61
61
static string uriBase = endpoint + " vision/v2.1/read/core/asyncBatchAnalyze" ;
62
62
63
- static void Main ()
63
+ static async Task Main ()
64
64
{
65
65
// Get the path and filename to process from the user.
66
66
Console .WriteLine (" Text Recognition:" );
@@ -72,7 +72,7 @@ namespace CSHttpClientSample
72
72
{
73
73
// Call the REST API method.
74
74
Console .WriteLine (" \n Wait a moment for the results to appear.\n " );
75
- ReadText (imageFilePath ). Wait ( );
75
+ await ReadText (imageFilePath );
76
76
}
77
77
else
78
78
{
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ namespace CSHttpClientSample
59
59
// the OCR method endpoint
60
60
static string uriBase = endpoint + " vision/v2.1/ocr" ;
61
61
62
- static void Main ()
62
+ static async Task Main ()
63
63
{
64
64
// Get the path and filename to process from the user.
65
65
Console .WriteLine (" Optical Character Recognition:" );
@@ -70,7 +70,7 @@ namespace CSHttpClientSample
70
70
{
71
71
// Call the REST API method.
72
72
Console .WriteLine (" \n Wait a moment for the results to appear.\n " );
73
- MakeOCRRequest (imageFilePath ). Wait ( );
73
+ await MakeOCRRequest (imageFilePath );
74
74
}
75
75
else
76
76
{
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ namespace CSHttpClientSample
56
56
// the GenerateThumbnail method endpoint
57
57
static string uriBase = endpoint + " vision/v2.1/generateThumbnail" ;
58
58
59
- static void Main ()
59
+ static async Task Main ()
60
60
{
61
61
// Get the path and filename to process from the user.
62
62
Console .WriteLine (" Thumbnail:" );
@@ -68,7 +68,7 @@ namespace CSHttpClientSample
68
68
{
69
69
// Call the REST API method.
70
70
Console .WriteLine (" \n Wait a moment for the results to appear.\n " );
71
- MakeThumbNailRequest (imageFilePath ). Wait ( );
71
+ await MakeThumbNailRequest (imageFilePath );
72
72
}
73
73
else
74
74
{
Original file line number Diff line number Diff line change @@ -160,7 +160,7 @@ namespace BasicConsoleSample
160
160
const string ApiKey = " <your API key>" ;
161
161
const string Endpoint = " https://<your API region>.api.cognitive.microsoft.com" ;
162
162
163
- private static void Main (string [] args )
163
+ private static async Task Main (string [] args )
164
164
{
165
165
// Create grabber.
166
166
FrameGrabber < DetectedFace []> grabber = new FrameGrabber <DetectedFace []>();
@@ -201,14 +201,14 @@ namespace BasicConsoleSample
201
201
grabber .TriggerAnalysisOnInterval (TimeSpan .FromMilliseconds (3000 ));
202
202
203
203
// Start running in the background.
204
- grabber .StartProcessingCameraAsync (). Wait ();
204
+ await grabber .StartProcessingCameraAsync ();
205
205
206
206
// Wait for key press to stop.
207
207
Console .WriteLine (" Press any key to stop..." );
208
208
Console .ReadKey ();
209
209
210
210
// Stop, blocking until done.
211
- grabber .StopProcessingAsync (). Wait ();
211
+ await grabber .StopProcessingAsync ();
212
212
}
213
213
}
214
214
}
You can’t perform that action at this time.
0 commit comments