protected override void OnDownloadConfigXMLCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            string xmlConfig = e.Result;

            widgetConfig = (DataExtractionConfig)DataExtractionConfig.Deserialize(xmlConfig, typeof(DataExtractionConfig));

            if (widgetConfig != null)
            {
                this.IsBusy       = true;
                this.clipByExtent = widgetConfig.AOISelectionMethod.Equals("extent", StringComparison.CurrentCultureIgnoreCase);

                if (clipByExtent)
                {
                    DrawModeButtonStack.Visibility = System.Windows.Visibility.Collapsed;
                    txtDrawModeStatus.Text         = "The map extent is used as the area of interest";
                }

                foreach (DataExtractionService service in widgetConfig.DataExtractionServices)
                {
                    DataExtractionServiceInfo serviceInfo = new DataExtractionServiceInfo(service.restURL, OnDataExtractionServiceInfoReady);
                    ComboBoxItem serviceItem = new ComboBoxItem()
                    {
                        Tag = serviceInfo, Content = service.title
                    };
                    lstExtractionService.Items.Add(serviceItem);
                }
            }
        }
        private void ExtrationService_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBoxItem serviceItem = e.AddedItems[0] as ComboBoxItem;
            DataExtractionServiceInfo serviceInfo = serviceItem.Tag as DataExtractionServiceInfo;

            if (serviceInfo != null && serviceInfo.IsReady)
            {
                gpService.Url = serviceInfo.ServiceUrl;
                EsriGPExecutionType exeType = (EsriGPExecutionType)Enum.Parse(typeof(EsriGPExecutionType), serviceInfo.ExecutionType, true);

                foreach (GPServiceParameter gpParam in serviceInfo.Parameters)
                {
                    if (gpParam.Name == "Layers_to_Clip")
                    {
                        List <CheckBox> checkList = new List <CheckBox>();
                        foreach (string choice in gpParam.ChoiceList)
                        {
                            CheckBox check = new CheckBox()
                            {
                                Content = choice
                            };
                            check.Click += ExtractionLayerCheckBox_Click;
                            checkList.Add(check);
                        }

                        lstLayersToClip.ItemsSource = checkList;
                        exposeLayers = true;
                    }
                    else if (gpParam.Name == "Feature_Format")
                    {
                        lstFeatureFormat.ItemsSource   = gpParam.ChoiceList;
                        lstFeatureFormat.SelectedIndex = 0;
                    }
                    else if (gpParam.Name == "Raster_Format")
                    {
                        lstRasterformat.ItemsSource   = gpParam.ChoiceList;
                        lstRasterformat.SelectedIndex = 0;
                    }
                }
            }
        }