Is there a way to cancel Editor.RequestShapeAsync?

4209
2
Jump to solution
04-03-2015 02:06 PM
AshleyDePottey
New Contributor II

Is there any way to gracefully cancel the RequestShapeAsync task?  I do not have much experience with using the C# async capabilities, but it seems the awaitable method needs to accept a cancellation token and this method does not appear to accept one.  Is there any other way to cancel this method gracefully?  For example, if a user is in the middle of drawing a polygon does not want to finish it, I need a way to cancel this task by clicking a cancel button.

0 Kudos
1 Solution

Accepted Solutions
AsserSwelam1
Occasional Contributor

Hi Ashley,

You can check if the Editor is active and if yes you can use Cancel.Execute.

if (MyMapView.Editor.IsActive)

  MyMapView.Editor.Cancel.Execute(null);

-Asser

View solution in original post

0 Kudos
2 Replies
AsserSwelam1
Occasional Contributor

Hi Ashley,

You can check if the Editor is active and if yes you can use Cancel.Execute.

if (MyMapView.Editor.IsActive)

  MyMapView.Editor.Cancel.Execute(null);

-Asser

0 Kudos
AshleyDePottey
New Contributor II

Thanks Asser!  That worked perfectly.

0 Kudos