Example #1
0
        private void gpSateEphemeris_JobCompleted(object sender, JobInfoEventArgs e)
        {
            try
            {
                if (_graphicsLayerPoly == null)
                {
                    _graphicsLayerPoly    = new client.GraphicsLayer();
                    _graphicsLayerPoly.ID = "SensorFootprints";
                    client.AcceleratedDisplayLayers aclyrs = _mapWidget.Map.Layers.FirstOrDefault(lyr => lyr is client.AcceleratedDisplayLayers) as client.AcceleratedDisplayLayers;
                    if (aclyrs.Count() > 0)
                    {
                        aclyrs.ChildLayers.Add(_graphicsLayerPoly);
                    }
                }
                else
                {
                    _graphicsLayerPoly.Graphics.Clear();
                }
                if (_graphicsLayerLine == null)
                {
                    _graphicsLayerLine    = new client.GraphicsLayer();
                    _graphicsLayerLine.ID = "EphemerisLines";
                    client.AcceleratedDisplayLayers aclyrs = _mapWidget.Map.Layers.FirstOrDefault(lyr => lyr is client.AcceleratedDisplayLayers) as client.AcceleratedDisplayLayers;
                    if (aclyrs.Count() > 0)
                    {
                        aclyrs.ChildLayers.Add(_graphicsLayerLine);
                    }
                }
                else
                {
                    _graphicsLayerLine.Graphics.Clear();
                }
                if (_graphicsLayerPoint == null)
                {
                    _graphicsLayerPoint    = new client.GraphicsLayer();
                    _graphicsLayerPoint.ID = "EphemerisPoints";
                    client.AcceleratedDisplayLayers aclyrs = _mapWidget.Map.Layers.FirstOrDefault(lyr => lyr is client.AcceleratedDisplayLayers) as client.AcceleratedDisplayLayers;
                    if (aclyrs.Count() > 0)
                    {
                        aclyrs.ChildLayers.Add(_graphicsLayerPoint);
                    }
                }
                else
                {
                    _graphicsLayerPoint.Graphics.Clear();
                }
                ResourceDictionary mydictionary = new ResourceDictionary();
                mydictionary.Source = new Uri("/SatelliteEphemerisGenerationAddin;component/SymbolDictionary.xaml", UriKind.RelativeOrAbsolute);

                gp     = sender as Geoprocessor;
                _jobid = e.JobInfo.JobId;
                gp.GetResultDataAsync(e.JobInfo.JobId, "SensorFootprints", "Footprints");
                gp.GetResultDataCompleted += gp_GetResultDataCompleted;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message);
            }
        }
Example #2
0
        async void gpAircraftComms_JobCompleted(object sender, JobInfoEventArgs e)
        {
            try
            {
                if (_graphicsLayerPoly != null)
                {
                    _graphicsLayerPoly.Graphics.Clear();
                }

                Geoprocessor gpAircraftComCov = sender as Geoprocessor;
                client.ArcGISDynamicMapServiceLayer gpLayer = gpAircraftComCov.GetResultMapServiceLayer(e.JobInfo.JobId);
                gpLayer.ID      = "AircraftCommunicationCoverageMap";
                gpLayer.Opacity = .65;

                _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(ex.Message);
            }
        }
 private void GeoprocessorTask_JobCompleted(object sender, JobInfoEventArgs e)
 {
     jobid = null;
     if (e.JobInfo.JobStatus == esriJobStatus.esriJobSucceeded)
     {
         _geoprocessorTask.GetResultDataAsync(e.JobInfo.JobId, "ServiceAreas");
     }
 }
 void _geoprocessorTask_JobCompleted(object sender, JobInfoEventArgs e)
 {
     if (e.JobInfo.JobStatus != esriJobStatus.esriJobSucceeded)
     {
         MessageBox.Show("Extract Data task failed to complete");
         return;
     }
     _geoprocessorTask.GetResultDataAsync(e.JobInfo.JobId, "Output_Zip_File");
 }
