private void FillLayerComboBox() { ComboBoxLayerSelector layerNameCombo = ComboBoxLayerSelector.GetLayerNameComboBox(); if (layerNameCombo == null) { return; } layerNameCombo.ClearAll(); IRasterLayer rasterLayer; // Loop through the layers in the map and add the layer's name to the combo box. for (int i = 0; i < m_map.LayerCount; i++) { if (m_map.get_Layer(i) is IRasterLayer) { rasterLayer = m_map.get_Layer(i) as IRasterLayer; if (rasterLayer == null) { break; } layerNameCombo.AddItem(rasterLayer.Name, rasterLayer); } } }
private void Uninitialize() { if (s_extension == null) { return; } // Detach event handlers IActiveViewEvents_Event avEvent = m_map as IActiveViewEvents_Event; avEvent.ItemAdded -= AvEvent_ItemAdded; avEvent.ItemDeleted -= AvEvent_ItemAdded; avEvent.ContentsChanged -= avEvent_ContentsChanged; avEvent = null; // Update UI ComboBoxLayerSelector layerNameCombo = ComboBoxLayerSelector.GetLayerNameComboBox(); if (layerNameCombo != null) { layerNameCombo.ClearAll(); } }