// *********************************************************************************** // * Query for the facilities is completed... populate facility type combobox // *********************************************************************************** void queryBufferLayer_ExecuteCompleted(ESRI.ArcGIS.OperationsDashboard.QueryResult result) { BufferTypes.Clear(); //set up facilities type dropdown BufferType resourceType = new BufferType(); resourceType.Name = "Select Type"; BufferTypes.Add(resourceType); if (result != null && result.Features.Count > 0) { foreach (client.Graphic graphic in result.Features) { if (graphic.Attributes[_bufferField] != null) { //string type = graphic.Attributes["MRPTYPE"].ToString(); string type = graphic.Attributes[_bufferField].ToString(); resourceType = new BufferType(); resourceType.Name = type; var resourceItem = BufferTypes.FirstOrDefault(item => item.Name == resourceType.Name); if (resourceItem == null) // none is found. { BufferTypes.Add(resourceType); } } } } else { System.Windows.MessageBox.Show("No features returned from query"); } }
// *********************************************************************************** // * User selected a facility type... query for that facility type // *********************************************************************************** private async void cmbFieldType_SelectionChanged(object sender, SelectionChangedEventArgs e) { BufferType resourceType = (BufferType)cmbFacility.SelectedItem; if (resourceType.Name == "Select Type") { return; } var query = new ESRI.ArcGIS.OperationsDashboard.Query(); query.WhereClause = _bufferField + "='" + resourceType.Name + "'"; query.ReturnGeometry = true; query.SpatialFilter = _mapWidget.Map.Extent; query.Fields = new string[] { "*" }; BufferLayer layer = (BufferLayer)cmbLayers.SelectedItem; var result = await layer.DataSource.ExecuteQueryAsync(query); if (result == null || result.Features == null) { return; } else { queryResourceType_ExecuteCompleted(result); } }
// *********************************************************************************** // * Query for the facilities is completed... populate facility type combobox // *********************************************************************************** void queryBufferLayer_ExecuteCompleted(ESRI.ArcGIS.OperationsDashboard.QueryResult result) { BufferTypes.Clear(); //set up facilities type dropdown BufferType resourceType = new BufferType(); resourceType.Name = "Select Type"; BufferTypes.Add(resourceType); if (result != null && result.Features.Count > 0) { foreach (client.Graphic graphic in result.Features) { if (graphic.Attributes[_bufferField] != null) { //string type = graphic.Attributes["MRPTYPE"].ToString(); string type = graphic.Attributes[_bufferField].ToString(); resourceType = new BufferType(); resourceType.Name = type; var resourceItem = BufferTypes.FirstOrDefault(item => item.Name == resourceType.Name); if (resourceItem == null) // none is found. BufferTypes.Add(resourceType); } } } else System.Windows.MessageBox.Show("No features returned from query"); }