I've created an add in button that subscribes to a RowChangedEvent for each layer in a map. If another layer is added to the map and the add in button is executed again, each of the previous layers that already were subscribed will now have an additional event listener. Is there a way to determine if an event listener (RowChangedEvent) is already associated with a layer so I can prevent a additional ones from being created?
Thanks for your help!
Frank
Is this an ArcGIS Pro SDK question?
Sorry. Yes, it’s an ArcGIS Pro SDK question.
Hi Frank,
There's nothing currently in the public API you can use to determine if a layer has an associated event.
You could maintain a collection (list or dictionary) of layers that have been subscribed to and check the list when iterating through the map layers again. Use the Layer.URI property to ensure uniqueness.
Thanks, Sean. I thought that might be the case. I'll give the collection a try.
Thanks again,
Frank