Inheritance: System.Windows.Forms.UserControl
        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.SelectionChanged -= UpdateSelCountDockWin;
            avEvent.ContentsChanged  -= avEvent_ContentsChanged;
            avEvent = null;

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

            if (selCombo != null)
            {
                selCombo.ClearAll();
            }

            SelCountDockWin.SetEnabled(false);
        }
        // Privates
        private void Initialize()
        {
            // If the extension hasn't been started yet or it's been turned off, bail
            if (s_extension == null || this.State != ExtensionState.Enabled)
            {
                return;
            }

            // Reset event handlers
            IActiveViewEvents_Event avEvent = ArcMap.Document.FocusMap as IActiveViewEvents_Event;

            avEvent.ItemAdded        += AvEvent_ItemAdded;
            avEvent.ItemDeleted      += AvEvent_ItemAdded;
            avEvent.SelectionChanged += UpdateSelCountDockWin;
            avEvent.ContentsChanged  += avEvent_ContentsChanged;

            // Update the UI
            m_map = ArcMap.Document.FocusMap;
            FillComboBox();
            SelCountDockWin.SetEnabled(true);
            UpdateSelCountDockWin();
            m_hasSelectableLayer = CheckForSelectableLayer();
        }
        private void UpdateSelCountDockWin()
        {
            // If the dockview hasn't been created yet
            if (!SelCountDockWin.Exists)
            {
                return;
            }

            // Update the contents of the listView, when the selection changes in the map.
            IFeatureLayer     featureLayer;
            IFeatureSelection featSel;

            SelCountDockWin.Clear();

            // Loop through the layers in the map and add the layer's name and
            // selection count to the list box
            for (int i = 0; i < m_map.LayerCount; i++)
            {
                if (m_map.get_Layer(i) is IFeatureSelection)
                {
                    featureLayer = m_map.get_Layer(i) as IFeatureLayer;
                    if (featureLayer == null)
                    {
                        break;
                    }

                    featSel = featureLayer as IFeatureSelection;

                    int count = 0;
                    if (featSel.SelectionSet != null)
                    {
                        count = featSel.SelectionSet.Count;
                    }
                    SelCountDockWin.AddItem(featureLayer.Name, count);
                }
            }
        }
 protected override IntPtr OnCreateChild()
 {
   m_windowUI = new SelCountDockWin(this.Hook);
   return m_windowUI.Handle;
 }
Beispiel #5
0
 protected override IntPtr OnCreateChild()
 {
     m_windowUI = new SelCountDockWin(this.Hook);
     return(m_windowUI.Handle);
 }