本文整理汇总了C#中QueryTask.ExecuteRelationshipQueryAsync方法的典型用法代码示例。如果您正苦于以下问题:C# QueryTask.ExecuteRelationshipQueryAsync方法的具体用法?C# QueryTask.ExecuteRelationshipQueryAsync怎么用?C# QueryTask.ExecuteRelationshipQueryAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryTask
的用法示例。
在下文中一共展示了QueryTask.ExecuteRelationshipQueryAsync方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WellsGrid_SelectionChanged
// Query for rows related to the selected well in the wells list view
private async void WellsGrid_SelectionChanged(object sender, Windows.UI.Xaml.Controls.SelectionChangedEventArgs e)
{
try
{
if (e.AddedItems != null && e.AddedItems.Count > 0)
{
QueryTask queryTask =
new QueryTask(new Uri("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSPetro/MapServer/0"));
//Relationship query
var objectIds = e.AddedItems.OfType<Graphic>()
.Select(g => Convert.ToInt64(g.Attributes["OBJECTID"]));
RelationshipParameter parameters = new RelationshipParameter(new List<long>(objectIds), 3)
{
OutSpatialReference = mapView.SpatialReference
};
parameters.OutFields.AddRange(new string[] { "OBJECTID, API_NUMBER, ELEVATION, FORMATION, TOP" });
var result = await queryTask.ExecuteRelationshipQueryAsync(parameters);
relationshipsGrid.ItemsSource = result.RelatedRecordGroups.FirstOrDefault().Value;
}
}
catch (Exception ex)
{
var _ = new MessageDialog(ex.Message, "Sample Error").ShowAsync();
}
}
示例2: QueryRelatedRecordsAsync
/// <summary>
/// Queries related records for specified feature ID.
/// </summary>
private async Task QueryRelatedRecordsAsync()
{
var featureID = (Int64)AddButton.Tag;
var layer = MyMapView.Map.Layers["ServiceRequests"] as ArcGISDynamicMapServiceLayer;
var id = layer.VisibleLayers.FirstOrDefault();
var task = new QueryTask(new Uri(string.Format("{0}/{1}", layer.ServiceUri, id)));
if (relationship == null)
relationship = await GetRelationshipAsync();
var parameters = new RelationshipParameters(new List<long>(new long[] { featureID }), relationship.ID);
parameters.OutFields = new OutFields(new string[] { "objectid" });
var result = await task.ExecuteRelationshipQueryAsync(parameters);
if (result != null && result.RelatedRecordGroups != null && result.RelatedRecordGroups.ContainsKey(featureID))
{
RelatedRecords.ItemsSource = result.RelatedRecordGroups[featureID];
Records.IsEnabled = true;
}
}
示例3: doRelationshipQuery
// Query for well tops related to wells with the passed-in object ID
private async Task<RelationshipResult> doRelationshipQuery(int oid)
{
QueryTask queryTask =
new QueryTask(new Uri("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSPetro/MapServer/0"));
// Initialize relationship parameters
RelationshipParameter parameters = new RelationshipParameter(new long[] { oid }, 3)
{
OutSpatialReference = m_mapView.SpatialReference,
OutFields = new OutFields(new string[] { "OBJECTID, API_NUMBER, FORMATION, TOP" })
};
try
{
// Do the relationship query and return the result
return await queryTask.ExecuteRelationshipQueryAsync(parameters);
}
catch
{
return null;
}
}
示例4: RunRelationshipQuery
private async Task RunRelationshipQuery(IEnumerable<int> objectIds)
{
QueryTask queryTask =
new QueryTask(new Uri("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSPetro/MapServer/0"));
//Relationship query
RelationshipParameter parameters = new RelationshipParameter()
{
ObjectIDs = new List<int>(objectIds),
RelationshipID = 3,
OutSpatialReference = MyMap.SpatialReference
};
parameters.OutFields.AddRange(new string[] { "OBJECTID, API_NUMBER, ELEVATION, FORMATION, TOP" });
var result = await queryTask.ExecuteRelationshipQueryAsync(parameters);
RelationshipResultsGrid.ItemsSource = result.RelatedRecordGroups.FirstOrDefault().Value;
}