ArcGIS Pro多线程

 protected async void SetActiveRecord()
    {
      #region Set the active record
          await QueuedTask.Run(async () =>
          {
            var layers = MapView.Active.Map.GetLayersAsFlattenedList();
            var myParcelFabricLayer = layers.FirstOrDefault(l => l is ParcelLayer) as ParcelLayer;
            var recordsLayer = layers.FirstOrDefault(l => l.Name == "Records" && l is FeatureLayer);
            string sExistingRecord = "MyRecordName";
            
            var pFeatClass = (recordsLayer as FeatureLayer).GetFeatureClass();
            QueryFilter queryFilter = new QueryFilter
            {
              WhereClause = "Name = '" + sExistingRecord + "'"
            };
            Guid guid = new Guid();
            long lOID = -1;

            using (RowCursor rowCursor = pFeatClass.Search(queryFilter, false))
            {
              while (rowCursor.MoveNext())
              {
                using (Row row = rowCursor.Current)
                {
                  guid = row.GetGlobalID();
                  long oid = row.GetObjectID();
                }
              }
            }

            var parcelRecord=new ParcelRecord(myParcelFabricLayer.Map, sExistingRecord, guid, lOID);
            await myParcelFabricLayer.SetActiveRecord(parcelRecord);
          });
      #endregion
    }

 

你可能感兴趣的:(ArcGIS Pro多线程)