andrarias

how to wait unitl layer creation is complete?

Discussion created by andrarias on Jun 22, 2017

Hi, I am adding a layer to a map and want to read all the values from a particular field,

 

await QueuedTask.Run(() =>
                {
                    Layer RefLayer = LayerFactory.CreateLayer(new Uri(LyrFile), myMap);
                    MapView.Active.ZoomToAsync(RefLayer);
                    if (RefLayer == null)
                    {
                        ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Failed to create layer for url:" + LyrFile);
                        return;
                    }
                    else

                    {

                       //find layer
                      var disLayer = MapView.Active.Map.FindLayers(layerName).FirstOrDefault() as BasicFeatureLayer;

                    }
                });

 

 

 

however the FindLayers returns null.

What would be an appropriate way to wait until the creation is done?

Can someone help me solve this?

Outcomes