If there is no way to reliably detect "Visible" there are ways to use a couple of Events to infer Visibility.
//Is true when the Addin is Created
private bool _isVisible = true;
//Fires when the Addin is Hidden - But ONLY when it is hidden
private void SilcObjectBrowser_VisibleChanged(object sender, EventArgs e)
{
//Even though the Addin is now hidden, this.Visible == true!!!
_isVisible = false;
}
//Will only fire when the Addin is Visible
private void SilcObjectBrowser_Paint(object sender, PaintEventArgs e)
{
_isVisible = true;
}
//Return the current state of _isVisible
public bool IsVisible { get { return _isVisible; } }
This is a start. BUT I would actually like to be able to reliably detect when an Addin is *Active*. Example:
I have an Addin. I click the Button to create and show it: it's now Visible AND *Active*. I Dock it with the Content Window as a tab. So now I have my Addin and the Contents Window on the same Dock Control each having a separate tab. If I click the Contents Window tab, my Addin is not Visible (and the above code will detect this). BUT, it is *Active* and I need to know that.
Is there a straight forward way to detect *Active*? If not, is there a not so straight forward way, like using Events such as above?
Thanks much,