private void GetListCompleted(object sender, CompleteEvent e) { listLayers.layersListCompleted -= GetListCompleted; if (e.LayerList != null) { if (e.LayerList.Count > 0) { // Show window with the possible layers listView = new LayerListView(); LayerListViewModel listViewModel = new LayerListViewModel(e.LayerList); modalDialogService.ShowDialog(listView, listViewModel, EndOfLayerSelection); } else { ShowMessagebox.Raise(new Notification { Content = Silverlight.UI.Esri.JTToolbarCommon.Resources.ToolbarCommon.NoLayersAvailable, Title = Silverlight.UI.Esri.JTToolbarCommon.Resources.ToolbarCommon.Warning }); } } else { // Error occurred ShowErrorMessagebox.Raise(new Notification { Content = String.Format("GetListCompleted-{0}[{1}]", e.ErrorMessage, ""), Title = "System error" }); } }
private void EndOfLayerSelection(LayerListViewModel listViewModel) { if (listView.DialogResult.HasValue && listView.DialogResult.Value) { ArcGISMapLayer layer = listViewModel.LayerSelected; if (layer != null) { // Control layer is not on the map Layer mapLayer = gisOperations.GetMap().Layers.FirstOrDefault(l => l.ID.Equals(layer.Title)); if (mapLayer == null) gisOperations.AddNewDynamicLayer(layer.RESTURL, layer.VisibleInitial, layer.Title, gisOperations.GetLayerTocSelected(),layer.ServiceType); } } listView = null; }