Skip to content

Commit

Permalink
Update RevitProgressBar
Browse files Browse the repository at this point in the history
  • Loading branch information
ricaun committed Dec 11, 2023
1 parent d1d5b33 commit d06c95d
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 3 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,32 @@ using (var progressBar = new RevitProgressBar())
}
}
```
### Example
```C#
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using ricaun.Revit.UI.StatusBar;

namespace RevitAddin.Commands
{
[Transaction(TransactionMode.Manual)]
public class CommandRevit : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet)
{
UIApplication uiapp = commandData.Application;

RevitProgressBarUtils.Run(uiapp.Application.VersionName, 100, (i) =>
{
System.Threading.Thread.Sleep(i);
});

return Result.Succeeded;
}
}
}
```

## Utils
### BalloonUtils
Expand Down
1 change: 1 addition & 0 deletions ricaun.Revit.UI.StatusBar/Revit/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public Result OnStartup(UIControlledApplication application)
{
ribbonPanel = application.CreatePanel("StatusBar");
ribbonPanel.RowStackedItems(
ribbonPanel.CreatePushButton<Commands.CommandRevit>("Revit"),
ribbonPanel.CreatePushButton<Commands.CommandTheme>("Theme"),
ribbonPanel.CreatePushButton<Commands.CommandDelayIndeterminate>("Delay"),
ribbonPanel.CreatePushButton<Commands.CommandElements>("Elements"),
Expand Down
1 change: 0 additions & 1 deletion ricaun.Revit.UI.StatusBar/Revit/Commands/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace ricaun.Revit.UI.StatusBar.Revit.Commands
{
Expand Down
22 changes: 22 additions & 0 deletions ricaun.Revit.UI.StatusBar/Revit/Commands/CommandRevit.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace ricaun.Revit.UI.StatusBar.Revit.Commands
{
[Transaction(TransactionMode.Manual)]
public class CommandRevit : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet)
{
UIApplication uiapp = commandData.Application;

RevitProgressBarUtils.Run(uiapp.Application.VersionName, 100, (i) =>
{
System.Threading.Thread.Sleep(i);
});

return Result.Succeeded;
}
}
}
2 changes: 1 addition & 1 deletion ricaun.Revit.UI.StatusBar/RevitProgressBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ private RevitProgressBar RefreshStopwatchBackground()

private void RefreshBackground()
{
progressBarStackPanel.Dispatcher.Invoke(() => { }, System.Windows.Threading.DispatcherPriority.ApplicationIdle);
progressBarStackPanel.Dispatcher.Invoke(() => { }, System.Windows.Threading.DispatcherPriority.Background);
}
}
}
2 changes: 1 addition & 1 deletion ricaun.Revit.UI.StatusBar/ricaun.Revit.UI.StatusBar.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

<PropertyGroup>
<PackageId>ricaun.Revit.UI.StatusBar</PackageId>
<Version>1.0.0-alpha</Version>
<Version>1.0.0-alpha.1</Version>
<ProjectGuid>{841E5210-49AA-415B-9B05-23B47C840BA1}</ProjectGuid>
</PropertyGroup>

Expand Down

0 comments on commit d06c95d

Please sign in to comment.