void webMap_GetMapCompleted(object sender, GetMapCompletedEventArgs e)
{
if (e.Error == null)
{
MyMap.Extent = e.Map.Extent;
int i = 0;
LayerCollection layerCollection = new LayerCollection();
foreach (Layer layer in e.Map.Layers)
{
layer.ID = i.ToString();
layerCollection.Add(layer);
if (layer is FeatureLayer)
(layer as FeatureLayer).MouseLeftButtonUp += WebMapFeatureServicePopups_MouseLeftButtonUp;
i++;
}
e.Map.Layers.Clear();
MyMap.Layers = layerCollection;
}
}