<?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 show a custom progress bar in Autocad using wpf in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-show-a-custom-progress-bar-in-autocad-using-wpf/m-p/12795678#M3831</link>
    <description>&lt;P&gt;You show the window using Show(), which shows the window modelessly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.autodesk.com/view/OARX/2025/ENU/?guid=OARX-ManagedRefGuide-Autodesk_AutoCAD_ApplicationServices_Core_Application_ShowModalWindow_System_Windows_Window_System_Windows_Window" target="_blank" rel="noopener"&gt;Application.ShowModalWindow()&lt;/A&gt;, shows the window as a modal window, but blocks until the windows is closed, so you must initiate your processing from the Window (e.g., the Loaded event or something like that), and &lt;STRONG&gt;await&lt;/STRONG&gt;&amp;nbsp;the call to start the process, so that it doesn't block the UI from updating. You can pass a callback function to the process whose progress your window is reporting on, which the process would call periodically to update its progress. The callback can then update your UI each time it's called.&lt;/P&gt;</description>
    <pubDate>Fri, 24 May 2024 14:14:15 GMT</pubDate>
    <dc:creator>ActivistInvestor</dc:creator>
    <dc:date>2024-05-24T14:14:15Z</dc:date>
    <item>
      <title>how to show a custom progress bar in Autocad using wpf</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-show-a-custom-progress-bar-in-autocad-using-wpf/m-p/12795605#M3830</link>
      <description>&lt;P&gt;I have created this xaml for progress bar for tasks which takes time.&lt;/P&gt;&lt;P&gt;but when i load my dll containg this xaml and run it it minimizes.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;&amp;lt;Window x:Class="SolarInfraCADAutomate.UI.ProgressBarWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:SolarInfraCADAutomate.UI"
        mc:Ignorable="d"
        Title="ProgressBarWindow" Height="200" Width="400"
        WindowStartupLocation="CenterScreen"
        WindowStyle="None"
        Background="Transparent"
        &amp;gt;
    &amp;lt;Grid&amp;gt;
        &amp;lt;Grid.RowDefinitions&amp;gt;
            &amp;lt;RowDefinition Height="0.5*" /&amp;gt;
            &amp;lt;RowDefinition Height="0.5*" /&amp;gt;
        &amp;lt;/Grid.RowDefinitions&amp;gt;

        &amp;lt;StackPanel Grid.Row="0" Margin="10" VerticalAlignment="Center" HorizontalAlignment="Center"&amp;gt;
            &amp;lt;Label FontSize="32" FontWeight="Bold" Foreground="Beige"&amp;gt;Loading ...&amp;lt;/Label&amp;gt;
        &amp;lt;/StackPanel&amp;gt;

        &amp;lt;StackPanel Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center"&amp;gt;
            &amp;lt;ProgressBar Minimum="0" Maximum="100" Name="pbStatus" IsIndeterminate="True" Height="32" /&amp;gt;
        &amp;lt;/StackPanel&amp;gt;
    &amp;lt;/Grid&amp;gt;
&amp;lt;/Window&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;and implementation is like this&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;[assembly: CommandClass(typeof(SolarInfraCADAutomate.Piling.PilePlacement))]

namespace SolarInfraCADAutomate.Piling
{
	/// &amp;lt;summary&amp;gt;
	/// Class &amp;lt;c&amp;gt;PilePlacement&amp;lt;/c&amp;gt; Places specific piles on user selected tables.
	/// &amp;lt;/summary&amp;gt;
	internal class PilePlacement
	{
		private static Document doc;
		private static Editor ed;
		private static Database db;
		// Progress bar window.
		private static ProgressBarWindow progressBarWindow;
      // Member variable to check whether the type of table is fixtilt or tracker.
      public static bool isFixTilt = false;
		/// &amp;lt;summary&amp;gt;
		/// Method &amp;lt;b&amp;gt;PlacePiles&amp;lt;/b&amp;gt; Places specific piles on user selected tables.
		/// &amp;lt;/summary&amp;gt;
		public static void PlacePiles()
		{
			doc = Application.DocumentManager.MdiActiveDocument;
			UtilityFunctions.UnlockAllLayers(doc, doc.Editor, doc.Database, false);
         LayerOperations.HideTables();
         Log.Logger.Log("Initialized the document in PlacePiles funtion");
			Log.Logger.Log("Calling PilePlacement command");
			doc.SendStringToExecute("PilePlacement ", true, false, false);
         // Show progress bar window on the UI thread
         Dispatcher.CurrentDispatcher.Invoke(() =&amp;gt; {
            progressBarWindow = new ProgressBarWindow();
            progressBarWindow.Show();
         });
      }
		
