Skip to content

Commit e695b88

Browse files
committed
Add AutoCADBusyService to update the button state in the example project.
1 parent 3360752 commit e695b88

File tree

8 files changed

+34
-8
lines changed

8 files changed

+34
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1414
- Add `CircleCreate` command to the example project.
1515
- Add `MessageBox` and `ShowBalloon` buttons to the example ribbon panel.
1616
- Update resource image to `Cube-Grey-Light.tiff` and `Cube-Grey-Dark.tiff`.
17+
- Add `AutoCADBusyService` to update the button state in the example project.
1718
### Fixes
1819
- Fix `CheckURLValid` to support `http` and `https`.
1920
- Fix `SetImage` to update `Image` property.

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Project>
22
<PropertyGroup>
3-
<Version>0.2.0-beta.2</Version>
3+
<Version>0.2.0-rc</Version>
44
</PropertyGroup>
55
</Project>

ricaun.AutoCAD.UI.Example/App.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using Autodesk.AutoCAD.Runtime;
22
using Autodesk.Windows;
3+
using ricaun.AutoCAD.UI.Busy;
34
using System;
5+
using System.Diagnostics;
46

57
[assembly: ExtensionApplication(typeof(ricaun.AutoCAD.UI.Example.App))]
68

@@ -48,11 +50,36 @@ public override void OnStartup(RibbonControl ribbonControl)
4850
.SetCommand((item) => { Windows.InfoCenter.ShowBalloon(item.Text, "This is a custom message."); })
4951
.SetLargeImage("Resources/Cube-Grey-Light.tiff");
5052

53+
ribbonButtonBusy = ribbonPanel.CreateButton("None")
54+
.SetLargeImage("Resources/Cube-Grey-Light.tiff");
55+
5156
ribbonControl.ActiveTab = ribbonPanel.Tab;
5257
}
5358
public override void OnShutdown(RibbonControl ribbonControl)
5459
{
5560
ribbonControl.RemovePanel(PanelName, TabName);
5661
}
62+
63+
private RibbonButton ribbonButtonBusy;
64+
private AutoCADBusyService busyService;
65+
public override void Initialize()
66+
{
67+
base.Initialize();
68+
busyService = new AutoCADBusyService();
69+
busyService.Initialize();
70+
busyService.PropertyChanged += (sender, e) =>
71+
{
72+
ribbonButtonBusy?.SetText(busyService.IsAutoCADBusy ? "Busy" : "Idle");
73+
var color = busyService.IsAutoCADBusy ? "Red" : "Green";
74+
Debug.WriteLine(color);
75+
ribbonButtonBusy?.SetLargeImage($"Resources/Cube-{color}-Light.tiff");
76+
};
77+
}
78+
79+
public override void Terminate()
80+
{
81+
base.Terminate();
82+
busyService?.Dispose();
83+
}
5784
}
5885
}
4.94 KB
Binary file not shown.
5.45 KB
Binary file not shown.
4.79 KB
Binary file not shown.
5.32 KB
Binary file not shown.

ricaun.AutoCAD.UI.Example/ricaun.AutoCAD.UI.Example.csproj

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,7 @@
6464
<StartAction>Program</StartAction>
6565
<StartProgram>C:\Program Files\Autodesk\AutoCAD $(DebugAutoCADVersion)\acad.exe</StartProgram>
6666
</PropertyGroup>
67-
<ItemGroup>
68-
<None Remove="Box-Cyan-Dark.tiff" />
69-
<None Remove="Box-Cyan-Light.tiff" />
70-
<None Remove="Resources\Cube-Grey-Dark.tiff" />
71-
<None Remove="Resources\Cube-Grey-Light.tiff" />
72-
</ItemGroup>
73-
67+
7468
<ItemGroup>
7569
<PackageReference Include="AutoCAD.NET" Version="$(AutoCADInternalVersion).*" IncludeAssets="build; compile" PrivateAssets="All" />
7670
<PackageReference Include="ricaun.SignTool" Version="*" Condition="$(Configuration.Contains('Debug'))">
@@ -84,8 +78,12 @@
8478
</ItemGroup>
8579

8680
<ItemGroup>
81+
<Resource Include="Resources\Cube-Green-Dark.tiff" />
82+
<Resource Include="Resources\Cube-Green-Light.tiff" />
8783
<Resource Include="Resources\Cube-Grey-Dark.tiff" />
8884
<Resource Include="Resources\Cube-Grey-Light.tiff" />
85+
<Resource Include="Resources\Cube-Red-Dark.tiff" />
86+
<Resource Include="Resources\Cube-Red-Light.tiff" />
8987
</ItemGroup>
9088

9189
<PropertyGroup>

0 commit comments

Comments
 (0)