<?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: How to hide ProgressDialog displayed during OnClick handler of a button in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-hide-progressdialog-displayed-during/m-p/1599162#M12796</link>
    <description>&lt;P&gt;Not sure what&amp;nbsp;ProgressDialogModule.RunCancelableProgress in your snippet does, but if you use a ProgressorSource with a maximum number of steps the&amp;nbsp;progsrc.Value has to match&amp;nbsp;progsrc.Max before the ProgressorDialog goes away.&amp;nbsp; I don't think you need&amp;nbsp;pd.Show() or pd.Hide() as long as you use the Value and Max properties instead.&amp;nbsp; &amp;nbsp;For each completed step (with a total of progsrc.Max steps) increment progsrc.Value, when progsrc.Value is equal to progsrc.Max the progressor dialog closes.&lt;BR /&gt;You can find a snippet here:&lt;BR /&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic10930.html" target="_blank"&gt;CancelableProgressor Class—ArcGIS Pro&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 25 Mar 2025 19:03:06 GMT</pubDate>
    <dc:creator>Wolf</dc:creator>
    <dc:date>2025-03-25T19:03:06Z</dc:date>
    <item>
      <title>How to hide ProgressDialog displayed during OnClick handler of a button</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-hide-progressdialog-displayed-during/m-p/1598366#M12783</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am struggling to understand the behavior of the ProgressDialog. I have some business logic to perform when user clicks a custom button in a ribbon. Part of the logic is synchronous and part is asynchronous GP Service call that user is not interested in waiting for. It seems no matter what I do, ProgressDialog remains displayed during an asynchronous call.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I looked at the example at&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-pro-sdk-community-samples/blob/master/Framework/ProgressDialog/RunDialogButtons.cs" target="_blank"&gt;https://github.com/Esri/arcgis-pro-sdk-community-samples/blob/master/Framework/ProgressDialog/RunDialogButtons.cs&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and modified&amp;nbsp;RunDialogButtonsCancel classes' OnClick method slightly as below&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;  internal class RunDialogButtonsCancel : Button
  {
    protected override async void OnClick()
    {   //If you run this in the DEBUGGER you will NOT see the dialog
      uint maxSteps = 10;
      using (var pd = new ArcGIS.Desktop.Framework.Threading.Tasks.ProgressDialog(
          "Doing my thing - cancelable", "Canceled", maxSteps, false))
      {
        CancelableProgressorSource cps = new CancelableProgressorSource(pd);
        // Run a user cancellable process
        pd.Show();
        await
            ProgressDialogModule.RunCancelableProgress(
                cps, maxSteps);
        cps.Progressor.Value = maxSteps + 1;
        pd.Hide();
      }
      // now wait for 10 seconds to prove ProgressDialog still remains in a display making pd.Hide() above useless
      Task.Delay(10000).Wait();
    }
  }
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I can see that even after Hide method, the ProgressDialog remains displayed in the UI. Is there a trick to make it go away? Is it works as designed and that&amp;nbsp;ProgressDialog remains displayed until the method in which it is created (OnClick event here) remains in-scope?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 23 Mar 2025 22:43:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-hide-progressdialog-displayed-during/m-p/1598366#M12783</guid>
      <dc:creator>EstherSmith_Dev</dc:creator>
      <dc:date>2025-03-23T22:43:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to hide ProgressDialog displayed during OnClick handler of a button</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-hide-progressdialog-displayed-during/m-p/1598367#M12784</link>
      <description>&lt;P&gt;I have also tried this but same result, the ProgressDialog remains displayed 10 seconds after cancel is clicked.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;internal class RunDialogButtonsCancel : Button
{


  private async Task RunGPService()
  {
    // Call async GP Service 
    Task.Delay(10000).Wait();
  }

  protected override async void OnClick()
  {   //If you run this in the DEBUGGER you will NOT see the dialog
    uint maxSteps = 10;
    using (var pd = new ArcGIS.Desktop.Framework.Threading.Tasks.ProgressDialog(
        "Doing my thing - cancelable", "Canceled", maxSteps, false))
    {
      CancelableProgressorSource cps = new CancelableProgressorSource(pd);
      // Run a user cancellable process
      pd.Show();
      await
          ProgressDialogModule.RunCancelableProgress(
              cps, maxSteps);
      cps.Progressor.Value = maxSteps + 1;
      pd.Hide();
    }
    // Call async GP Service and dont wait for it
    _ = RunGPService();
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 23 Mar 2025 23:00:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-hide-progressdialog-displayed-during/m-p/1598367#M12784</guid>
      <dc:creator>EstherSmith_Dev</dc:creator>
      <dc:date>2025-03-23T23:00:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to hide ProgressDialog displayed during OnClick handler of a button</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-hide-progressdialog-displayed-during/m-p/1598368#M12785</link>
      <description>&lt;P&gt;Looks like I need to call a task using ArcGIS.Core.Threading.Tasks.BackgroundTask.Run. Found that below works without showing the ProgressDialog&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;  internal class RunDialogButtonsCancel : Button
  {


    protected override async void OnClick()
    {   //If you run this in the DEBUGGER you will NOT see the dialog
      uint maxSteps = 10;
      using (var pd = new ArcGIS.Desktop.Framework.Threading.Tasks.ProgressDialog(
          "Doing my thing - cancelable", "Canceled", maxSteps, false))
      {
        CancelableProgressorSource cps = new CancelableProgressorSource(pd);
        // Run a user cancellable process
        pd.Show();
        await
            ProgressDialogModule.RunCancelableProgress(
                cps, maxSteps);
        cps.Progressor.Value = maxSteps + 1;
        pd.Hide();
      }
      // now wait for 10 seconds to prove ProgressDialog still remains in a display making pd.Hide() above useless
      //_ = RunGPService();
      ArcGIS.Core.Threading.Tasks.BackgroundTask.Run(() =&amp;gt;
         Task.Delay(10000).Wait(), ArcGIS.Core.Threading.Tasks.BackgroundProgressor.None);
    }
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 23 Mar 2025 23:22:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-hide-progressdialog-displayed-during/m-p/1598368#M12785</guid>
      <dc:creator>EstherSmith_Dev</dc:creator>
      <dc:date>2025-03-23T23:22:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to hide ProgressDialog displayed during OnClick handler of a button</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-hide-progressdialog-displayed-during/m-p/1599162#M12796</link>
      <description>&lt;P&gt;Not sure what&amp;nbsp;ProgressDialogModule.RunCancelableProgress in your snippet does, but if you use a ProgressorSource with a maximum number of steps the&amp;nbsp;progsrc.Value has to match&amp;nbsp;progsrc.Max before the ProgressorDialog goes away.&amp;nbsp; I don't think you need&amp;nbsp;pd.Show() or pd.Hide() as long as you use the Value and Max properties instead.&amp;nbsp; &amp;nbsp;For each completed step (with a total of progsrc.Max steps) increment progsrc.Value, when progsrc.Value is equal to progsrc.Max the progressor dialog closes.&lt;BR /&gt;You can find a snippet here:&lt;BR /&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic10930.html" target="_blank"&gt;CancelableProgressor Class—ArcGIS Pro&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Mar 2025 19:03:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-hide-progressdialog-displayed-during/m-p/1599162#M12796</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2025-03-25T19:03:06Z</dc:date>
    </item>
  </channel>
</rss>