Example #5
0
        // ***********************************************************************************
        // * ... Nearest weather station located... get the wind info from this station
        // ***********************************************************************************
        // ***********************************************************************************
        // * ..ERG Placard GP Tool Job Completed
        // ***********************************************************************************
        private void findNearestWSGPTask_JobCompleted(object sender, JobInfoEventArgs e)
        {
            Geoprocessor geoprocessorTask = sender as Geoprocessor;

            geoprocessorTask.GetResultDataCompleted += findNearestWSGPTask_GetResultDataCompleted;
            geoprocessorTask.Failed += new EventHandler <TaskFailedEventArgs>(GeoprocessorTask_Failed);

            _gpJobId = e.JobInfo.JobId;
            geoprocessorTask.GetResultDataAsync(e.JobInfo.JobId, "SACPoint_shp");
        }
Example #6
0
        // ***********************************************************************************
        // * ..ERGChemcial GP Tool Job Completed
        // ***********************************************************************************
        private void ergChemicalGeoprocessorTask_JobCompleted(object sender, JobInfoEventArgs e)
        {
            Geoprocessor geoprocessorTask = sender as Geoprocessor;

            geoprocessorTask.GetResultDataCompleted += ergGPTask_GetResultDataCompleted;
            geoprocessorTask.Failed += new EventHandler <TaskFailedEventArgs>(GeoprocessorTask_Failed);

            _gpJobId = e.JobInfo.JobId;
            geoprocessorTask.GetResultDataAsync(e.JobInfo.JobId, "output_areas");
        }
Example #7
0
            public Task StopAsync()
            {
                Status = WorkerStatus.Stopping;
                var args = new JobInfoEventArgs(new JobInfoModel());

                OnJobCanceled?.Invoke(this, args);

                Status = WorkerStatus.Stopped;
                return(Task.Delay(1));
            }
Example #8
0
            public Task StartAsync()
            {
                Status = WorkerStatus.WaitingForJob;
                var args = new JobInfoEventArgs(new JobInfoModel());

                OnJobStarted?.Invoke(this, args);
                Status = WorkerStatus.ProcessingJob;
                Task.Delay(10);
                OnJobCompleted?.Invoke(this, args);
                return(Task.Delay(1));
            }
        private void GeoprocessorTask_JobCompleted(object sender, JobInfoEventArgs e)
        {
            jobid = null;

            InformationText.Text = descText;

            if (e.JobInfo.JobStatus == esriJobStatus.esriJobSucceeded)
                _geoprocessorTask.GetResultDataAsync(e.JobInfo.JobId, "ServiceAreas");
            if (e.JobInfo.JobStatus == esriJobStatus.esriJobFailed)
                MessageBox.Show("Geoprocessing service failed! Check the Geoproccessing Parameters.");
        }
 void GeoprocessorTask_StatusUpdated(object sender, JobInfoEventArgs e)
 {
     jobid = e.JobInfo.JobStatus == esriJobStatus.esriJobCancelled ||
         e.JobInfo.JobStatus == esriJobStatus.esriJobDeleted ||
         e.JobInfo.JobStatus == esriJobStatus.esriJobFailed
         ? null : e.JobInfo.JobId;
     if (e.JobInfo.JobStatus == esriJobStatus.esriJobCancelling && inputPoint != null)
     {
         SubmitJob(inputPoint);
         inputPoint = null;
     }
 }
 void GeoprocessorTask_StatusUpdated(object sender, JobInfoEventArgs e)
 {
     jobid = e.JobInfo.JobStatus == esriJobStatus.esriJobCancelled ||
             e.JobInfo.JobStatus == esriJobStatus.esriJobDeleted ||
             e.JobInfo.JobStatus == esriJobStatus.esriJobFailed
         ? null : e.JobInfo.JobId;
     if (e.JobInfo.JobStatus == esriJobStatus.esriJobCancelling && inputPoint != null)
     {
         SubmitJob(inputPoint);
         inputPoint = null;
     }
 }
Example #12
0
 private void gpAircraftRouteGen_JobCompleted(object sender, JobInfoEventArgs e)
 {
     try
     {
         Geoprocessor gpAircraftRouteGen = sender as Geoprocessor;
         gpAircraftRouteGen.GetResultDataCompleted += gp_GetResultDataCompleted;
         gpAircraftRouteGen.GetResultDataAsync(e.JobInfo.JobId, "Computed_Points");
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error: " + ex.Message);
     }
 }
