当前位置: 首页>>代码示例>>C#>>正文


C# QueryTask.ExecuteRelationshipQueryAsync方法代码示例

本文整理汇总了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();
            }
        }
开发者ID:KrisFoster44,项目名称:arcgis-runtime-samples-dotnet,代码行数:30,代码来源:QueryRelatedTables.xaml.cs

示例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;
     }
 }
开发者ID:pdiddyb,项目名称:arcgis-runtime-samples-dotnet,代码行数:20,代码来源:EditRelatedData.xaml.cs

示例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;
            }
        }
开发者ID:rlwarford,项目名称:arcgis-runtime-samples-dotnet,代码行数:24,代码来源:QueryRelatedRecords.xaml.cs

示例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;
        }
开发者ID:jorik041,项目名称:arcgis-samples-winstore,代码行数:16,代码来源:QueryRelatedRecords.xaml.cs


注:本文中的QueryTask.ExecuteRelationshipQueryAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。