<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic ArcGIS Pro Add-In how to pass data from a map tool's queued task to a dockpane in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-add-in-how-to-pass-data-from-a-map-tool/m-p/1332135#M73413</link>
    <description>&lt;P&gt;I tried to pass a heading to a dockpane but it returned the dockpane was null on ArcGIS Pro 3.11.&lt;/P&gt;&lt;P&gt;protected override Task&amp;lt;bool&amp;gt; OnSketchCompleteAsync(Geometry geometry)&lt;BR /&gt;{&lt;BR /&gt;// select the first point feature layer in the active map&lt;BR /&gt;var pointLayer = ActiveMapView.Map.GetLayersAsFlattenedList().OfType&amp;lt;FeatureLayer&amp;gt;().&lt;BR /&gt;Where(lyr =&amp;gt; lyr.ShapeType == esriGeometryType.esriGeometryPoint).FirstOrDefault();&lt;/P&gt;&lt;P&gt;if (pointLayer == null)&lt;BR /&gt;return Task.FromResult(true);&lt;BR /&gt;Dockpane2ViewModel.Show();&lt;/P&gt;&lt;P&gt;// execute the select on the MCT&lt;BR /&gt;QueuedTask.Run(() =&amp;gt;&lt;BR /&gt;{&lt;BR /&gt;// define the spatial query filter&lt;BR /&gt;var spatialQuery = new SpatialQueryFilter() { FilterGeometry = geometry, SpatialRelationship = SpatialRelationship.Intersects };&lt;/P&gt;&lt;P&gt;// gather the selection&lt;BR /&gt;var pointSelection = pointLayer.Select(spatialQuery);&lt;/P&gt;&lt;P&gt;List&amp;lt;long&amp;gt; oids = pointSelection.GetObjectIDs().ToList();&lt;BR /&gt;if (oids.Count == 0)&lt;BR /&gt;return;&lt;/P&gt;&lt;P&gt;// show the first selected item in the attribute inspector&lt;BR /&gt;var inspector = Module1.AttributeInspector;&lt;BR /&gt;inspector?.LoadAsync(pointLayer, oids[0]);&lt;/P&gt;&lt;P&gt;// update the heading&lt;BR /&gt;Module1.Pane2ViewModel.Heading = $@"Loaded [OID]:{oids[0]}";&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;return Task.FromResult(true);&amp;nbsp;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;on Module1&lt;/P&gt;&lt;P&gt;private static Dockpane2ViewModel _dockpane2ViewModel = null;&lt;/P&gt;&lt;P&gt;internal static Dockpane2ViewModel Pane2ViewModel&lt;BR /&gt;{&lt;BR /&gt;get { return _dockpane2ViewModel; }&lt;BR /&gt;set { _dockpane2ViewModel = value; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 25 Sep 2023 19:42:07 GMT</pubDate>
    <dc:creator>DENGD</dc:creator>
    <dc:date>2023-09-25T19:42:07Z</dc:date>
    <item>
      <title>ArcGIS Pro Add-In how to pass data from a map tool's queued task to a dockpane</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-add-in-how-to-pass-data-from-a-map-tool/m-p/1332135#M73413</link>
      <description>&lt;P&gt;I tried to pass a heading to a dockpane but it returned the dockpane was null on ArcGIS Pro 3.11.&lt;/P&gt;&lt;P&gt;protected override Task&amp;lt;bool&amp;gt; OnSketchCompleteAsync(Geometry geometry)&lt;BR /&gt;{&lt;BR /&gt;// select the first point feature layer in the active map&lt;BR /&gt;var pointLayer = ActiveMapView.Map.GetLayersAsFlattenedList().OfType&amp;lt;FeatureLayer&amp;gt;().&lt;BR /&gt;Where(lyr =&amp;gt; lyr.ShapeType == esriGeometryType.esriGeometryPoint).FirstOrDefault();&lt;/P&gt;&lt;P&gt;if (pointLayer == null)&lt;BR /&gt;return Task.FromResult(true);&lt;BR /&gt;Dockpane2ViewModel.Show();&lt;/P&gt;&lt;P&gt;// execute the select on the MCT&lt;BR /&gt;QueuedTask.Run(() =&amp;gt;&lt;BR /&gt;{&lt;BR /&gt;// define the spatial query filter&lt;BR /&gt;var spatialQuery = new SpatialQueryFilter() { FilterGeometry = geometry, SpatialRelationship = SpatialRelationship.Intersects };&lt;/P&gt;&lt;P&gt;// gather the selection&lt;BR /&gt;var pointSelection = pointLayer.Select(spatialQuery);&lt;/P&gt;&lt;P&gt;List&amp;lt;long&amp;gt; oids = pointSelection.GetObjectIDs().ToList();&lt;BR /&gt;if (oids.Count == 0)&lt;BR /&gt;return;&lt;/P&gt;&lt;P&gt;// show the first selected item in the attribute inspector&lt;BR /&gt;var inspector = Module1.AttributeInspector;&lt;BR /&gt;inspector?.LoadAsync(pointLayer, oids[0]);&lt;/P&gt;&lt;P&gt;// update the heading&lt;BR /&gt;Module1.Pane2ViewModel.Heading = $@"Loaded [OID]:{oids[0]}";&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;return Task.FromResult(true);&amp;nbsp;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;on Module1&lt;/P&gt;&lt;P&gt;private static Dockpane2ViewModel _dockpane2ViewModel = null;&lt;/P&gt;&lt;P&gt;internal static Dockpane2ViewModel Pane2ViewModel&lt;BR /&gt;{&lt;BR /&gt;get { return _dockpane2ViewModel; }&lt;BR /&gt;set { _dockpane2ViewModel = value; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2023 19:42:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-add-in-how-to-pass-data-from-a-map-tool/m-p/1332135#M73413</guid>
      <dc:creator>DENGD</dc:creator>
      <dc:date>2023-09-25T19:42:07Z</dc:date>
    </item>
  </channel>
</rss>

