how to wait unitl layer creation is complete?

384
0
06-22-2017 01:43 PM
andresarias
New Contributor II

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?

0 Kudos
0 Replies