I have removed the async and await functionalities from following code (copied from GeoprocessingExecuteAsync example) and it still works fine. My question is are they both correct (because i am not seeing any difference in the response of the system, i.e. with QueuedTask implementation, ArcGISPro is responsive in both cases?
Many thanks in advance.
The original code:
- protected override async Task<bool> OnSketchCompleteAsync(Geometry geometry)
- {
- var valueArray = await QueuedTask.Run(() =>
- {
- var g = new List<object>() { geometry, };
- // Creates a 8000-meter buffer around the geometry object
- // null indicates a default output name is used
- return"8000 Meters");
- });
-
- await Geoprocessing.ExecuteToolAsync("analysis.Buffer", valueArray);
- return true;
- }
and the modified code (async and await removed):
- protected override Task<bool> OnSketchCompleteAsync(Geometry geometry)
- {
- var something = QueuedTask.Run(() =>
- {
- var g = new List<object>() { geometry, };
- // Creates a 8000-meter buffer around the geometry object
- // null indicates a default output name is used
- "8000 Meters");
- Geoprocessing.ExecuteToolAsync("analysis.Buffer", valueArray);
- return true;
- });
- return something;
- }