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(); }