Example #13
0
        private void GeoprocessorTask_JobCompleted(object sender, JobInfoEventArgs e)
        {
            jobid = null;

            InformationText.Text = descText;

            if (e.JobInfo.JobStatus == esriJobStatus.esriJobSucceeded)
            {
                _geoprocessorTask.GetResultDataAsync(e.JobInfo.JobId, "ServiceAreas");
            }
            if (e.JobInfo.JobStatus == esriJobStatus.esriJobFailed)
            {
                MessageBox.Show("Geoprocessing service failed! Check the Geoproccessing Parameters.");
            }
        }
        void GeoprocessorTask_StatusUpdated(object sender, JobInfoEventArgs e)
        {
            if(InformationText.Text.Length > 102)
                InformationText.Text = descText + "\n\nProcessing";
            else
                InformationText.Text += ".";

            jobid = e.JobInfo.JobStatus == esriJobStatus.esriJobCancelled ||
                e.JobInfo.JobStatus == esriJobStatus.esriJobDeleted ||
                e.JobInfo.JobStatus == esriJobStatus.esriJobFailed
                ? null : e.JobInfo.JobId;
            if (e.JobInfo.JobStatus == esriJobStatus.esriJobCancelling && inputPoint != null)
            {
                SubmitJob(inputPoint);
                inputPoint = null;
            }
        }
        private void GPService_JobCompleted(object sender, JobInfoEventArgs e)
        {
            this.IsBusy = false;
            this.ToggleWidgetContent(1);
            txtExtractionStatus.Visibility = Visibility.Collapsed;

            if (e.JobInfo.JobStatus == esriJobStatus.esriJobSucceeded)
            {
                lnkExtractionOutput.Visibility = Visibility.Visible;
                txtJobErrorMessage.Visibility  = Visibility.Collapsed;
                gpService.GetResultDataAsync(e.JobInfo.JobId, "Output_Zip_File"); // parameterName
            }
            else
            {
                txtJobErrorMessage.Text        = e.JobInfo.Messages[0].Description;
                txtJobErrorMessage.Visibility  = Visibility.Visible;
                lnkExtractionOutput.Visibility = Visibility.Collapsed;
            }
        }
