Select to view content in your preferred language

Fire Events Immediately

838
1
09-10-2012 06:45 AM
Labels (1)
JustinHunter
Regular Contributor
Hey all,

I'm writing a C# class library to plug into our existing CMS, but I've run into a snag. I have many map layers and feature layers, but no actual map to display, so I've been taking the advice from recent post and calling the Initialize() method manually on my layers. The problem though, is that my entire call stack finishes before my Initialize event fires, and at that point I've already returned all my data, which is nothing since the layers are blank.

With that, is there a setting so when I call layer.Initialize() it will immediately jump into the Initialize event handler? Without this I'll be forced to query the REST API directly, which is fine, I'd just like to be able to use the tools given to me.

(may not belong in this sub-forum, sorry if that's the case)
0 Kudos
1 Reply
MichaelBranscomb
Esri Frequent Contributor
Hi,

Assuming you're working with the ArcGIS Runtime SDK for WPF... After calling Initialize on a layer you should wait for the Initialized event to fire. This means the request/response cycle has happened and the layer properties have been set based on the information available on the REST endpoint for the service. Making the REST request yourself would be exactly the same, just more complicated.

If you're waiting for all the layers to be initalized then you should handle the LayersInitialized event on the Map.Layers collection: http://resources.arcgis.com/en/help/runtime-wpf/apiref/index.html?ESRI.ArcGIS.Client~ESRI.ArcGIS.Cli....

Cheers

Mike
0 Kudos