void pWin_Closed(object sender, EventArgs e) { try { pWin = null; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } }
async void gpGroundComCov_JobCompleted(object sender, JobInfoEventArgs e) { try { Geoprocessor gpGroundComCov = sender as Geoprocessor; client.ArcGISDynamicMapServiceLayer gpLayer = gpGroundComCov.GetResultMapServiceLayer(e.JobInfo.JobId); gpLayer.ID = "GroundCommunicationCoverageMap"; gpLayer.Opacity = .50; _mapWidget.Map.Layers.Add(gpLayer); _mapWidget.Map.Layers.Add(_graphicsLayer); //get legend HttpClient client = new HttpClient(); string response = await client.GetStringAsync(_baseURL + "MapServer/legend?f=pjson"); XmlDocument doc = (XmlDocument)JsonConvert.DeserializeXmlNode(response); XmlNodeList xmlnode = doc.GetElementsByTagName("legend"); List <legend> pLegends = new List <legend>(); _dtLegends.Clear(); foreach (XmlNode node in xmlnode) { legend pLegend = new legend(); foreach (XmlNode child in node.ChildNodes) { if (child.Name == "label") { pLegend.label = child.InnerText; } if (child.Name == "url") { pLegend.url = _baseURL + "MapServer/1/images/" + child.InnerText; } } _dtLegends.Add(pLegend); } if (pWin == null) { pWin = new LegendDialog(); } pWin.ListView.DataContext = _dtLegends; pWin.Closed += pWin_Closed; pWin.Show(); pWin.Topmost = true; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("error in gpGroundComCov_JobCompleted: " + ex.Message); } }
async void gpGroundComCov_JobCompleted(object sender, JobInfoEventArgs e) { try { Geoprocessor gpGroundComCov = sender as Geoprocessor; client.ArcGISDynamicMapServiceLayer gpLayer = gpGroundComCov.GetResultMapServiceLayer(e.JobInfo.JobId); gpLayer.ID = "GroundCommunicationCoverageMap"; gpLayer.Opacity = .50; _mapWidget.Map.Layers.Add(gpLayer); _mapWidget.Map.Layers.Add(_graphicsLayer); //get legend HttpClient client = new HttpClient(); string response = await client.GetStringAsync(_baseURL + "MapServer/legend?f=pjson"); XmlDocument doc = (XmlDocument)JsonConvert.DeserializeXmlNode(response); XmlNodeList xmlnode = doc.GetElementsByTagName("legend"); List<legend> pLegends = new List<legend>(); _dtLegends.Clear(); foreach (XmlNode node in xmlnode) { legend pLegend = new legend(); foreach (XmlNode child in node.ChildNodes) { if (child.Name == "label") pLegend.label = child.InnerText; if (child.Name == "url") pLegend.url = _baseURL + "MapServer/1/images/" + child.InnerText; } _dtLegends.Add(pLegend); } if (pWin == null) pWin = new LegendDialog(); pWin.ListView.DataContext = _dtLegends; pWin.Closed += pWin_Closed; pWin.Show(); pWin.Topmost = true; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("error in gpGroundComCov_JobCompleted: " + ex.Message); } }