private void comboBoxLayer_SelectedIndexChanged(object sender, EventArgs e) { string selectedLayerName = this.comboBoxLayer.SelectedItem.ToString(); if (!selectedLayerName.Equals("none")) { this.labelChooseLayer.Visible = false; string requestAddressCapabiliteies = ""; ReadOnlyCollection <Layer> layers = MapView.Active.Map.Layers; List <Layer> activeLayers = (layers.Where((layer) => { return(layer.IsVisible); })).ToList(); foreach (Layer activeLayer in activeLayers) { Task taskConnectionActiveLayer = QueuedTask.Run(() => { CIMDataConnection connection = activeLayer.GetDataConnection(); string typeConnections = connection.GetType().Name; if (typeConnections.Equals("CIMWMSServiceConnection") || typeConnections.Equals("CIMWMTSServiceConnection")) { XmlDocument xmlLayer = new XmlDocument(); xmlLayer.LoadXml(connection.ToXml()); string layerName = xmlLayer.SelectSingleNode(typeConnections + "/LayerName").InnerText; if (layerName.Equals(selectedLayerName)) { selestedLayerInfo.setLayerInfo(layerName, typeConnections, xmlLayer); requestAddressCapabiliteies = selestedLayerInfo.getRequestAddressCapabiliteies(); } } }); taskConnectionActiveLayer.Wait(); if (!requestAddressCapabiliteies.Equals("")) { if (selestedLayerInfo.serverType.Equals("WMTS")) { this.comboBoxResolution.Text = "90.71428571429"; this.comboBoxResolution.Enabled = false; this.labelOutputImageSPX.Visible = false; this.labelOutputIS.Visible = false; } else { this.comboBoxResolution.Text = "96"; this.comboBoxResolution.Enabled = true; this.labelOutputImageSPX.Visible = true; this.labelOutputIS.Visible = true; } addCRS(requestAddressCapabiliteies); if (correctCoordinateTopX && correctCoordinateTopX && correctCoordinateBottomX && correctCoordinateBottomY && correctScale) { buttonNext.Enabled = true; } else { buttonNext.Enabled = false; } break; } } } }