Skip to content

Commit

Permalink
Add XmlnsPrefix revit.busy
Browse files Browse the repository at this point in the history
  • Loading branch information
ricaun committed Aug 14, 2024
1 parent 42f9191 commit 9860c4d
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 17 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ 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.2] / 2023-08-14
### Features
- Add `XmlnsPrefix` and `XmlnsDefinition` to `Revit.Busy` namespace.
### Updated
- Update references to work with net code.
- Clear main project and move files to `Example`
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<Version>0.2.2-alpha</Version>
<Version>0.2.2-alpha.1</Version>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ RevitBusyControl.Initialize(application);

Binding to the `IsRevitBusy` property.
```xml
xmlns:busy="clr-namespace:Revit.Busy"
xmlns:busy="http://schemas.revit.busy.com/2024/xaml/presentation"
```
```xml
{Binding IsRevitBusy, Source={x:Static busy:RevitBusyControl.Control}}
Expand Down
3 changes: 2 additions & 1 deletion Revit.Busy.Example/Revit/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class App : IExternalApplication
public static IRevitTask RevitTask => revitTaskService;

private static RibbonPanel ribbonPanel;
private static RevitBusyService RevitBusyService;
public static RevitBusyService RevitBusyService;
public Result OnStartup(UIControlledApplication application)
{
revitTaskService = new RevitTaskService(application);
Expand All @@ -27,6 +27,7 @@ public Result OnStartup(UIControlledApplication application)
.SetLargeImage("/UIFrameworkRes;component/ribbon/images/revit.ico");

RevitBusyService = new RevitBusyService(application);
RevitBusyService.SetInterval(100);
RevitBusyService.PropertyChanged += (s, e) =>
{
UpdateLargeImageBusy(ribbonItem, RevitBusyService.IsRevitBusy);
Expand Down
31 changes: 19 additions & 12 deletions Revit.Busy.Example/Revit/Views/BusyView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,30 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Revit.Busy.Example.Revit.Views"
xmlns:busy="clr-namespace:Revit.Busy.Example.Revit.Views"
xmlns:busy="http://schemas.revit.busy.com/2024/xaml/presentation"
mc:Ignorable="d"
Background="WhiteSmoke"
>
<!--Title="{Binding IsRevitBusy, Source={x:Static busy:RevitBusyControl.Control}}"-->
Background="WhiteSmoke">

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

<Grid Margin="15">
<Grid IsEnabled="{Binding IsRevitBusy, Source={x:Static busy:Controls.Control}, Converter={StaticResource InverseBooleanConverter}}">

<StackPanel Margin="15">
<ProgressBar Height="24"
IsIndeterminate="{Binding IsRevitBusy, Source={x:Static busy:RevitBusyControl.Control}}" />
<Grid Margin="4" />
<StackPanel IsEnabled="{Binding IsRevitBusy, Source={x:Static local:RevitBusyControl.Control}, Converter={StaticResource InverseBooleanConverter}}">
<Button HorizontalAlignment="Center"
VerticalAlignment="Center"
Height="24"
Width="240"
Command="{Binding ButtonCommand}">Create Wall</Button>
<Grid Margin="4" />
<Button HorizontalAlignment="Center"
VerticalAlignment="Center"
Height="120"
Width="120"
Command="{Binding ButtonCommand}">Wall</Button>
</Grid>
</Grid>
Height="24"
Width="240"
Command="{Binding ButtonDeleteCommand}">Delete Element</Button>
</StackPanel>
</StackPanel>
</Window>
17 changes: 15 additions & 2 deletions Revit.Busy.Example/Revit/Views/BusyView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace Revit.Busy.Example.Revit.Views
public partial class BusyView : Window
{
public IAsyncRelayCommand ButtonCommand { get; private set; }
public IAsyncRelayCommand ButtonDeleteCommand { get; private set; }
public BusyView()
{
ButtonCommand = new AsyncRelayCommand(async () =>
Expand All @@ -25,6 +26,18 @@ await App.RevitTask.Run((uiapp) =>
});
});

ButtonDeleteCommand = new AsyncRelayCommand(async () =>
{
await App.RevitTask.Run((uiapp) =>
{
uiapp.PostCommand(Autodesk.Revit.UI.RevitCommandId.LookupPostableCommandId(Autodesk.Revit.UI.PostableCommand.Delete));
});
await App.RevitTask.Run((uiapp) =>
{
// This is just to force the `AsyncRelayCommand` to wait the PostCommand to finish.
});
});

this.Title = "Wall - BusyView";
InitializeComponent();
InitializeWindow();
Expand All @@ -42,9 +55,9 @@ private void InitializeWindow()
#endregion
}

public class Controls
public class RevitBusyControl
{
public static RevitBusyService Control => RevitBusyControl.Control;
public static RevitBusyService Control => App.RevitBusyService;
}

[ValueConversion(typeof(bool), typeof(bool))]
Expand Down
4 changes: 4 additions & 0 deletions Revit.Busy/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
using System;
using System.Windows.Markup;
[assembly: XmlnsPrefix("http://schemas.revit.busy.com/2024/xaml/presentation", "revit.busy")]
[assembly: XmlnsDefinition("http://schemas.revit.busy.com/2024/xaml/presentation", "Revit.Busy")]

0 comments on commit 9860c4d

Please sign in to comment.