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

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

            if (widgetConfig != null && widgetConfig.QueryLayers != null)
            {
                ArcGISQueryLayer[] queryLayers = widgetConfig.QueryLayers;
                queryLayerCount = queryLayers.Length;
                this.IsBusy     = true;

                for (int i = 0; i < queryLayers.Length; i++)
                {
                    ArcGISLayerInfo layerInfo = new ArcGISLayerInfo(queryLayers[i].RESTURL, OnLayerInfoReady);
                    lstAttQueryLayer.Items.Add(new ComboBoxItem()
                    {
                        Content = queryLayers[i].Title, Tag = layerInfo
                    });
                    lstGeoQueryLayer.Items.Add(new ComboBoxItem()
                    {
                        Content = queryLayers[i].Title, Tag = layerInfo
                    });
                }
            }
        }
        private void SearchLayer_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            txtAttQueryWhere.Text = "ST_ABBREV='KY' and NAME LIKE 'J%'";
            lstAttQueryField.Items.Clear();

            ComboBoxItem    item       = lstAttQueryLayer.SelectedItem as ComboBoxItem;
            ArcGISLayerInfo layerInfo  = item.Tag as ArcGISLayerInfo;
            ChartQueryLayer queryLayer = widgetConfig.ChartLayers[lstAttQueryLayer.SelectedIndex];

            if (layerInfo.IsReady)
            {
                string fieldType = "";

                if (!string.IsNullOrEmpty(queryLayer.QueryFields))
                {
                    string[] queryFields = queryLayer.QueryFields.Split(',');
                    foreach (ArcGISLayerField field in layerInfo.Fields)
                    {
                        if (queryFields.Contains(field.Name, StringComparer.CurrentCultureIgnoreCase))
                        {
                            fieldType = field.Type.Substring(13); // "esriFieldType".Length
                            lstAttQueryField.Items.Add(new ListBoxItem()
                            {
                                Content = string.Format("{0} ({1})", field.Name, fieldType), Tag = field, Height = 20
                            });
                        }
                    }
                }
                else
                {
                    foreach (ArcGISLayerField field in layerInfo.Fields)
                    {
                        fieldType = field.Type.Substring(13); // "esriFieldType".Length
                        if (!fieldType.Equals("Geometry") && !fieldType.Equals("Raster") && !fieldType.Equals("Blob"))
                        {
                            lstAttQueryField.Items.Add(new ListBoxItem()
                            {
                                Content = string.Format("{0} ({1})", field.Name, fieldType), Tag = field, Height = 20
                            });
                        }
                    }
                }
            }
        }
        protected override void OnDownloadConfigXMLCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            string xmlConfig = e.Result;

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

            if (widgetConfig != null && widgetConfig.ChartLayers != null)
            {
                ChartQueryLayer[] chartLayers = widgetConfig.ChartLayers;

                for (int i = 0; i < chartLayers.Length; i++)
                {
                    ArcGISLayerInfo layerInfo = new ArcGISLayerInfo(chartLayers[i].RESTURL);
                    lstAttQueryLayer.Items.Add(new ComboBoxItem()
                    {
                        Content = chartLayers[i].Title, Tag = layerInfo
                    });
                }
            }
        }
Example #4
0
        protected override void OnDownloadConfigXMLCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            string xmlConfig = e.Result;

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

            if (widgetConfig != null && widgetConfig.SearchLayers != null)
            {
                ArcGISQueryLayer[] searchLayers = widgetConfig.SearchLayers;

                for (int i = 0; i < searchLayers.Length; i++)
                {
                    ArcGISLayerInfo layerInfo = new ArcGISLayerInfo(searchLayers[i].RESTURL);
                    lstSearchLayer.Items.Add(new ComboBoxItem()
                    {
                        Content = searchLayers[i].Title, Tag = layerInfo
                    });
                }

                geometryService = new GeometryService(this.AppConfig.GeometryService);
                geometryService.BufferCompleted += new EventHandler <GraphicsEventArgs>(GeometryService_BufferCompleted);
            }
        }