I am working on a configuration for ArcGIS Pro that is using a dynamic menu. When populating the menu, I need to make some determinations in order to know whether or not to add certain menu items.
Several of these require the use of QueuedTask. I need to know if the user has right-clicked on an element. So I get the mouse position, convert it to client and then convert to Map. This needs to be done in the QueuedTask.Run as converting from screen to client and client to map require this.
However, as soon as I try this, the context menu does not get populated. I've marked the OnPopup method as async in order to use await on the QueuedTask to no avail.
What am I doing wrong? Is there an alternative to this that I am missing?
This happens if I hijack the context menu for the ArcgIS Pro select tool (esri_mapping_selection2DContextMenu). In this case, I am updating the menu and removing the existing commands and replacing it with my dynamic menu.
If I use my own tool, I have a bit more control because of the OnMouseDown/Async methods and the ability to show the context menu when needed. However, I don't get the selection smarts built into the select tool.
Any ideas would be greatly appreciated.