Background
Let's say I have a custom task pane like the one in the image below.
For my app, I only display this pane if the user is logged in (determined by the presence of a valid session token that was granted from an API endpoint), otherwise I display a log-in pane.
If the user leaves an inspector open when the session times out, I need to show a different task pane with a log in button. The user have many inspectors (and, therefore, many custom task panes) open at once.
I am planning to run a recursive method on a background thread about once per hour to check if the session is valid and, if not, swap any custom task panes that are displayed with a log-in pane.
Question
How do I accomplish a "swap" in each inspector the user has opened? Should I iterate all inspectors? If so, how do I access a collection of custom task panes within that inspector. Conversely, if I should iterate Globals.ThisAddIn.CustomTaskPanes
, how do I identify the inspector it belongs to so that I can swap any visible custom task pane with my log-in pane?