<?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: Show progress when running a geoprocessing in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/show-progress-when-running-a-geoprocessing/m-p/1324508#M10286</link>
    <description>&lt;P&gt;Thanks again &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/42133"&gt;@GKmieliauskas&lt;/a&gt;. I have checked&amp;nbsp;&lt;A href="https://community.esri.com/t5/user/viewprofilepage/user-id/12882" target="_blank"&gt;@Wolf&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;sample. But,&lt;/SPAN&gt; According to this ESRI documentation&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic9384.html" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic9384.html&amp;nbsp;&lt;/A&gt;There is no parameter of CancelableProgressor in the parameter list for&amp;nbsp;Geoprocessing.ExecuteToolAsync&lt;/P&gt;</description>
    <pubDate>Thu, 31 Aug 2023 19:00:20 GMT</pubDate>
    <dc:creator>HelenZhou</dc:creator>
    <dc:date>2023-08-31T19:00:20Z</dc:date>
    <item>
      <title>Show progress when running a geoprocessing</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/show-progress-when-running-a-geoprocessing/m-p/1324036#M10270</link>
      <description>&lt;P&gt;Hello, I am working on an ArcGIS Pro SDK project, which includes running a geoprocessing tool. This tool runs 30+ seconds. Is there a good way to show progress which the tool is running?&lt;/P&gt;&lt;P&gt;I have found &amp;nbsp;&amp;nbsp;ArcGIS.Desktop.Framework.Threading.Tasks.ProgressDialog.&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic10965.html#i-heading-example" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic10965.html#i-heading-example&lt;/A&gt;. When I use the example code in my application, I don't see the progress dialog shows up (not in debug mode).&lt;/P&gt;&lt;P&gt;here is the code module -&lt;/P&gt;&lt;P&gt;public static async Task&amp;lt;bool&amp;gt; ProcessSpatialJoin(string target_feats, string join_feats, string output_feats, string search_radius)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;//&lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic10957.html" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic10957.html&lt;/A&gt;&lt;BR /&gt;var progDlg = new ProgressDialog("Running spatial join", "Cancel", 100, true);&lt;BR /&gt;progDlg.Show();&lt;BR /&gt;var progsrc=new CancelableProgressorSource(progDlg);&lt;BR /&gt;System.Windows.MessageBox.Show("Progress bar show");&lt;BR /&gt;var environments = Geoprocessing.MakeEnvironmentArray(overwriteoutput: true);&lt;/P&gt;&lt;P&gt;var parameters = await QueuedTask.Run(() =&amp;gt;&lt;BR /&gt;{&lt;BR /&gt;var join_operation = "JOIN_ONE_TO_ONE";&lt;BR /&gt;var match_option = "INTERSECT";&amp;nbsp;&amp;nbsp;&lt;BR /&gt;var field_map = "";&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;return Geoprocessing.MakeValueArray(target_feats, join_feats, output_feats, join_operation,&lt;/P&gt;&lt;P&gt;"KEEP_COMMON", field_map, match_option, search_radius);&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;GPExecuteToolFlags flags = GPExecuteToolFlags.AddOutputsToMap | GPExecuteToolFlags.GPThread;&lt;/P&gt;&lt;P&gt;var toolResult = await Geoprocessing.ExecuteToolAsync("SpatialJoin_analysis", parameters, environments, null, null, flags);&lt;BR /&gt;// dialog hides itself once the execution is complete&lt;BR /&gt;progDlg.Hide();&lt;BR /&gt;System.Windows.MessageBox.Show("Progress bar hide");&lt;BR /&gt;if (toolResult.IsFailed == true)&lt;BR /&gt;{&lt;BR /&gt;Geoprocessing.ShowMessageBox(toolResult.Messages, "GP Messages", toolResult.IsFailed ?&lt;BR /&gt;GPMessageBoxStyle.Error : GPMessageBoxStyle.Default);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;return !(toolResult.IsFailed);&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 18:44:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/show-progress-when-running-a-geoprocessing/m-p/1324036#M10270</guid>
      <dc:creator>HelenZhou</dc:creator>
      <dc:date>2023-08-30T18:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: Show progress when running a geoprocessing</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/show-progress-when-running-a-geoprocessing/m-p/1324081#M10271</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If you are running add-ins from Visual studio it will not show progress dialog ( no matter Debug or Release mode) . Try to run it directly from ArcGISPro.exe executable.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 20:08:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/show-progress-when-running-a-geoprocessing/m-p/1324081#M10271</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2023-08-30T20:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: Show progress when running a geoprocessing</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/show-progress-when-running-a-geoprocessing/m-p/1324095#M10272</link>
      <description>&lt;P&gt;The ArcGIS Pro is not launched from Visual Studio. Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 20:23:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/show-progress-when-running-a-geoprocessing/m-p/1324095#M10272</guid>
      <dc:creator>HelenZhou</dc:creator>
      <dc:date>2023-08-30T20:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: Show progress when running a geoprocessing</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/show-progress-when-running-a-geoprocessing/m-p/1324278#M10277</link>
      <description>&lt;P&gt;1. Try to delete line:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var progsrc=new CancelableProgressorSource(progDlg);&lt;/LI-CODE&gt;&lt;P&gt;2. Try to change geoprocessing&amp;nbsp; flag by removing&amp;nbsp;&lt;SPAN&gt;GPExecuteToolFlags.GPThread.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3. If your geoprocessing fails (invalid parameters and etc.) when you will not see progress dialog too&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 09:43:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/show-progress-when-running-a-geoprocessing/m-p/1324278#M10277</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2023-08-31T09:43:44Z</dc:date>
    </item>
    <item>
      <title>Re: Show progress when running a geoprocessing</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/show-progress-when-running-a-geoprocessing/m-p/1324464#M10284</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/42133"&gt;@GKmieliauskas&lt;/a&gt;&amp;nbsp;, Thanks. The tool is working. I just need to add a progress bar for the long geoprocessing time.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried to remove the code specified in item 1 and 2. Progress bar still doesn't display.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 17:48:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/show-progress-when-running-a-geoprocessing/m-p/1324464#M10284</guid>
      <dc:creator>HelenZhou</dc:creator>
      <dc:date>2023-08-31T17:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: Show progress when running a geoprocessing</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/show-progress-when-running-a-geoprocessing/m-p/1324476#M10285</link>
      <description>&lt;P&gt;Look at the&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/12882"&gt;@Wolf&lt;/a&gt; sample in ArcGIS Pro SDK &lt;A href="https://community.esri.com/t5/arcgis-pro-sdk-questions/progressdialog-appears-inconsistently/m-p/1228920" target="_self"&gt;thread&lt;/A&gt;&lt;/P&gt;&lt;P&gt;It uses&amp;nbsp;CancelableProgressorSource as parameter for geoprocessing call&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 18:06:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/show-progress-when-running-a-geoprocessing/m-p/1324476#M10285</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2023-08-31T18:06:15Z</dc:date>
    </item>
    <item>
      <title>Re: Show progress when running a geoprocessing</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/show-progress-when-running-a-geoprocessing/m-p/1324508#M10286</link>
      <description>&lt;P&gt;Thanks again &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/42133"&gt;@GKmieliauskas&lt;/a&gt;. I have checked&amp;nbsp;&lt;A href="https://community.esri.com/t5/user/viewprofilepage/user-id/12882" target="_blank"&gt;@Wolf&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;sample. But,&lt;/SPAN&gt; According to this ESRI documentation&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic9384.html" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic9384.html&amp;nbsp;&lt;/A&gt;There is no parameter of CancelableProgressor in the parameter list for&amp;nbsp;Geoprocessing.ExecuteToolAsync&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 19:00:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/show-progress-when-running-a-geoprocessing/m-p/1324508#M10286</guid>
      <dc:creator>HelenZhou</dc:creator>
      <dc:date>2023-08-31T19:00:20Z</dc:date>
    </item>
    <item>
      <title>Re: Show progress when running a geoprocessing</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/show-progress-when-running-a-geoprocessing/m-p/1324513#M10287</link>
      <description>&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic9385.html" target="_blank"&gt;ExecuteToolAsync(String,IEnumerable&amp;lt;String&amp;gt;,IEnumerable&amp;lt;KeyValuePair&amp;lt;String,String&amp;gt;&amp;gt;,CancelableProgressor,GPExecuteToolFlags) Method—ArcGIS Pro&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 19:03:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/show-progress-when-running-a-geoprocessing/m-p/1324513#M10287</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2023-08-31T19:03:50Z</dc:date>
    </item>
    <item>
      <title>Re: Show progress when running a geoprocessing</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/show-progress-when-running-a-geoprocessing/m-p/1324532#M10288</link>
      <description>&lt;P&gt;This code worked for me:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;      try
      {
        var progDlg = new ProgressDialog("Running Geoprocessing Tool", "Cancel");
        var progsrc=new CancelableProgressorSource(progDlg);

        // prepare input parameter values to CopyFeatures tool
        string input_data = @"C:\Data\Admin\AdminSample.gdb\TestArea";
        string out_workspace = ArcGIS.Desktop.Core.Project.Current.DefaultGeodatabasePath;
        string out_data = System.IO.Path.Combine(out_workspace, "TestArea2");

        // make a value array of strings to be passed to ExecuteToolAsync
        var parameters = Geoprocessing.MakeValueArray(input_data, out_data);

        // execute the tool
        await Geoprocessing.ExecuteToolAsync("management.CopyFeatures", parameters,
            null, new CancelableProgressorSource(progDlg).Progressor, GPExecuteToolFlags.Default);

        // dialog hides itself once the execution is complete
        progDlg.Hide();
      }
      catch (Exception ex)
      {
        MessageBox.Show (ex.ToString ());
      }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the difference is that i set the&amp;nbsp;'delayedShow' parameter for the &lt;SPAN&gt;ProgressDialog constructor&amp;nbsp;&lt;/SPAN&gt;to false (not specifying that parameter causes it to be set to false), and i removed the&amp;nbsp;progDlg.Show() line.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 19:45:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/show-progress-when-running-a-geoprocessing/m-p/1324532#M10288</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2023-08-31T19:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: Show progress when running a geoprocessing</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/show-progress-when-running-a-geoprocessing/m-p/1324573#M10289</link>
      <description>&lt;P&gt;Thanks for the link. I understand they are two methods with different parameters. My code still does not show progress bar after matching with the example. On the other hand, during running the geoprocess tool, the ArcGIS Pro is frozen until the tool is finished.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 21:20:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/show-progress-when-running-a-geoprocessing/m-p/1324573#M10289</guid>
      <dc:creator>HelenZhou</dc:creator>
      <dc:date>2023-08-31T21:20:20Z</dc:date>
    </item>
    <item>
      <title>Re: Show progress when running a geoprocessing</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/show-progress-when-running-a-geoprocessing/m-p/1324591#M10290</link>
      <description>&lt;P&gt;thank you&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/12882"&gt;@Wolf&lt;/a&gt;&amp;nbsp;, I added your code in my visual studio project. It is fired by a button click . The button is added in a dockpane. The features are copied but the Progress bar doesn't show. I am not sure if it has something to do with the ArcGIS Pro version. Mine is 3.03. Visual Studio 2022. Or has something to do with running geoprocessing tool in a dockpane.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 22:02:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/show-progress-when-running-a-geoprocessing/m-p/1324591#M10290</guid>
      <dc:creator>HelenZhou</dc:creator>
      <dc:date>2023-08-31T22:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: Show progress when running a geoprocessing</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/show-progress-when-running-a-geoprocessing/m-p/1325302#M10308</link>
      <description>&lt;P&gt;I fixed your snippet above.&amp;nbsp; &amp;nbsp;I guess the main issue was that the&amp;nbsp; CancelableProgressor parameter for ExecuteToolAsync is missing.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;    protected override async void OnClick()
    {
      var done = await ProcessSpatialJoin(@"Crimes", @"Portland Precincts", @"C:\Data\Interacting with Maps\Interacting with Maps.gdb\Crimes_SpatialJoin", "50 Yards");
      MessageBox.Show($@"Process done: {done}");
    }

    public static async Task&amp;lt;bool&amp;gt; ProcessSpatialJoin(string target_feats, string join_feats, string output_feats, string search_radius)
    {
      //https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic10957.html
      var progDlg = new ProgressDialog("Running spatial join", "Cancel");
      progDlg.Show();
      var progsrc=new CancelableProgressorSource(progDlg);
      //System.Windows.MessageBox.Show("Progress bar show");
      var environments = Geoprocessing.MakeEnvironmentArray(overwriteoutput: true);

      var parameters = await QueuedTask.Run(() =&amp;gt;
      {
        var join_operation = "JOIN_ONE_TO_ONE";
        var match_option = "INTERSECT";
        var field_map = "";

        return Geoprocessing.MakeValueArray(target_feats, join_feats, output_feats, join_operation,

        "KEEP_COMMON", field_map, match_option, search_radius);
      });

      GPExecuteToolFlags flags = GPExecuteToolFlags.AddOutputsToMap | GPExecuteToolFlags.GPThread | GPExecuteToolFlags.AddToHistory;

      var toolResult = await Geoprocessing.ExecuteToolAsync("SpatialJoin_analysis", parameters, environments, progsrc.CancellationTokenSource.Token, null, flags);
      //// dialog hides itself once the execution is complete
      //progDlg.Hide();
      //System.Windows.MessageBox.Show("Progress bar hide");
      if (toolResult.IsFailed == true)
      {
        Geoprocessing.ShowMessageBox(toolResult.Messages, "GP Messages", toolResult.IsFailed ?
        GPMessageBoxStyle.Error : GPMessageBoxStyle.Default);
      }
      return !(toolResult.IsFailed);
    }&lt;/LI-CODE&gt;&lt;P&gt;I tried with release 3.0 as well and it worked with 3.0 too:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Wolf_0-1693896726995.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/79817i1D74AF2FC422E19F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Wolf_0-1693896726995.png" alt="Wolf_0-1693896726995.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 06:52:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/show-progress-when-running-a-geoprocessing/m-p/1325302#M10308</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2023-09-05T06:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: Show progress when running a geoprocessing</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/show-progress-when-running-a-geoprocessing/m-p/1325605#M10324</link>
      <description>&lt;P&gt;Thanks so much&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/12882"&gt;@Wolf&lt;/a&gt;&amp;nbsp;for sticking my questions. Yes, after modifying code line 29, the progress dialog showed up. The output is created in the map. But the progress bar never hide.&amp;nbsp; Then I added progDlg.Hide(); after line 29 to hide the progress dialog. Then the progress dialog disappears after the spatial join is complete.&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 20:10:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/show-progress-when-running-a-geoprocessing/m-p/1325605#M10324</guid>
      <dc:creator>HelenZhou</dc:creator>
      <dc:date>2023-09-05T20:10:08Z</dc:date>
    </item>
  </channel>
</rss>

