I have a script tool that I'm executing inside of an add-in, but if I click on another map while the tool is running it will output to that map which is causing problems in my add-in because it is expecting the other map to be populated. Currently I am just using the progress dialog to prevent the user from clicking on anything, but I wanted to know if there was a way to prevent them from clicking on other maps using conditions. I tried using:
FrameworkApplication.State.Deactivate(esri_mapping_mapPane);
but it didn't seem to do anything.
I would suggest that you read the active map once at the beginning of your command / tool execution and when done add the result to that map (don't ask for active map again) Essentially avoid asking questions twice when they can either take time to retrieve or return different results the second time (unless you really want that behavior).
Hey John, thanks for the reply.
The problem is that when I try to add outputs to a map manually inside of the python it has weird results. Instead I'm just setting an output parameter equal to the new feature classes and the output parameter is just outputting to the currently selected map.