private void Uninitialize()
        {
            if (s_extension == null)
            {
                return;
            }

            UID editorUid = new UIDClass();

            editorUid.Value = "esriEditor.Editor";
            IEditor m_pEditor = m_pApp.FindExtensionByCLSID(editorUid) as IEditor;

            m_editorEvents = m_pEditor as IEditEvents_Event;
            IEditEvents_OnSelectionChangedEventHandler editEvents_OnSelectionChangedEventHandler = new IEditEvents_OnSelectionChangedEventHandler(this.Editor_OnSelectionChanged);

            m_editorEvents.OnSelectionChanged -= editEvents_OnSelectionChangedEventHandler;

            // Update UI
            SF10_cmbLayers selCombo = SF10_cmbLayers.GetSelectionComboBox();

            if (selCombo != null)
            {
                selCombo.ClearAll();
            }
        }
 public SF10_cmbLayers()
 {
     s_comboBox = this;
 }
Beispiel #3
0
 public SF10_cmbLayers()
 {
     s_comboBox = this;
 }
        protected override void OnClick()
        {
            SF10_cmbLayers selCombo = SF10_cmbLayers.GetSelectionComboBox();

            if (selCombo == null)
            {
                return;
            }

            selCombo.ClearAll();

            IFeatureLayer     featureLayer;
            IFeatureSelection pFsel;
            ISelectionSet     pSelectionSet;
            ICursor           pICursor;

            bool validFeatureLayer;

            IMap map = ArcMap.Document.FocusMap;

            // Loop through the layers in the map and add the layer's name to the combo box.
            for (int i = 0; i < map.LayerCount; i++)
            {
                validFeatureLayer = true;

                if (map.get_Layer(i) is IFeatureSelection)
                {
                    featureLayer = map.get_Layer(i) as IFeatureLayer;
                    if (featureLayer == null)
                    {
                        validFeatureLayer = false;
                    }

                    if (!SF10_classBase.isTypePolygon(featureLayer))
                    {
                        validFeatureLayer = false;
                    }

                    pFsel         = (IFeatureSelection)featureLayer;
                    pSelectionSet = pFsel.SelectionSet;
                    pSelectionSet.Search(null, true, out pICursor);

                    if (pICursor.Fields.FindField("nopeup") == -1)
                    {
                        validFeatureLayer = false;
                    }
                    if (pICursor.Fields.FindField("noacq_pee") == -1)
                    {
                        validFeatureLayer = false;
                    }
                    if (pICursor.Fields.FindField("saisie_ok") == -1)
                    {
                        validFeatureLayer = false;
                    }

                    if (validFeatureLayer)
                    {
                        selCombo.AddItem(featureLayer.Name, featureLayer);
                    }
                }
            }

            pICursor      = null;
            pSelectionSet = null;
            pFsel         = null;
            featureLayer  = null;
        }