I have a MapTool that I don't want the user to be able to exit out of. I am trying to use the OnToolDeactivateAsync Task and/or the OnActiveToolChanged event to 'reactivate' the tool as soon as the user presses the escape key.
protected override Task OnToolDeactiveAsync(bool hasMapViewChanged)
{
if (FrameworkApplication.OutgoingTool == "Map_Tool")
{
FrameworkApplication.SetCurrentToolAsync("Map_Tool");
}
return base.OnToolDeactivateAsync(hasMapViewChanged);
}
After this executes my MapTool is shown as active on the map, but is bugged in functionality - it works similar to that of the Explore Tool. I'm not sure why this is. Is there a way to achieve a re-activation of a MapTool upon its deactivation through this method or other?