		[CommandMethod("PilePlacement")]
		public static void Main() 
		{
         doc = Application.DocumentManager.MdiActiveDocument;
			ed = doc.Editor;
			db = doc.Database;
			try
			{
				List&amp;lt;string&amp;gt; tableNames = MMSData.tables;
				MMSData.tablePiling = true;
				Dictionary &amp;lt;string, List &amp;lt; BlockReference &amp;gt;&amp;gt; allBlockReferences = MMSData.mmsTablesDict;
				Log.Logger.Log("Get list of table names and dictionary of table name and blocks from MMSData");
				//iterate through all the tables selected by user
				//string[] tableNames = { "MMS Table (32.2920 x 4.5760)", "MMS Table (128.58 x 2.278)" };
				Log.Logger.Log("iterate through all the tables selected by user");
				foreach (string tableName in tableNames)
				{
					string currTable = tableName;
					if(currTable.Contains("(Ext)")) currTable = currTable.Replace("(Ext)", "");
					AddPileDrawingToDB(tableName, allBlockReferences[currTable][0]);
				}
				ChangeVisibility();
            // Close the progress bar window on the UI thread
            Dispatcher.CurrentDispatcher.Invoke(() =&amp;gt; {
               progressBarWindow.Close();
            });
            MessageBox.Show("Piles placed successfully !!", "Piling Automation", MessageBoxButton.OK, MessageBoxImage.Information);
			}
         catch (Autodesk.AutoCAD.Runtime.Exception ex)
         {
            Log.Logger.LogException(ex);
         }
         catch (System.Exception ex)
         {
            Log.Logger.LogException(ex);
         }
      }&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 24 May 2024 13:47:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-show-a-custom-progress-bar-in-autocad-using-wpf/m-p/12795605#M3830</guid>
      <dc:creator>mr_anildangi</dc:creator>
      <dc:date>2024-05-24T13:47:28Z</dc:date>
    </item>
    <item>
      <title>Re: how to show a custom progress bar in Autocad using wpf</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-show-a-custom-progress-bar-in-autocad-using-wpf/m-p/12795678#M3831</link>
      <description>&lt;P&gt;You show the window using Show(), which shows the window modelessly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.autodesk.com/view/OARX/2025/ENU/?guid=OARX-ManagedRefGuide-Autodesk_AutoCAD_ApplicationServices_Core_Application_ShowModalWindow_System_Windows_Window_System_Windows_Window" target="_blank" rel="noopener"&gt;Application.ShowModalWindow()&lt;/A&gt;, shows the window as a modal window, but blocks until the windows is closed, so you must initiate your processing from the Window (e.g., the Loaded event or something like that), and &lt;STRONG&gt;await&lt;/STRONG&gt;&amp;nbsp;the call to start the process, so that it doesn't block the UI from updating. You can pass a callback function to the process whose progress your window is reporting on, which the process would call periodically to update its progress. The callback can then update your UI each time it's called.&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2024 14:14:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-show-a-custom-progress-bar-in-autocad-using-wpf/m-p/12795678#M3831</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2024-05-24T14:14:15Z</dc:date>
    </item>
    <item>
      <title>Re: how to show a custom progress bar in Autocad using wpf</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-show-a-custom-progress-bar-in-autocad-using-wpf/m-p/12799296#M3832</link>
      <description>&lt;P&gt;Thanks for this great insight .&lt;/P&gt;</description>
      <pubDate>Mon, 27 May 2024 05:58:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-show-a-custom-progress-bar-in-autocad-using-wpf/m-p/12799296#M3832</guid>
      <dc:creator>mr_anildangi</dc:creator>
      <dc:date>2024-05-27T05:58:05Z</dc:date>
    </item>
  </channel>
</rss>

