//--------------------------------------------------------------------- // CHANGED: CR31 (Switching between GIS layers) // Enable the user to switch between different HLU layers, where // there is more than one valid layer in the current document. // Pass the layer to be switched to so that the event handlers // can be linked to that layer. private void SetupSelectionChangedEvent(IFeatureLayer layer) { if (layer == null) return; try { // Remove the previous event handler if present if (_hluLayerSelectionChangedHandler != null) _hluLayerSelectionChangedHandler.FeatureLayerSelectionChanged -= _hluLayerSelectionEvent_FeatureLayerSelectionChanged; _hluFeatureSelection = (IFeatureSelection)layer; _hluLayerSelectionChangedHandler = (IFeatureLayerSelectionEvents_Event)layer; _hluLayerSelectionChangedHandler.FeatureLayerSelectionChanged += new IFeatureLayerSelectionEvents_FeatureLayerSelectionChangedEventHandler( _hluLayerSelectionEvent_FeatureLayerSelectionChanged); } catch (Exception ex) { string s = ex.Message; } }
private void SetupSelectionChangedEvent() { if (_hluLayer == null) return; try { _hluFeatureSelection = (IFeatureSelection)_hluLayer; _hluLayerSelectionChangedHandler = (IFeatureLayerSelectionEvents_Event)_hluLayer; _hluLayerSelectionChangedHandler.FeatureLayerSelectionChanged += new IFeatureLayerSelectionEvents_FeatureLayerSelectionChangedEventHandler( _hluLayerSelectionEvent_FeatureLayerSelectionChanged); } catch (Exception ex) { string s = ex.Message; } }