-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
242 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Library</OutputType> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<UseWPF>true</UseWPF> | ||
<LangVersion>latest</LangVersion> | ||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> | ||
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch> | ||
<Configurations>Debug; Release</Configurations> | ||
</PropertyGroup> | ||
|
||
<!-- RevitVersion --> | ||
<Choose> | ||
<When Condition="$(Configuration.Contains('2017'))"> | ||
<PropertyGroup> | ||
<RevitVersion>2017</RevitVersion> | ||
<TargetFramework>net46</TargetFramework> | ||
</PropertyGroup> | ||
</When> | ||
<When Condition="$(Configuration.Contains('2018'))"> | ||
<PropertyGroup> | ||
<RevitVersion>2018</RevitVersion> | ||
<TargetFramework>net46</TargetFramework> | ||
</PropertyGroup> | ||
</When> | ||
<When Condition="$(Configuration.Contains('2019'))"> | ||
<PropertyGroup> | ||
<RevitVersion>2019</RevitVersion> | ||
<TargetFramework>net47</TargetFramework> | ||
</PropertyGroup> | ||
</When> | ||
<When Condition="$(Configuration.Contains('2020'))"> | ||
<PropertyGroup> | ||
<RevitVersion>2020</RevitVersion> | ||
<TargetFramework>net47</TargetFramework> | ||
</PropertyGroup> | ||
</When> | ||
<When Condition="$(Configuration.Contains('2021'))"> | ||
<PropertyGroup> | ||
<RevitVersion>2021</RevitVersion> | ||
<TargetFramework>net48</TargetFramework> | ||
</PropertyGroup> | ||
</When> | ||
<When Condition="$(Configuration.Contains('2022'))"> | ||
<PropertyGroup> | ||
<RevitVersion>2022</RevitVersion> | ||
<TargetFramework>net48</TargetFramework> | ||
</PropertyGroup> | ||
</When> | ||
<When Condition="$(Configuration.Contains('2023'))"> | ||
<PropertyGroup> | ||
<RevitVersion>2023</RevitVersion> | ||
<TargetFramework>net48</TargetFramework> | ||
</PropertyGroup> | ||
</When> | ||
<When Condition="$(Configuration.Contains('2024'))"> | ||
<PropertyGroup> | ||
<RevitVersion>2024</RevitVersion> | ||
<TargetFramework>net48</TargetFramework> | ||
</PropertyGroup> | ||
</When> | ||
<Otherwise> | ||
<PropertyGroup> | ||
<RevitVersion>2017</RevitVersion> | ||
<TargetFramework>net46</TargetFramework> | ||
</PropertyGroup> | ||
</Otherwise> | ||
</Choose> | ||
|
||
<!-- Release --> | ||
<PropertyGroup Condition="!$(Configuration.Contains('Debug'))"> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\$(RevitVersion)</OutputPath> | ||
<DefineConstants>REVIT$(RevitVersion)</DefineConstants> | ||
<NoWarn>MSB3052</NoWarn> | ||
<DebugType>None</DebugType> | ||
</PropertyGroup> | ||
|
||
<!-- Debug --> | ||
<PropertyGroup Condition="$(Configuration.Contains('Debug'))"> | ||
<DebugSymbols>true</DebugSymbols> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE;REVIT$(RevitVersion)</DefineConstants> | ||
<DebugType>Full</DebugType> | ||
</PropertyGroup> | ||
|
||
<!-- DebugRevitVersion --> | ||
<PropertyGroup Condition="$(Configuration.Contains('Debug'))"> | ||
<DebugRevitVersion>$(RevitVersion)</DebugRevitVersion> | ||
<StartAction>Program</StartAction> | ||
<StartProgram>C:\Program Files\Autodesk\Revit $(DebugRevitVersion)\Revit.exe</StartProgram> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<PackageId>Revit.Busy.Example</PackageId> | ||
<Version>1.0.0</Version> | ||
<ProjectGuid>{ce1d2870-abe0-4096-95db-6d6db724a2e9}</ProjectGuid> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<PackageAssemblyVersion></PackageAssemblyVersion> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="$(Configuration.Contains('Debug'))"> | ||
<IncludePackageReferencesDuringMarkupCompilation>false</IncludePackageReferencesDuringMarkupCompilation> | ||
<Revision>$([MSBuild]::Divide($([System.DateTime]::Now.TimeOfDay.TotalSeconds), 4).ToString('F0'))</Revision> | ||
<PackageAssemblyVersion>.Dev.$(Version).$(Revision)</PackageAssemblyVersion> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<Company>Company</Company> | ||
<Authors>Authors</Authors> | ||
<Description>Revit Add-In Description for $(PackageId).</Description> | ||
<CopyrightYears>$([System.DateTime]::Now.ToString('yyyy'))</CopyrightYears> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<AssemblyName>$(PackageId)$(PackageAssemblyVersion)</AssemblyName> | ||
<Product>$(PackageId)</Product> | ||
<Copyright>Copyright © $(CopyrightYears) $(Company)</Copyright> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="ricaun.Revit.UI" Version="*" /> | ||
<PackageReference Include="ricaun.Revit.Mvvm" Version="*" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Folder Include="Revit\Commands" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Include="Revit\App.cs" /> | ||
<None Include="Revit\Commands\Command.cs" /> | ||
</ItemGroup> | ||
|
||
<!-- Fody --> | ||
<ItemGroup> | ||
<PackageReference Include="PropertyChanged.Fody" Version="3.*" IncludeAssets="build; compile" PrivateAssets="All" /> | ||
</ItemGroup> | ||
<PropertyGroup> | ||
<WeaverConfiguration> | ||
<Weavers> | ||
<PropertyChanged /> | ||
</Weavers> | ||
</WeaverConfiguration> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Revit_All_Main_Versions_API_x64" Version="$(RevitVersion).*" IncludeAssets="build; compile" PrivateAssets="All" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Revit.Busy\Revit.Busy.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using Autodesk.Revit.DB; | ||
using Autodesk.Revit.UI; | ||
using ricaun.Revit.UI; | ||
using System; | ||
|
||
namespace Revit.Busy.Example.Revit | ||
{ | ||
[AppLoader] | ||
public class App : IExternalApplication | ||
{ | ||
private static RibbonPanel ribbonPanel; | ||
private static RibbonItem ribbonItem; | ||
public Result OnStartup(UIControlledApplication application) | ||
{ | ||
ribbonPanel = application.CreatePanel("Example"); | ||
ribbonItem = ribbonPanel.CreatePushButton<Commands.Command>("RevitBusy") | ||
.SetLargeImage("/UIFrameworkRes;component/ribbon/images/revit.ico"); | ||
|
||
RevitBusyControl.Initialize(application); | ||
RevitBusyControl.Control.PropertyChanged += RevitBusyControlPropertyChanged; | ||
|
||
UpdateLargeImageBusy(ribbonItem, RevitBusyControl.Control); | ||
|
||
return Result.Succeeded; | ||
} | ||
|
||
private void RevitBusyControlPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) | ||
{ | ||
Console.WriteLine($"RevitBusyControl PropertyChanged {e.PropertyName} {RevitBusyControl.Control.IsRevitBusy}"); | ||
|
||
var control = sender as RevitBusyService; | ||
UpdateLargeImageBusy(ribbonItem, control); | ||
} | ||
|
||
public Result OnShutdown(UIControlledApplication application) | ||
{ | ||
ribbonPanel?.Remove(); | ||
if (RevitBusyControl.Control is not null) | ||
RevitBusyControl.Control.PropertyChanged -= RevitBusyControlPropertyChanged; | ||
return Result.Succeeded; | ||
} | ||
|
||
private static void UpdateLargeImageBusy(RibbonItem ribbonItem, RevitBusyService control) | ||
{ | ||
const string LargeImageIsBusy = "/UIFrameworkRes;component/ribbon/images/close.ico"; | ||
const string LargeImageNoBusy = "/UIFrameworkRes;component/ribbon/images/add.ico"; | ||
if (control.IsRevitBusy) | ||
ribbonItem.SetLargeImage(LargeImageIsBusy); | ||
else | ||
ribbonItem.SetLargeImage(LargeImageNoBusy); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using Autodesk.Revit.Attributes; | ||
using Autodesk.Revit.DB; | ||
using Autodesk.Revit.UI; | ||
using System; | ||
|
||
namespace Revit.Busy.Example.Revit.Commands | ||
{ | ||
[Transaction(TransactionMode.Manual)] | ||
public class Command : IExternalCommand | ||
{ | ||
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet) | ||
{ | ||
UIApplication uiapp = commandData.Application; | ||
|
||
System.Windows.MessageBox.Show(uiapp.Application.VersionName); | ||
|
||
return Result.Succeeded; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters