Report Inappropriate Content
Top Print
Reply
|
| Subject |
Extension item template bug in IDE Integration Framework for VS 2005? |
| Author |
Ken Buja |
| Date |
Jun 12, 2007 |
| Message |
I'm using the item template for creating an extension in my project which automatically generates code below for setting the State property. However, when testing it in debug mode, I can't enable my extension in the Tools|Extensions dialog. The code never gets past the first line in Set:
If m_enableState <> 0 Or value = m_enableState Then Exit Property
The variable m_enableState is a esriExtensionState constant with three possible values of 1 (enabled for use), 2 (disabled by the user) or 4 (unavailable - not licensed). This if statement will always exit the property since m_enableState will never be 0.
What's the purpose for this line in the code? |
| |
Public Property State() As ESRI.ArcGIS.esriSystem.esriExtensionState Implements ESRI.ArcGIS.esriSystem.IExtensionConfig.State
Get
Return m_enableState
End Get
Set(ByVal value As ESRI.ArcGIS.esriSystem.esriExtensionState)
If m_enableState <> 0 Or value = m_enableState Then Exit Property
'Check if ok to enable or disable extension
Dim requestState As esriExtensionState = value
If requestState = esriExtensionState.esriESEnabled Then
'Cannot enable if it's already in unavailable state
If m_enableState = esriExtensionState.esriESUnavailable Then
Throw New COMException("Cannot enable extension")
End If
'Determine if state can be changed
Dim checkState As esriExtensionState = StateCheck(True)
m_enableState = checkState
ElseIf requestState = esriExtensionState.esriESDisabled Then
'Determine if state can be changed
Dim checkState As esriExtensionState = StateCheck(False)
If (m_enableState <> checkState) Then m_enableState = checkState
End If
End Set
End Property |
| |
Ken Buja
National Oceanic and Atmospheric Administration
1305 East-West Highway, N/SCI1
Silver Spring MD 20910-3281
(301) 713-3028 x140
ken.buja@noaa.gov |
| |
|