<?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: Add-in button with iCommand calling interactive tool in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/add-in-button-with-icommand-calling-interactive/m-p/1557176#M12276</link>
    <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is no way to determine when a button has finished executing like you're attempting to do.&amp;nbsp; &amp;nbsp;However when it comes to edit operations, you can determine when an edit has occurred by using the edit events.&amp;nbsp; &amp;nbsp;See this documentation.&amp;nbsp; &amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Editing#edit-events" target="_blank"&gt;https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Editing#edit-events&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;In your case you would need to subscribe to the row Events to determine when the Divide operation has completed and add your custom attribute updates within that event.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Narelle&lt;/P&gt;</description>
    <pubDate>Mon, 11 Nov 2024 01:59:06 GMT</pubDate>
    <dc:creator>NarelleChedzey</dc:creator>
    <dc:date>2024-11-11T01:59:06Z</dc:date>
    <item>
      <title>Add-in button with iCommand calling interactive tool</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/add-in-button-with-icommand-calling-interactive/m-p/1556334#M12266</link>
      <description>&lt;P&gt;Greetings!&lt;BR /&gt;&lt;BR /&gt;I'm trying to re-create an ArcMap add-in in Pro that opens the Divide command frame, and then executes some custom attribute updates after the user divides a polyline.&amp;nbsp; The button opens the Divide tool, but doesn't wait for user interaction before executing additional code.&amp;nbsp; How do I get the button to wait for a successful divide operation before executing the custom code?&lt;/P&gt;&lt;P&gt;Thanks!&lt;BR /&gt;&lt;BR /&gt;Here's my add-in structure (with a message box replacing the custom code):&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;protected override void OnClick()
{
    QueuedTask.Run(() =&amp;gt;
    {
        // ArcGIS Pro Command's DAML ID. 
        var commandId = "esri_editing_DivideCommand";
        // get the ICommand interface from the ArcGIS Pro Button
        // using command's plug-in wrapper
        var iCommand = FrameworkApplication.GetPlugInWrapper(commandId) as ICommand;
        if (iCommand != null)
        {
            // Let ArcGIS Pro do the work for us
            if (iCommand.CanExecute(null))
            {
                iCommand.Execute(null);
                MessageBox.Show("Any custom code written here executes without waiting for the user to divide a polyline");
            }
        }
        MessageBox.Show("iCommand is done");
    });
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2024 15:48:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/add-in-button-with-icommand-calling-interactive/m-p/1556334#M12266</guid>
      <dc:creator>KerryAlley</dc:creator>
      <dc:date>2024-11-07T15:48:50Z</dc:date>
    </item>
    <item>
      <title>Re: Add-in button with iCommand calling interactive tool</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/add-in-button-with-icommand-calling-interactive/m-p/1556817#M12271</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;There is no need to use QueuedTask.Run. GetPlugInWrapper doesn't need MCT thread&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;        protected override void OnClick()
        {
            // ArcGIS Pro Command's DAML ID. 
            var commandId = "esri_editing_DivideCommand";
            // get the ICommand interface from the ArcGIS Pro Button
            // using command's plug-in wrapper
            var iCommand = FrameworkApplication.GetPlugInWrapper(commandId) as ICommand;
            if (iCommand != null)
            {
                // Let ArcGIS Pro do the work for us
                if (iCommand.CanExecute(null))
                {
                    iCommand.Execute(null);
                    MessageBox.Show("Any custom code written here executes without waiting for the user to divide a polyline");
                }
            }
            MessageBox.Show("iCommand is done");
        }
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2024 15:10:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/add-in-button-with-icommand-calling-interactive/m-p/1556817#M12271</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2024-11-08T15:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: Add-in button with iCommand calling interactive tool</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/add-in-button-with-icommand-calling-interactive/m-p/1556925#M12272</link>
      <description>&lt;P&gt;My custom code requires the MCT thread, but I can start the QueuedTask after the iCommand.Execute and the MessageBox.&lt;/P&gt;&lt;P&gt;But I'm still not sure how to wait for the user to finish interacting with the divide tool before executing the custom code.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2024 17:59:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/add-in-button-with-icommand-calling-interactive/m-p/1556925#M12272</guid>
      <dc:creator>KerryAlley</dc:creator>
      <dc:date>2024-11-08T17:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: Add-in button with iCommand calling interactive tool</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/add-in-button-with-icommand-calling-interactive/m-p/1557176#M12276</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is no way to determine when a button has finished executing like you're attempting to do.&amp;nbsp; &amp;nbsp;However when it comes to edit operations, you can determine when an edit has occurred by using the edit events.&amp;nbsp; &amp;nbsp;See this documentation.&amp;nbsp; &amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Editing#edit-events" target="_blank"&gt;https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Editing#edit-events&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;In your case you would need to subscribe to the row Events to determine when the Divide operation has completed and add your custom attribute updates within that event.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Narelle&lt;/P&gt;</description>
      <pubDate>Mon, 11 Nov 2024 01:59:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/add-in-button-with-icommand-calling-interactive/m-p/1557176#M12276</guid>
      <dc:creator>NarelleChedzey</dc:creator>
      <dc:date>2024-11-11T01:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: Add-in button with iCommand calling interactive tool</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/add-in-button-with-icommand-calling-interactive/m-p/1557801#M12283</link>
      <description>&lt;P&gt;Thanks Narelle,&lt;/P&gt;&lt;P&gt;Just to make sure we're talking about the same thing before I give up...&lt;/P&gt;&lt;P&gt;Unless I misunderstand this reference&amp;nbsp;&lt;A href="https://github.com/esri/arcgis-pro-sdk/wiki/ProGuide-Reusing-Pro-Commands#reusing-arcgis-pro-commands-in-your-add-in-ribbon-ui-in-code-behind" target="_blank" rel="noopener"&gt;reusing-arcgis-pro-commands-in-your-add-in-ribbon-ui-in-code-behind&lt;/A&gt;, it seems that the first MessageBox line in my add-in code above should execute after&amp;nbsp;the user closes the command's dialog box.&lt;/P&gt;&lt;P&gt;to quote step #7 in that section:&amp;nbsp;&lt;BR /&gt;"After the 'Borrowed code-behind' completes (after closing the Create Bookmark dialog) the add-on function will start running popping up the message box with the &lt;EM&gt;&lt;FONT color="#993300"&gt;Here is my own optional add-on functionality&lt;/FONT&gt;&lt;/EM&gt; string displayed"&lt;/P&gt;&lt;P&gt;(Note: In my code example above, I replaced the message &lt;EM&gt;&lt;FONT color="#993300"&gt;"Here is my own optional add-on functionality"&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;with &lt;EM&gt;&lt;FONT color="#993300"&gt;"Any custom code written here executes without waiting for the user to divide a polyline"&lt;/FONT&gt;&lt;/EM&gt;)&lt;/P&gt;&lt;P&gt;I assume that they are referring to behavior similar to what I see with my ArcMap version of the add-in: executing the split tool (aka the divide tool in Pro) from within a button creates a pop-up window that has to be interacted with before the rest of the button's OnClick() code runs.&lt;/P&gt;&lt;P&gt;Is this behavior really not possible with a Pro add-in?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks again!&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2024 23:03:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/add-in-button-with-icommand-calling-interactive/m-p/1557801#M12283</guid>
      <dc:creator>KerryAlley</dc:creator>
      <dc:date>2024-11-12T23:03:18Z</dc:date>
    </item>
    <item>
      <title>Re: Add-in button with iCommand calling interactive tool</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/add-in-button-with-icommand-calling-interactive/m-p/1557818#M12284</link>
      <description>&lt;P&gt;Kerry,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry for the confusion.&amp;nbsp; I would have to qualify my above statement with regards to determining when a button / command has finished executing; is that it depends on the command.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the example in the documentation, the command "esri_mapping_createBookmark"&amp;nbsp; displays a modal dialog and performs some action on the ok button.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The command in your example&amp;nbsp; "esri_editing_DivideCommand" activates the divide tool and displays a UI in a dockpane.&amp;nbsp; This is not a modal dialog as tools very often require some interaction with the map.&amp;nbsp; The divide command at this point has finished executing.&amp;nbsp; It is the divide tool and the dockpane UI that actually controls the divide operation.&amp;nbsp; &amp;nbsp;The only way to know when the user has finished interacting with the UI and executed the divide edit is to use the edit events. .&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps clarify things a bit.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Narelle&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 00:34:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/add-in-button-with-icommand-calling-interactive/m-p/1557818#M12284</guid>
      <dc:creator>NarelleChedzey</dc:creator>
      <dc:date>2024-11-13T00:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: Add-in button with iCommand calling interactive tool</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/add-in-button-with-icommand-calling-interactive/m-p/1558062#M12291</link>
      <description>&lt;P&gt;It certainly does. Thanks Narelle!&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 15:28:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/add-in-button-with-icommand-calling-interactive/m-p/1558062#M12291</guid>
      <dc:creator>KerryAlley</dc:creator>
      <dc:date>2024-11-13T15:28:05Z</dc:date>
    </item>
  </channel>
</rss>

