<?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 Why is the progress bar not showing in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/why-is-the-progress-bar-not-showing/m-p/1372809#M11019</link>
    <description>&lt;P&gt;Hi, I'm trying to use a progress bar to show the progress of my call to tool, but it doesn't show up no matter how I put it.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;private async void Button_Click_import(object sender, RoutedEventArgs e)
{
    AddlayertoDatabase(); // 添加选中图层
    //var progsrc=new CancelableProgressorSource(progDlg);
    var map = MapView.Active.Map;
    var progDlg = new ProgressDialog("进度条", "取消", 100, true);
    progDlg.Show();
    // 创建一个图层组
    GroupLayer groupLayer = null;
    await QueuedTask.Run(() =&amp;gt;
    {
        // 创建图层组
        groupLayer = LayerFactory.Instance.CreateGroupLayer(map, 0, "表面模型");
    });
    foreach (FeatureLayer selectedLayer in _selectedLayers)
    {
        var fcName = selectedLayer.Name;
        var fieldName = comboBox2.Text;
        var gdbPath = Project.Current.DefaultGeodatabasePath;
        var outputdata = System.IO.Path.Combine(gdbPath, $"{fcName}_表面模型");

        await QueuedTask.Run(async () =&amp;gt;
        {
            try
            {
                // 构建工具箱工具的参数 
                var parameters = Geoprocessing.MakeValueArray(
                    fcName,
                    fieldName,
                    outputdata,
                    "MAXIMUM",
                    null,
                    cellsize
                );

                // 执行工具
                
                var progsrc=new CancelableProgressorSource(progDlg);
                //var environments = Geoprocessing.MakeEnvironmentArray(overwriteoutput: true);
                GPExecuteToolFlags executeFlags = GPExecuteToolFlags.GPThread | GPExecuteToolFlags.AddToHistory | GPExecuteToolFlags.RefreshProjectItems;
                var results = await Geoprocessing.ExecuteToolAsync("conversion.PointToRaster", parameters, null, progsrc.CancellationTokenSource.Token, null, executeFlags);
                

                // 处理结果
                // 获取错误信息
                if (results.IsFailed)
                {
                    await QueuedTask.Run(() =&amp;gt;
                    {
                        Geoprocessing.ShowMessageBox(results.Messages, "工具执行失败", GPMessageBoxStyle.Error);
                    });
                }
                else
                {
                    //MessageBox.Show("工具执行成功！");
                    await QueuedTask.Run(() =&amp;gt;
                    {
                        var rasterLayer = LayerFactory.Instance.CreateLayer(new Uri(outputdata), groupLayer) as RasterLayer;
                    });
                }
            }
            catch (Exception ex)
            {
                await QueuedTask.Run(() =&amp;gt;
                {
                    //System.Windows.MessageBox.Show($"发生错误：{ex.Message}");
                    System.Diagnostics.Debug.WriteLine($"发生错误：{ex.Message}");
                    System.Diagnostics.Debug.WriteLine($"StackTrace: {ex.StackTrace}");
                });
            }
        });
    }
    progDlg.Hide();
}&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 22 Jan 2024 07:56:03 GMT</pubDate>
    <dc:creator>YetaoYang</dc:creator>
    <dc:date>2024-01-22T07:56:03Z</dc:date>
    <item>
      <title>Why is the progress bar not showing</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/why-is-the-progress-bar-not-showing/m-p/1372809#M11019</link>
      <description>&lt;P&gt;Hi, I'm trying to use a progress bar to show the progress of my call to tool, but it doesn't show up no matter how I put it.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;private async void Button_Click_import(object sender, RoutedEventArgs e)
{
    AddlayertoDatabase(); // 添加选中图层
    //var progsrc=new CancelableProgressorSource(progDlg);
    var map = MapView.Active.Map;
    var progDlg = new ProgressDialog("进度条", "取消", 100, true);
    progDlg.Show();
    // 创建一个图层组
    GroupLayer groupLayer = null;
    await QueuedTask.Run(() =&amp;gt;
    {
        // 创建图层组
        groupLayer = LayerFactory.Instance.CreateGroupLayer(map, 0, "表面模型");
    });
    foreach (FeatureLayer selectedLayer in _selectedLayers)
    {
        var fcName = selectedLayer.Name;
        var fieldName = comboBox2.Text;
        var gdbPath = Project.Current.DefaultGeodatabasePath;
        var outputdata = System.IO.Path.Combine(gdbPath, $"{fcName}_表面模型");

        await QueuedTask.Run(async () =&amp;gt;
        {
            try
            {
                // 构建工具箱工具的参数 
                var parameters = Geoprocessing.MakeValueArray(
                    fcName,
                    fieldName,
                    outputdata,
                    "MAXIMUM",
                    null,
                    cellsize
                );

                // 执行工具
                
                var progsrc=new CancelableProgressorSource(progDlg);
                //var environments = Geoprocessing.MakeEnvironmentArray(overwriteoutput: true);
                GPExecuteToolFlags executeFlags = GPExecuteToolFlags.GPThread | GPExecuteToolFlags.AddToHistory | GPExecuteToolFlags.RefreshProjectItems;
                var results = await Geoprocessing.ExecuteToolAsync("conversion.PointToRaster", parameters, null, progsrc.CancellationTokenSource.Token, null, executeFlags);
                

                // 处理结果
                // 获取错误信息
                if (results.IsFailed)
                {
                    await QueuedTask.Run(() =&amp;gt;
                    {
                        Geoprocessing.ShowMessageBox(results.Messages, "工具执行失败", GPMessageBoxStyle.Error);
                    });
                }
                else
                {
                    //MessageBox.Show("工具执行成功！");
                    await QueuedTask.Run(() =&amp;gt;
                    {
                        var rasterLayer = LayerFactory.Instance.CreateLayer(new Uri(outputdata), groupLayer) as RasterLayer;
                    });
                }
            }
            catch (Exception ex)
            {
                await QueuedTask.Run(() =&amp;gt;
                {
                    //System.Windows.MessageBox.Show($"发生错误：{ex.Message}");
                    System.Diagnostics.Debug.WriteLine($"发生错误：{ex.Message}");
                    System.Diagnostics.Debug.WriteLine($"StackTrace: {ex.StackTrace}");
                });
            }
        });
    }
    progDlg.Hide();
}&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 22 Jan 2024 07:56:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/why-is-the-progress-bar-not-showing/m-p/1372809#M11019</guid>
      <dc:creator>YetaoYang</dc:creator>
      <dc:date>2024-01-22T07:56:03Z</dc:date>
    </item>
    <item>
      <title>Re: Why is the progress bar not showing</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/why-is-the-progress-bar-not-showing/m-p/1372843#M11020</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Look at the &lt;A href="https://community.esri.com/t5/arcgis-pro-sdk-questions/progressdialog-not-showing-even-without-debugging/m-p/1248356" target="_self"&gt;thread&lt;/A&gt;. You can make a search in &lt;A href="https://community.esri.com/t5/arcgis-pro-sdk-questions/bd-p/arcgis-pro-sdk-questions" target="_self"&gt;ArcGIS Pro SDK Questions&lt;/A&gt; and you will find answers for the most of your questions.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2024 11:50:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/why-is-the-progress-bar-not-showing/m-p/1372843#M11020</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2024-01-22T11:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: Why is the progress bar not showing</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/why-is-the-progress-bar-not-showing/m-p/1381839#M11093</link>
      <description>&lt;P&gt;If you are running ArcGIS Pro while debugging, you will not see the progress bar.&amp;nbsp; Try running ArcGIS Pro directly (without debugging) and see if it shows up for you.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 20:06:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/why-is-the-progress-bar-not-showing/m-p/1381839#M11093</guid>
      <dc:creator>TimSexton1</dc:creator>
      <dc:date>2024-02-13T20:06:21Z</dc:date>
    </item>
  </channel>
</rss>

