I am writing an add-in that creates a layout frame, loads some layers into it, and exports the maps as .pdf documents. This is supposed to be an unattended batch process that runs on a series of folders in a file system. When this call is made:
ILayoutPane iNewLayoutPane = await FrameworkApplication.Panes.CreateLayoutPaneAsync(layout);
if the focus is not on ArcGIS PRO, execution pauses until I bring PRO to the foreground and click on the new layout tab. I see in the documentation that this is supposed to be called on the GUI thread. Is there a way to make sure this is the case? This line of code is in a static method in a code module, but is not enclosed in a QueuedTask statement.