Example #16
0
        void GeoprocessorTask_StatusUpdated(object sender, JobInfoEventArgs e)
        {
            if (InformationText.Text.Length > 102)
            {
                InformationText.Text = descText + "\n\nProcessing";
            }
            else
            {
                InformationText.Text += ".";
            }

            jobid = e.JobInfo.JobStatus == esriJobStatus.esriJobCancelled ||
                    e.JobInfo.JobStatus == esriJobStatus.esriJobDeleted ||
                    e.JobInfo.JobStatus == esriJobStatus.esriJobFailed
                ? null : e.JobInfo.JobId;
            if (e.JobInfo.JobStatus == esriJobStatus.esriJobCancelling && inputPoint != null)
            {
                SubmitJob(inputPoint);
                inputPoint = null;
            }
        }
        private void GeoprocessorTask_JobCompleted(object sender, JobInfoEventArgs e)
        {
            Geoprocessor geoprocessorTask = sender as Geoprocessor;

              geoprocessorTask.GetResultDataCompleted += (s1, ev1) =>
              {
            GraphicsLayer graphicsLayer = MyMap.Layers["MyResultGraphicsLayer"] as GraphicsLayer;

            if (ev1.Parameter is GPFeatureRecordSetLayer)
            {
              GPFeatureRecordSetLayer gpLayer = ev1.Parameter as GPFeatureRecordSetLayer;
              if (gpLayer.FeatureSet.Features.Count == 0)
              {
            geoprocessorTask.GetResultImageLayerCompleted += (s2, ev2) =>
            {
              GPResultImageLayer gpImageLayer = ev2.GPResultImageLayer;
              gpImageLayer.Opacity = 0.5;
              MyMap.Layers.Add(gpImageLayer);

              ProcessingTextBlock.Text = "Greater than 500 features returned.  Results drawn using map service.";
              _processingTimer.Stop();
            };

            geoprocessorTask.GetResultImageLayerAsync(e.JobInfo.JobId, "Clipped_Counties");
            return;
              }

              foreach (Graphic graphic in gpLayer.FeatureSet.Features)
              {
            graphic.Symbol = LayoutRoot.Resources["ClipFeaturesFillSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
            graphicsLayer.Graphics.Add(graphic);
              }
            }

            ProcessingTextBlock.Visibility = Visibility.Collapsed;
            _processingTimer.Stop();
              };

              geoprocessorTask.GetResultDataAsync(e.JobInfo.JobId, "Clipped_Counties");
        }
        private void GeoprocessorTask_JobCompleted(object sender, JobInfoEventArgs e)
        {
            Geoprocessor geoprocessorTask = sender as Geoprocessor;

            geoprocessorTask.GetResultDataCompleted += (s1, ev1) =>
            {
                GraphicsLayer graphicsLayer = MyMap.Layers["MyResultGraphicsLayer"] as GraphicsLayer;

                if (ev1.Parameter is GPFeatureRecordSetLayer)
                {
                    GPFeatureRecordSetLayer gpLayer = ev1.Parameter as GPFeatureRecordSetLayer;
                    if (gpLayer.FeatureSet.Features.Count == 0)
                    {
                        geoprocessorTask.GetResultImageLayerCompleted += (s2, ev2) =>
                        {
                            GPResultImageLayer gpImageLayer = ev2.GPResultImageLayer;
                            gpImageLayer.Opacity = 0.5;
                            MyMap.Layers.Add(gpImageLayer);

                            ProcessingTextBlock.Text = "Greater than 500 features returned.  Results drawn using map service.";
                            _processingTimer.Stop();
                        };

                        geoprocessorTask.GetResultImageLayerAsync(e.JobInfo.JobId, "Clipped_Counties");
                        return;
                    }

                    foreach (Graphic graphic in gpLayer.FeatureSet.Features)
                    {
                        graphic.Symbol = LayoutRoot.Resources["ClipFeaturesFillSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;
                        graphicsLayer.Graphics.Add(graphic);
                    }
                }

                ProcessingTextBlock.Visibility = Visibility.Collapsed;
                _processingTimer.Stop();
            };

            geoprocessorTask.GetResultDataAsync(e.JobInfo.JobId, "Clipped_Counties");
        }
        private void GeoprocessorTask_JobCompleted(object sender, JobInfoEventArgs e)
        {
            MyMap.Cursor = System.Windows.Input.Cursors.Hand;
              if (e.JobInfo.JobStatus == esriJobStatus.esriJobSucceeded)
              {
            Geoprocessor geoprocessorTask = sender as Geoprocessor;

            System.Threading.Thread.Sleep(2000);

            resultLayer = geoprocessorTask.GetResultMapServiceLayer(e.JobInfo.JobId);
            resultLayer.InitializationFailed += new EventHandler<EventArgs>(resultLayer_InitializationFailed);
            resultLayer.DisplayName = e.JobInfo.JobId;
            if (resultLayer != null)
            {
              _displayViewshedInfo = true;
              MyMap.Layers.Add(resultLayer);
            }
              }
              else
              {
            MessageBox.Show("Geoprocessor service failed");
            _displayViewshedInfo = false;
              }
        }
Example #20
0
        private void GeoprocessorTask_JobCompleted(object sender, JobInfoEventArgs e)
        {
            MyMap.Cursor = System.Windows.Input.Cursors.Hand;
            if (e.JobInfo.JobStatus == esriJobStatus.esriJobSucceeded)
            {
                Geoprocessor geoprocessorTask = sender as Geoprocessor;

                System.Threading.Thread.Sleep(2000);

                resultLayer = geoprocessorTask.GetResultMapServiceLayer(e.JobInfo.JobId);
                resultLayer.InitializationFailed += new EventHandler <EventArgs>(resultLayer_InitializationFailed);
                resultLayer.DisplayName           = e.JobInfo.JobId;
                if (resultLayer != null)
                {
                    _displayViewshedInfo = true;
                    MyMap.Layers.Add(resultLayer);
                }
            }
            else
            {
                MessageBox.Show("Geoprocessor service failed");
                _displayViewshedInfo = false;
            }
        }
        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);
            }
        }
        // ***********************************************************************************
        // * ..ERGChemcial GP Tool Job Completed  
        // ***********************************************************************************
        private void ergChemicalGeoprocessorTask_JobCompleted(object sender, JobInfoEventArgs e)
        {
            Geoprocessor geoprocessorTask = sender as Geoprocessor;
            geoprocessorTask.GetResultDataCompleted += ergGPTask_GetResultDataCompleted;
            geoprocessorTask.Failed += new EventHandler<TaskFailedEventArgs>(GeoprocessorTask_Failed);

            _gpJobId = e.JobInfo.JobId;
            geoprocessorTask.GetResultDataAsync(e.JobInfo.JobId, "output_areas");
        }
        // ***********************************************************************************
        // * ... Nearest weather station located... get the wind info from this station   
        // ***********************************************************************************
        // ***********************************************************************************
        // * ..ERG Placard GP Tool Job Completed  
        // ***********************************************************************************
        private void findNearestWSGPTask_JobCompleted(object sender, JobInfoEventArgs e)
        {
            Geoprocessor geoprocessorTask = sender as Geoprocessor;
            geoprocessorTask.GetResultDataCompleted += findNearestWSGPTask_GetResultDataCompleted;
            geoprocessorTask.Failed += new EventHandler<TaskFailedEventArgs>(GeoprocessorTask_Failed);

            _gpJobId = e.JobInfo.JobId;
            geoprocessorTask.GetResultDataAsync(e.JobInfo.JobId, "SACPoint_shp");
        }
		/// <summary>		
		/// This event is used to display status messages from an asynchronous-server when printing with ArcGIS server.
		/// </summary>
		private void PrintTask_StatusUpdated(object sender, JobInfoEventArgs e)
		{
			IsBusy = printTask.IsBusy;
			if (e.JobInfo != null)
			{
				var sb = new StringBuilder();
				sb.AppendFormat("{0}", e.JobInfo.JobStatus);
				if (e.JobInfo.Messages != null)
				{
                    foreach (var m in e.JobInfo.Messages)
						sb.AppendFormat("\n\n{0}: {1}", m.MessageType, m.Description);
				}
				Status = sb.ToString();
			}
		}
        async void gpAircraftComms_JobCompleted(object sender, JobInfoEventArgs e)
        {
            try
            {
                if (_graphicsLayerPoly != null)
                    _graphicsLayerPoly.Graphics.Clear();

                Geoprocessor gpAircraftComCov = sender as Geoprocessor;
                client.ArcGISDynamicMapServiceLayer gpLayer = gpAircraftComCov.GetResultMapServiceLayer(e.JobInfo.JobId);
                gpLayer.ID = "AircraftCommunicationCoverageMap";
                gpLayer.Opacity = .65;

                _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(ex.Message);
            }
        }
 private void GeoprocessorTask_JobCompleted(object sender, JobInfoEventArgs e)
 {
     jobid = null;
     if (e.JobInfo.JobStatus == esriJobStatus.esriJobSucceeded)
         _geoprocessorTask.GetResultDataAsync(e.JobInfo.JobId, "ServiceAreas");
 }
 void _geoprocessorTask_JobCompleted(object sender, JobInfoEventArgs e)
 {
     if (e.JobInfo.JobStatus != esriJobStatus.esriJobSucceeded)
     {
         MessageBox.Show("Extract Data task failed to complete");
         return;
     }
     _geoprocessorTask.GetResultDataAsync(e.JobInfo.JobId, "Output_Zip_File");
 }
        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);
            }
        }
 private void gpAircraftRouteGen_JobCompleted(object sender, JobInfoEventArgs e)
 {
     try
     {
         Geoprocessor gpAircraftRouteGen = sender as Geoprocessor;
         gpAircraftRouteGen.GetResultDataCompleted += gp_GetResultDataCompleted;
         gpAircraftRouteGen.GetResultDataAsync(e.JobInfo.JobId, "Computed_Points");
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error: " + ex.Message);
     }
 }