void pWin_Closed(object sender, EventArgs e) { try { pWin = null; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } }
async void gpFarthest_JobCompleted(object sender, JobInfoEventArgs e) { try { Geoprocessor gpFOC = sender as Geoprocessor; client.ArcGISDynamicMapServiceLayer gpLayer = gpFOC.GetResultMapServiceLayer(e.JobInfo.JobId); gpLayer.ID = "Farthest On Circle"; gpLayer.Opacity = .65; _mapWidget.Map.Layers.Add(gpLayer); //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>(); int count = 0; double test = System.Convert.ToInt16(Range.Text) / System.Convert.ToInt16(Speed.Text); int theval = System.Convert.ToInt16(test); _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 + " Hours of Transit"; } if (child.Name == "url") { pLegend.url = _baseURL + "MapServer/1/images/" + child.InnerText; } } if (count <= theval && count < 24) { _dtLegends.Add(pLegend); } count++; } 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(ex.Message); } }
async void gpFarthest_JobCompleted(object sender, JobInfoEventArgs e) { try { Geoprocessor gpFOC = sender as Geoprocessor; client.ArcGISDynamicMapServiceLayer gpLayer = gpFOC.GetResultMapServiceLayer(e.JobInfo.JobId); gpLayer.ID = "Farthest On Circle"; gpLayer.Opacity = .65; _mapWidget.Map.Layers.Add(gpLayer); //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>(); int count = 0; double test = System.Convert.ToInt16(Range.Text) / System.Convert.ToInt16(Speed.Text); int theval = System.Convert.ToInt16(test); _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 + " Hours of Transit"; if (child.Name == "url") pLegend.url = _baseURL + "MapServer/1/images/" + child.InnerText; } if (count <= theval && count < 24) _dtLegends.Add(pLegend); count++; } 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(ex.Message); } }