RSS weather layer
WeatherLayerToolbar.vb
' Copyright 2012 ESRI
' 
' All rights reserved under the copyright laws of the United States
' and applicable international laws, treaties, and conventions.
' 
' You may freely redistribute and use this sample code, with or
' without modification, provided you include the original copyright
' notice and use restrictions.
' 
' See the use restrictions.
' 

Imports Microsoft.VisualBasic
Imports ESRI.ArcGIS.ADF.BaseClasses
Imports ESRI.ArcGIS.ADF.CATIDs
Imports ESRI.ArcGIS.SystemUI
Imports System
Imports System.Runtime.InteropServices

  ''' <summary>
  ''' The layer's command items toolbar
  ''' </summary>
  <Guid("653D29A8-10A4-44b8-9140-86170B715931"), ClassInterface(ClassInterfaceType.None), ProgId("WeatherLayerToolbar"), ComVisible(True)> _
  Public Class WeatherLayerToolbar : Implements IToolBarDef
  #Region "COM Registration Function(s)"
  <ComRegisterFunction(), ComVisible(False)> _
  Private Shared Sub RegisterFunction(ByVal registerType As Type)
    ' Required for ArcGIS Component Category Registrar support
    ArcGISCategoryRegistration(registerType)

    '
    ' TODO: Add any COM registration code here
    '
  End Sub

  <ComUnregisterFunction(), ComVisible(False)> _
  Private Shared Sub UnregisterFunction(ByVal registerType As Type)
    ' Required for ArcGIS Component Category Registrar support
    ArcGISCategoryUnregistration(registerType)

    '
    ' TODO: Add any COM unregistration code here
    '
  End Sub

  #Region "ArcGIS Component Category Registrar generated code"
  ''' <summary>
  ''' Required method for ArcGIS Component Category registration -
  ''' Do not modify the contents of this method with the code editor.
  ''' </summary>
  Private Shared Sub ArcGISCategoryRegistration(ByVal registerType As Type)
    Dim regKey As String = String.Format("HKEY_CLASSES_ROOT\CLSID\{{{0}}}", registerType.GUID)
    MxCommandBars.Register(regKey)
    ControlsToolbars.Register(regKey)
  End Sub
  ''' <summary>
  ''' Required method for ArcGIS Component Category unregistration -
  ''' Do not modify the contents of this method with the code editor.
  ''' </summary>
  Private Shared Sub ArcGISCategoryUnregistration(ByVal registerType As Type)
    Dim regKey As String = String.Format("HKEY_CLASSES_ROOT\CLSID\{{{0}}}", registerType.GUID)
    MxCommandBars.Unregister(regKey)
    ControlsToolbars.Unregister(regKey)
  End Sub

  #End Region
  #End Region

  Private Structure ToolDef
    Public itemDef As String
    Public group As Boolean
    Public Sub New(ByVal itd As String, ByVal grp As Boolean)
    itemDef = itd
    group = grp
    End Sub
  End Structure

  Private m_toolDefs As ToolDef() = { New ToolDef("AddRSSWeatherLayer", False), New ToolDef("SelectByCityName", False), New ToolDef("AddWeatherItemCmd", False), New ToolDef("AddWeatherItemTool", False), New ToolDef("RefreshLayerCmd", False) }

  Public Sub New()
  End Sub


  #Region "IToolBarDef Implementations"
  Public Sub GetItemInfo(ByVal pos As Integer, ByVal itemDef As ESRI.ArcGIS.SystemUI.IItemDef) Implements IToolBarDef.GetItemInfo
    itemDef.ID = m_toolDefs(pos).itemDef
    itemDef.Group = m_toolDefs(pos).group
  End Sub

  Public ReadOnly Property Caption() As String Implements IToolBarDef.Caption
    Get
    Return "RSS Weather layer"
    End Get
  End Property

  Public ReadOnly Property Name() As String Implements IToolBarDef.Name
    Get
    Return "WeatherLayerToolbar"
    End Get
  End Property

  Public ReadOnly Property ItemCount() As Integer Implements IToolBarDef.ItemCount
    Get
    Return m_toolDefs.Length
    End Get
  End Property
  #End Region

  End Class