Hi everyone,I've been struggling with creating my first extension for over a week now and have made some progress but now I am seeing behavior that I don't quite understand. I'm using Visual Studio 2008 with C#. I used the ESRI ApplicationExtension template to create my extension and followed the AcmeExt ESRI example. The code below is the State snippet from IExentsionConfig exactly as it comes in when you first create an extension from the template. The only code I have added are the two message boxes so I could see when things fired. I originally had more code in there listening to the AddItem event but stripped it down to the minimum for simplicity of posting here.Much to my surprise, the Disabled message box (esriExtensionState.esriESDisabled) pops up now every time I open ArcMap and it does not matter if my extension is checked on or not in the extensions dialog. Is this normal behavior? I thought this code would only fire when my extension is either turned on or off.My extension is going to be deployed on a Citrix server for everyone in our organization to use (1700+ people) and I don't want my code firing every time ArcMap opens, only when my extension is checked on.Sorry if this is a dumb question, but extensions have always been a bit of a mystery to me and my total experience with trying to write one is only one week plus long. I've been pouring through the forums but have not found an answer.Thanks,Carlos public esriExtensionState State
{
get
{
return m_enableState;
}
set
{
if (m_enableState != 0 && value == m_enableState)
return;
//Check if ok to enable or disable extension
esriExtensionState requestState = value;
if (requestState == esriExtensionState.esriESEnabled)
{
//Cannot enable if it's already in unavailable state
if (m_enableState == esriExtensionState.esriESUnavailable)
{
throw new COMException("Cannot enable extension");
}
//Determine if state can be changed
esriExtensionState checkState = StateCheck(true);
m_enableState = checkState;
MessageBox.Show("Enabled");
}
else if (requestState == 0 || requestState == esriExtensionState.esriESDisabled)
{
//Determine if state can be changed
esriExtensionState checkState = StateCheck(false);
if (checkState != m_enableState)
m_enableState = checkState;
MessageBox.Show("Disabled");
}
}
}