Called when opening the Extension dialog, and when toggling the extension state in the Extension dialog.

Namespace:  ESRI.ArcGIS.Desktop.AddIns

Assembly:  ESRI.ArcGIS.Desktop.Addins (in ESRI.ArcGIS.Desktop.Addins.dll) Version: 10.0.0.0 (10.0.0.0)

Syntax

C#
protected virtual ExtensionState OnGetState()
Visual Basic (Declaration)
Protected Overridable Function OnGetState As ExtensionState
Visual C++
protected:
virtual ExtensionState OnGetState()

Remarks

Override this method to return the extension's availability state.

Examples

The code below shows an extension class that sets and gets its state.
CopyC#
protected override bool OnSetState(ExtensionState state)
{
  //Users can optionally check license here.
  this.State = state;
  return true;
}

protected override ExtensionState OnGetState()
{
  return this.State;
}

internal bool IsExtensionEnabled
{
  get
  {
    return this.State == ExtensionState.Enabled;
  }
}
CopyVB.NET
Protected Overloads Overrides Function OnSetState(ByVal state As ExtensionState) As Boolean
  'Users can optionally check license here. 
  Me.State = state
  Return True
End Function

Protected Overloads Overrides Function OnGetState() As ExtensionState
  Return Me.State
End Function

Friend ReadOnly Property IsExtensionEnabled() As Boolean
  Get
    Return Me.State = ExtensionState.Enabled
  End Get
End Property

See Also