Skip to content

Commit

Permalink
Merge pull request #4 from ricaun-io/develop
Browse files Browse the repository at this point in the history
Version 0.2.1
  • Loading branch information
ricaun authored Mar 4, 2024
2 parents 8c9db41 + 78c7d18 commit 03e620f
Show file tree
Hide file tree
Showing 10 changed files with 99 additions and 24 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ jobs:
- uses: actions/checkout@v1

- name: NuGet Setup
uses: actions/setup-dotnet@v2
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
dotnet-version: |
7.0.x
8.0.x
- name: "NuGet Add Source Organization"
run: if ("${{ secrets.ORGANIZATION_SOURCE_PACKAGE_PASSWORD }}" -ne "") { dotnet nuget add source --username ${{ secrets.ORGANIZATION_SOURCE_PACKAGE_USERNAME }} --password ${{ secrets.ORGANIZATION_SOURCE_PACKAGE_PASSWORD }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/${{github.repository_owner}}/index.json" }

Expand Down
3 changes: 3 additions & 0 deletions Build/.nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
]
}
},
"UnlistNuget": {
"type": "boolean"
},
"Verbosity": {
"type": "string",
"description": "Logging verbosity during build execution. Default is 'Normal'",
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [0.2.1] / 2023-03-04
### Features
- Update `net8.0-windows` version for Revit 2025
- Update to `countIdling` insted of using timestamp.

## [0.2.0] / 2023-11-18
### Features
- Create `net7.0-windows` version for Revit 2025
Expand All @@ -27,6 +32,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

[vNext]: ../../compare/1.0.0...HEAD
[1.0.0]: ../../compare/1.0.0
[0.2.1]: ../../compare/0.2.0...0.2.1
[0.2.0]: ../../compare/0.1.2...0.2.0
[0.1.2]: ../../compare/0.1.1...0.1.2
[0.1.1]: ../../compare/0.1.0...0.1.1
Expand Down
4 changes: 2 additions & 2 deletions Revit.Busy.Example/Revit.Busy.Example.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@

<!-- RevitVersion -->
<PropertyGroup>
<TargetFrameworks>net46;net7.0-windows</TargetFrameworks>
<TargetFrameworks>net46;net8.0-windows</TargetFrameworks>
</PropertyGroup>
<Choose>
<When Condition="$(TargetFramework.StartsWith('net4'))">
Expand Down Expand Up @@ -165,7 +165,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Revit_All_Main_Versions_API_x64" Version="$(RevitVersion).*" IncludeAssets="build; compile" PrivateAssets="All" />
<PackageReference Include="Revit_All_Main_Versions_API_x64" Version="$(RevitVersion).*-*" IncludeAssets="build; compile" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Revit.Busy.Example/Revit/App.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#if NETFRAMEWORK
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using ricaun.Revit.UI;
using Revit.Busy;
using ricaun.Revit.UI;
using System;
namespace Revit.Busy.Example.Revit
{
Expand Down
11 changes: 6 additions & 5 deletions Revit.Busy/Revit.Busy.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<!-- RevitVersion -->
<PropertyGroup>
<TargetFrameworks>net46;net7.0-windows</TargetFrameworks>
<TargetFrameworks>net46;net8.0-windows</TargetFrameworks>
</PropertyGroup>
<Choose>
<When Condition="$(TargetFramework.StartsWith('net4'))">
Expand Down Expand Up @@ -56,7 +56,7 @@

<PropertyGroup>
<PackageId>Revit.Busy</PackageId>
<Version>0.2.0</Version>
<Version>0.2.1</Version>
<ProjectGuid>{3BAB660A-FADA-4AF0-BE2E-23B7FC5067FC}</ProjectGuid>
</PropertyGroup>

Expand Down Expand Up @@ -105,7 +105,7 @@
<PackagePath></PackagePath>
<Visible>false</Visible>
</None>
</ItemGroup>
</ItemGroup>

<ItemGroup>
<None Include="..\LICENSE">
Expand All @@ -130,7 +130,7 @@
</ItemGroup>


<ItemGroup Condition="$(TargetFramework.StartsWith('net7'))">
<ItemGroup Condition="!$(TargetFramework.StartsWith('net4'))">
<Compile Remove="Revit\**" />
<EmbeddedResource Remove="Revit\**" />
<None Remove="Revit\**" />
Expand All @@ -140,6 +140,7 @@
<ItemGroup Condition="$(Configuration.Contains('Debug')) and $(TargetFramework.StartsWith('net4'))">
<PackageReference Include="ricaun.Revit.UI" Version="*" />
<PackageReference Include="ricaun.Revit.Mvvm" Version="*" />
<PackageReference Include="ricaun.Revit.UI.Tasks" Version="*-*" />
</ItemGroup>

<ItemGroup>
Expand All @@ -160,7 +161,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Revit_All_Main_Versions_API_x64" Version="$(RevitVersion).*" IncludeAssets="build; compile" PrivateAssets="All" />
<PackageReference Include="Revit_All_Main_Versions_API_x64" Version="$(RevitVersion).*-*" IncludeAssets="build; compile" PrivateAssets="All" />
</ItemGroup>

</Project>
9 changes: 9 additions & 0 deletions Revit.Busy/Revit/App.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using ricaun.Revit.UI;
using ricaun.Revit.UI.Tasks;
using System;

namespace Revit.Busy.Revit
{
[AppLoader]
public class App : IExternalApplication
{
private static RevitTaskService revitTaskService;
public static IRevitTask RevitTask => revitTaskService;

private static RibbonPanel ribbonPanel;
private static RibbonItem ribbonItem;
public Result OnStartup(UIControlledApplication application)
{
revitTaskService = new RevitTaskService(application);
revitTaskService.Initialize();

ribbonPanel = application.CreatePanel("Revit.Busy");
ribbonItem = ribbonPanel.CreatePushButton<Commands.Command>("View")
.SetLargeImage("/UIFrameworkRes;component/ribbon/images/revit.ico");
Expand All @@ -34,6 +41,8 @@ private void RevitBusyControlPropertyChanged(object sender, System.ComponentMode

public Result OnShutdown(UIControlledApplication application)
{
revitTaskService?.Dispose();

ribbonPanel?.Remove();
RevitBusyControl.Control.PropertyChanged -= RevitBusyControlPropertyChanged;
RevitBusyControl.Dispose();
Expand Down
19 changes: 12 additions & 7 deletions Revit.Busy/Revit/Views/BusyView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,20 @@
xmlns:busy="clr-namespace:Revit.Busy"
mc:Ignorable="d"
Background="WhiteSmoke"
Title="{Binding IsRevitBusy, Source={x:Static busy:RevitBusyControl.Control}}">
>
<!--Title="{Binding IsRevitBusy, Source={x:Static busy:RevitBusyControl.Control}}"-->

<Window.Resources>
<local:InverseBooleanConverter x:Key="InverseBooleanConverter" />
</Window.Resources>

<Grid Margin="15">
<Grid >
<ProgressBar IsIndeterminate="{Binding IsRevitBusy, Source={x:Static busy:RevitBusyControl.Control}}"
Height="24"></ProgressBar>
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="Busy"></TextBlock>
<Grid IsEnabled="{Binding IsRevitBusy, Source={x:Static busy:RevitBusyControl.Control}, Converter={StaticResource InverseBooleanConverter}}">
<Button HorizontalAlignment="Center"
VerticalAlignment="Center"
Height="120"
Width="120"
Command="{Binding ButtonCommand}">Wall</Button>
</Grid>
</Grid>
</Window>
40 changes: 39 additions & 1 deletion Revit.Busy/Revit/Views/BusyView.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
using System;
using ricaun.Revit.Mvvm;
using ricaun.Revit.UI.Tasks;
using System;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;

namespace Revit.Busy.Revit.Views
{
[PropertyChanged.AddINotifyPropertyChangedInterface]
public partial class BusyView : Window
{
public IAsyncRelayCommand ButtonCommand { get; private set; }
public BusyView()
{
ButtonCommand = new AsyncRelayCommand(async () =>
{
await App.RevitTask.Run((uiapp) =>
{
uiapp.PostCommand(Autodesk.Revit.UI.RevitCommandId.LookupPostableCommandId(Autodesk.Revit.UI.PostableCommand.ArchitecturalWall));
});
await Task.Delay(2000);
});

InitializeComponent();
InitializeWindow();
}
Expand All @@ -22,4 +37,27 @@ private void InitializeWindow()
}
#endregion
}

[ValueConversion(typeof(bool), typeof(bool))]
public class InverseBooleanConverter : IValueConverter
{
#region IValueConverter Members

public object Convert(object value, Type targetType, object parameter,
System.Globalization.CultureInfo culture)
{
if (targetType != typeof(bool))
throw new InvalidOperationException("The target must be a boolean");

return !(bool)value;
}

public object ConvertBack(object value, Type targetType, object parameter,
System.Globalization.CultureInfo culture)
{
throw new NotSupportedException();
}

#endregion
}
}
23 changes: 17 additions & 6 deletions Revit.Busy/RevitBusyService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Revit.Busy
{
/// <summary>
/// RevitBusyService
/// Each 500 millis check if Idling updates
/// Each 1000 millis check if Idling updates
/// </summary>
public class RevitBusyService : IDisposable, INotifyPropertyChanged
{
Expand Down Expand Up @@ -48,23 +48,26 @@ public void SetInterval(double millis = Millis)
{
dispatcher.Interval = TimeSpan.FromMilliseconds(millis);
}

private void InitializeDispatcherTimer()
{
dispatcher = new DispatcherTimer(DispatcherPriority.Background);
dispatcher.Interval = TimeSpan.FromMilliseconds(Millis);
dispatcher.Tick += (s, e) =>
{
IsRevitBusy = (DateTime.Now - LastateTime).TotalMilliseconds > Millis;
//IsRevitBusy = (DateTime.Now - LastateTime).TotalMilliseconds > Millis;
IsRevitBusy = countIdling == 0;
countIdling = 0;
};
dispatcher.Start();
}

private DateTime LastateTime;
private int countIdling = 0;
//private DateTime LastateTime;

private void Application_Idling(object sender, Autodesk.Revit.UI.Events.IdlingEventArgs e)
{
LastateTime = DateTime.Now;
//LastateTime = DateTime.Now;
countIdling++;
if (NeedToDispose) Dispose();
}
#endregion
Expand Down Expand Up @@ -103,9 +106,17 @@ private set
{
var changed = isRevitBusy != value;
isRevitBusy = value;
if (changed) OnPropertyChanged();
if (changed)
{
OnPropertyChanged();
//OnPropertyChanged(nameof(IsRevitNotBusy));
}
}
}
//public bool IsRevitNotBusy
//{
// get { return !isRevitBusy; }
//}
#endregion

#region PropertyChanged
Expand Down

0 comments on commit 03e620f

Please sign in to comment.