<?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 Re: Deactivate a map tool on sketch completed in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/deactivate-a-map-tool-on-sketch-completed/m-p/1370570#M11009</link>
    <description>&lt;P&gt;Got into the same issue, couldn't figure out that the deadlock was await's fault.&lt;/P&gt;&lt;P&gt;In any case it still works with the handler marked as async for those who need to keep it, you just need to take away the await statement from the call (even though intellisense will give a warning about it):&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;protected override async Task&amp;lt;bool&amp;gt; OnSketchCompleteAsync(Geometry geometry)
{
    //do something productive with the sketch and await 
    //all the calls needing to be awaited
    ArcGIS.Desktop.Framework.FrameworkApplication.SetCurrentToolAsync(null);
    return true;
}‍‍‍‍‍‍&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 16 Jan 2024 17:07:39 GMT</pubDate>
    <dc:creator>Asimov</dc:creator>
    <dc:date>2024-01-16T17:07:39Z</dc:date>
    <item>
      <title>Deactivate a map tool on sketch completed</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/deactivate-a-map-tool-on-sketch-completed/m-p/878882#M5567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a problem with deactivating my custom map tool when sketch is finished.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At now I'm trying to call&amp;nbsp;SetCurrentToolAsync from the&amp;nbsp;OnSketchCompleteAsync of my map tool. But this causes deadlock. Seems like I need to exit from&amp;nbsp;&lt;SPAN&gt;OnSketchCompleteAsync&amp;nbsp;to proceed with changing the current tool.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I want to deactivate the tool when sketch is completed. I didn't found any property in the MapTool class to specify this behavior. Is this possible?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Nov 2017 11:03:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/deactivate-a-map-tool-on-sketch-completed/m-p/878882#M5567</guid>
      <dc:creator>MaxMax2</dc:creator>
      <dc:date>2017-11-19T11:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: Deactivate a map tool on sketch completed</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/deactivate-a-map-tool-on-sketch-completed/m-p/878883#M5568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Max,&lt;/P&gt;&lt;P&gt;Try setting the applications current tool to null (or anything else).&lt;/P&gt;&lt;P&gt;If its null then 'explore' mode will be active.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;protected&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;override&lt;/SPAN&gt; Task&lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;bool&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;OnSketchCompleteAsync&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Geometry geometry&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;//do something productive with the sketch and deactivate&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ArcGIS&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Desktop&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Framework&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;FrameworkApplication&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;SetCurrentToolAsync&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;null&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;base&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;OnSketchCompleteAsync&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;geometry&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 11:03:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/deactivate-a-map-tool-on-sketch-completed/m-p/878883#M5568</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-12T11:03:38Z</dc:date>
    </item>
    <item>
      <title>Re: Deactivate a map tool on sketch completed</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/deactivate-a-map-tool-on-sketch-completed/m-p/878884#M5569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sean,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hmm, seems it works. I marked this method as async and used await for SetCurrentToolAsync, but it caused deadlock somehow.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Nov 2017 20:35:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/deactivate-a-map-tool-on-sketch-completed/m-p/878884#M5569</guid>
      <dc:creator>MaxMax2</dc:creator>
      <dc:date>2017-11-20T20:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: Deactivate a map tool on sketch completed</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/deactivate-a-map-tool-on-sketch-completed/m-p/1370570#M11009</link>
      <description>&lt;P&gt;Got into the same issue, couldn't figure out that the deadlock was await's fault.&lt;/P&gt;&lt;P&gt;In any case it still works with the handler marked as async for those who need to keep it, you just need to take away the await statement from the call (even though intellisense will give a warning about it):&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;protected override async Task&amp;lt;bool&amp;gt; OnSketchCompleteAsync(Geometry geometry)
{
    //do something productive with the sketch and await 
    //all the calls needing to be awaited
    ArcGIS.Desktop.Framework.FrameworkApplication.SetCurrentToolAsync(null);
    return true;
}‍‍‍‍‍‍&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 16 Jan 2024 17:07:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/deactivate-a-map-tool-on-sketch-completed/m-p/1370570#M11009</guid>
      <dc:creator>Asimov</dc:creator>
      <dc:date>2024-01-16T17:07:39Z</dc:date>
    </item>
  </channel>
</rss>

