From 6d5edfa387c2bdc8af578e77c2cf857db710b3c2 Mon Sep 17 00:00:00 2001 From: Nice3point Date: Sun, 10 Mar 2024 12:41:36 +0300 Subject: [PATCH] Template samples --- .../.github/workflows/Workflow.yml | 19 +++ samples/AllInOneSolution/.gitignore | 21 +++ samples/AllInOneSolution/.nuke/build.cmd | 1 + samples/AllInOneSolution/.nuke/build.ps1 | 69 +++++++++ .../AllInOneSolution/.nuke/parameters.json | 5 + .../AllInOneSolution/.run/Nuke Clean.run.xml | 25 ++++ .../AllInOneSolution/.run/Nuke Plan.run.xml | 22 +++ samples/AllInOneSolution/.run/Nuke.run.xml | 22 +++ samples/AllInOneSolution/AllInOneSolution.sln | 141 ++++++++++++++++++ samples/AllInOneSolution/Changelog.md | 3 + samples/AllInOneSolution/Readme.md | 105 +++++++++++++ samples/AllInOneSolution/build/.editorconfig | 15 ++ .../AllInOneSolution/build/Build.Bundle.cs | 104 +++++++++++++ .../AllInOneSolution/build/Build.CI.GitHub.cs | 139 +++++++++++++++++ samples/AllInOneSolution/build/Build.Clean.cs | 29 ++++ .../AllInOneSolution/build/Build.Compile.cs | 29 ++++ .../build/Build.Configuration.cs | 25 ++++ .../AllInOneSolution/build/Build.Installer.cs | 55 +++++++ samples/AllInOneSolution/build/Build.Regex.cs | 13 ++ samples/AllInOneSolution/build/Build.cs | 15 ++ samples/AllInOneSolution/build/Build.csproj | 25 ++++ .../build/Build.csproj.DotSettings | 31 ++++ samples/AllInOneSolution/global.json | 6 + .../install/Installer.Generator.cs | 44 ++++++ samples/AllInOneSolution/install/Installer.cs | 55 +++++++ .../AllInOneSolution/install/Installer.csproj | 16 ++ .../Resources/Icons/BackgroundImage.png | Bin 0 -> 5331 bytes .../install/Resources/Icons/BannerImage.png | Bin 0 -> 1028 bytes .../install/Resources/Icons/ShellIcon.ico | Bin 0 -> 32988 bytes .../CommandHandlers/ShowWindowHandler.cs | 15 ++ .../source/ModalModule/Core/RevitShell.cs | 8 + .../source/ModalModule/ModalModule.csproj | 85 +++++++++++ .../ViewModels/ModalModuleViewModel.cs | 24 +++ .../Converters/BoolVisibilityConverter.cs | 24 +++ .../Converters/EnumVisibilityConverter.cs | 34 +++++ .../Views/Converters/InverseBoolConverter.cs | 23 +++ .../InverseBoolVisibilityConverter.cs | 24 +++ .../ModalModule/Views/ModalModuleView.xaml | 44 ++++++ .../ModalModule/Views/ModalModuleView.xaml.cs | 12 ++ .../CommandHandlers/ShowWindowHandler.cs | 20 +++ .../source/ModelessModule/Core/RevitShell.cs | 8 + .../ModelessModule/ModelessModule.csproj | 86 +++++++++++ .../ModelessModule/Utils/WindowController.cs | 99 ++++++++++++ .../ViewModels/ModelessModuleViewModel.cs | 84 +++++++++++ .../Converters/BoolVisibilityConverter.cs | 24 +++ .../Converters/EnumVisibilityConverter.cs | 34 +++++ .../Views/Converters/InverseBoolConverter.cs | 23 +++ .../InverseBoolVisibilityConverter.cs | 24 +++ .../Views/ModelessModuleView.xaml | 84 +++++++++++ .../Views/ModelessModuleView.xaml.cs | 12 ++ .../source/RevitAddIn/Application.cs | 35 +++++ .../Commands/ShowModalWindowCommand.cs | 18 +++ .../Commands/ShowModelessWindowCommand.cs | 18 +++ .../RevitAddIn/Config/LoggerConfigurator.cs | 33 ++++ .../source/RevitAddIn/Host.cs | 63 ++++++++ .../Resources/Icons/RibbonIcon16.png | Bin 0 -> 2378 bytes .../Resources/Icons/RibbonIcon32.png | Bin 0 -> 2922 bytes .../source/RevitAddIn/RevitAddIn.addin | 11 ++ .../source/RevitAddIn/RevitAddIn.csproj | 126 ++++++++++++++++ .../ModularApplication/ModularApplication.sln | 124 +++++++++++++++ .../Module1/Commands/StartupCommand.cs | 21 +++ .../ModularApplication/Module1/Module1.csproj | 88 +++++++++++ .../Module1/ViewModels/Module1ViewModel.cs | 24 +++ .../Converters/BoolVisibilityConverter.cs | 24 +++ .../Converters/EnumVisibilityConverter.cs | 34 +++++ .../Views/Converters/InverseBoolConverter.cs | 23 +++ .../InverseBoolVisibilityConverter.cs | 24 +++ .../Module1/Views/Module1View.xaml | 44 ++++++ .../Module1/Views/Module1View.xaml.cs | 12 ++ .../Module2/Commands/StartupCommand.cs | 21 +++ .../ModularApplication/Module2/Module2.csproj | 84 +++++++++++ .../Module2/ViewModels/Module2ViewModel.cs | 22 +++ .../Converters/BoolVisibilityConverter.cs | 24 +++ .../Converters/EnumVisibilityConverter.cs | 34 +++++ .../Views/Converters/InverseBoolConverter.cs | 23 +++ .../InverseBoolVisibilityConverter.cs | 24 +++ .../Module2/Views/Module2View.xaml | 44 ++++++ .../Module2/Views/Module2View.xaml.cs | 12 ++ .../Module3/DatabaseConnection.cs | 98 ++++++++++++ .../Module3/Enums/EntryKey.cs | 7 + .../ModularApplication/Module3/Module3.csproj | 78 ++++++++++ .../Module3/Schemas/ProjectInfoSchema.cs | 26 ++++ .../RevitAddIn/Application.cs | 28 ++++ .../Resources/Icons/RibbonIcon16.png | Bin 0 -> 2378 bytes .../Resources/Icons/RibbonIcon32.png | Bin 0 -> 2922 bytes .../RevitAddIn/RevitAddIn.addin | 11 ++ .../RevitAddIn/RevitAddIn.csproj | 123 +++++++++++++++ samples/Readme.md | 67 +++++++++ .../RevitAddIn/Application.cs | 25 ++++ .../RevitAddIn/Commands/StartupCommand.cs | 27 ++++ .../Resources/Icons/RibbonIcon16.png | Bin 0 -> 2378 bytes .../Resources/Icons/RibbonIcon32.png | Bin 0 -> 2922 bytes .../RevitAddIn/RevitAddIn.addin | 11 ++ .../RevitAddIn/RevitAddIn.csproj | 117 +++++++++++++++ .../SingleApplication/SingleApplication.sln | 46 ++++++ .../Application.cs | 26 ++++ .../Commands/StartupCommand.cs | 20 +++ .../Host.cs | 36 +++++ .../Resources/Icons/RibbonIcon16.png | Bin 0 -> 2378 bytes .../Resources/Icons/RibbonIcon32.png | Bin 0 -> 2922 bytes .../RevitAddIn.addin | 11 ++ .../RevitAddIn.csproj | 123 +++++++++++++++ .../SingleDependencyInjectionApplication.sln | 46 ++++++ .../ViewModels/RevitAddInViewModel.cs | 22 +++ .../Converters/BoolVisibilityConverter.cs | 24 +++ .../Converters/EnumVisibilityConverter.cs | 34 +++++ .../Views/Converters/InverseBoolConverter.cs | 23 +++ .../InverseBoolVisibilityConverter.cs | 24 +++ .../Views/RevitAddInView.xaml | 44 ++++++ .../Views/RevitAddInView.xaml.cs | 12 ++ .../SingleHostingApplication/Application.cs | 31 ++++ .../Commands/StartupCommand.cs | 20 +++ samples/SingleHostingApplication/Host.cs | 53 +++++++ .../Resources/Icons/RibbonIcon16.png | Bin 0 -> 2378 bytes .../Resources/Icons/RibbonIcon32.png | Bin 0 -> 2922 bytes .../SingleHostingApplication/RevitAddIn.addin | 11 ++ .../RevitAddIn.csproj | 123 +++++++++++++++ .../SingleHostingApplication.sln | 46 ++++++ .../ViewModels/RevitAddInViewModel.cs | 22 +++ .../Converters/BoolVisibilityConverter.cs | 24 +++ .../Converters/EnumVisibilityConverter.cs | 34 +++++ .../Views/Converters/InverseBoolConverter.cs | 23 +++ .../InverseBoolVisibilityConverter.cs | 24 +++ .../Views/RevitAddInView.xaml | 44 ++++++ .../Views/RevitAddInView.xaml.cs | 12 ++ .../RevitAddIn/Application.cs | 25 ++++ .../RevitAddIn/Commands/StartupCommand.cs | 21 +++ .../Resources/Icons/RibbonIcon16.png | Bin 0 -> 2378 bytes .../Resources/Icons/RibbonIcon32.png | Bin 0 -> 2922 bytes .../RevitAddIn/RevitAddIn.addin | 11 ++ .../RevitAddIn/RevitAddIn.csproj | 122 +++++++++++++++ .../ViewModels/RevitAddInViewModel.cs | 22 +++ .../Converters/BoolVisibilityConverter.cs | 24 +++ .../Converters/EnumVisibilityConverter.cs | 34 +++++ .../Views/Converters/InverseBoolConverter.cs | 23 +++ .../InverseBoolVisibilityConverter.cs | 24 +++ .../RevitAddIn/Views/RevitAddInView.xaml | 44 ++++++ .../RevitAddIn/Views/RevitAddInView.xaml.cs | 12 ++ .../SingleUiApplication.sln | 46 ++++++ .../RevitAddIn/Application.cs | 25 ++++ .../RevitAddIn/Commands/StartupCommand.cs | 24 +++ .../Resources/Icons/RibbonIcon16.png | Bin 0 -> 2378 bytes .../Resources/Icons/RibbonIcon32.png | Bin 0 -> 2922 bytes .../RevitAddIn/RevitAddIn.csproj | 122 +++++++++++++++ .../RevitAddIn/RevitAddin.addin | 11 ++ .../RevitAddIn/Utils/WindowController.cs | 99 ++++++++++++ .../ViewModels/RevitAddinViewModel.cs | 79 ++++++++++ .../Converters/BoolVisibilityConverter.cs | 24 +++ .../Converters/EnumVisibilityConverter.cs | 36 +++++ .../Views/Converters/InverseBoolConverter.cs | 23 +++ .../InverseBoolVisibilityConverter.cs | 24 +++ .../RevitAddIn/Views/RevitAddinView.xaml | 84 +++++++++++ .../RevitAddIn/Views/RevitAddinView.xaml.cs | 12 ++ .../SingleUiModelessApplication.sln | 46 ++++++ 154 files changed, 5428 insertions(+) create mode 100644 samples/AllInOneSolution/.github/workflows/Workflow.yml create mode 100644 samples/AllInOneSolution/.gitignore create mode 100644 samples/AllInOneSolution/.nuke/build.cmd create mode 100644 samples/AllInOneSolution/.nuke/build.ps1 create mode 100644 samples/AllInOneSolution/.nuke/parameters.json create mode 100644 samples/AllInOneSolution/.run/Nuke Clean.run.xml create mode 100644 samples/AllInOneSolution/.run/Nuke Plan.run.xml create mode 100644 samples/AllInOneSolution/.run/Nuke.run.xml create mode 100644 samples/AllInOneSolution/AllInOneSolution.sln create mode 100644 samples/AllInOneSolution/Changelog.md create mode 100644 samples/AllInOneSolution/Readme.md create mode 100644 samples/AllInOneSolution/build/.editorconfig create mode 100644 samples/AllInOneSolution/build/Build.Bundle.cs create mode 100644 samples/AllInOneSolution/build/Build.CI.GitHub.cs create mode 100644 samples/AllInOneSolution/build/Build.Clean.cs create mode 100644 samples/AllInOneSolution/build/Build.Compile.cs create mode 100644 samples/AllInOneSolution/build/Build.Configuration.cs create mode 100644 samples/AllInOneSolution/build/Build.Installer.cs create mode 100644 samples/AllInOneSolution/build/Build.Regex.cs create mode 100644 samples/AllInOneSolution/build/Build.cs create mode 100644 samples/AllInOneSolution/build/Build.csproj create mode 100644 samples/AllInOneSolution/build/Build.csproj.DotSettings create mode 100644 samples/AllInOneSolution/global.json create mode 100644 samples/AllInOneSolution/install/Installer.Generator.cs create mode 100644 samples/AllInOneSolution/install/Installer.cs create mode 100644 samples/AllInOneSolution/install/Installer.csproj create mode 100644 samples/AllInOneSolution/install/Resources/Icons/BackgroundImage.png create mode 100644 samples/AllInOneSolution/install/Resources/Icons/BannerImage.png create mode 100644 samples/AllInOneSolution/install/Resources/Icons/ShellIcon.ico create mode 100644 samples/AllInOneSolution/source/ModalModule/CommandHandlers/ShowWindowHandler.cs create mode 100644 samples/AllInOneSolution/source/ModalModule/Core/RevitShell.cs create mode 100644 samples/AllInOneSolution/source/ModalModule/ModalModule.csproj create mode 100644 samples/AllInOneSolution/source/ModalModule/ViewModels/ModalModuleViewModel.cs create mode 100644 samples/AllInOneSolution/source/ModalModule/Views/Converters/BoolVisibilityConverter.cs create mode 100644 samples/AllInOneSolution/source/ModalModule/Views/Converters/EnumVisibilityConverter.cs create mode 100644 samples/AllInOneSolution/source/ModalModule/Views/Converters/InverseBoolConverter.cs create mode 100644 samples/AllInOneSolution/source/ModalModule/Views/Converters/InverseBoolVisibilityConverter.cs create mode 100644 samples/AllInOneSolution/source/ModalModule/Views/ModalModuleView.xaml create mode 100644 samples/AllInOneSolution/source/ModalModule/Views/ModalModuleView.xaml.cs create mode 100644 samples/AllInOneSolution/source/ModelessModule/CommandHandlers/ShowWindowHandler.cs create mode 100644 samples/AllInOneSolution/source/ModelessModule/Core/RevitShell.cs create mode 100644 samples/AllInOneSolution/source/ModelessModule/ModelessModule.csproj create mode 100644 samples/AllInOneSolution/source/ModelessModule/Utils/WindowController.cs create mode 100644 samples/AllInOneSolution/source/ModelessModule/ViewModels/ModelessModuleViewModel.cs create mode 100644 samples/AllInOneSolution/source/ModelessModule/Views/Converters/BoolVisibilityConverter.cs create mode 100644 samples/AllInOneSolution/source/ModelessModule/Views/Converters/EnumVisibilityConverter.cs create mode 100644 samples/AllInOneSolution/source/ModelessModule/Views/Converters/InverseBoolConverter.cs create mode 100644 samples/AllInOneSolution/source/ModelessModule/Views/Converters/InverseBoolVisibilityConverter.cs create mode 100644 samples/AllInOneSolution/source/ModelessModule/Views/ModelessModuleView.xaml create mode 100644 samples/AllInOneSolution/source/ModelessModule/Views/ModelessModuleView.xaml.cs create mode 100644 samples/AllInOneSolution/source/RevitAddIn/Application.cs create mode 100644 samples/AllInOneSolution/source/RevitAddIn/Commands/ShowModalWindowCommand.cs create mode 100644 samples/AllInOneSolution/source/RevitAddIn/Commands/ShowModelessWindowCommand.cs create mode 100644 samples/AllInOneSolution/source/RevitAddIn/Config/LoggerConfigurator.cs create mode 100644 samples/AllInOneSolution/source/RevitAddIn/Host.cs create mode 100644 samples/AllInOneSolution/source/RevitAddIn/Resources/Icons/RibbonIcon16.png create mode 100644 samples/AllInOneSolution/source/RevitAddIn/Resources/Icons/RibbonIcon32.png create mode 100644 samples/AllInOneSolution/source/RevitAddIn/RevitAddIn.addin create mode 100644 samples/AllInOneSolution/source/RevitAddIn/RevitAddIn.csproj create mode 100644 samples/ModularApplication/ModularApplication.sln create mode 100644 samples/ModularApplication/Module1/Commands/StartupCommand.cs create mode 100644 samples/ModularApplication/Module1/Module1.csproj create mode 100644 samples/ModularApplication/Module1/ViewModels/Module1ViewModel.cs create mode 100644 samples/ModularApplication/Module1/Views/Converters/BoolVisibilityConverter.cs create mode 100644 samples/ModularApplication/Module1/Views/Converters/EnumVisibilityConverter.cs create mode 100644 samples/ModularApplication/Module1/Views/Converters/InverseBoolConverter.cs create mode 100644 samples/ModularApplication/Module1/Views/Converters/InverseBoolVisibilityConverter.cs create mode 100644 samples/ModularApplication/Module1/Views/Module1View.xaml create mode 100644 samples/ModularApplication/Module1/Views/Module1View.xaml.cs create mode 100644 samples/ModularApplication/Module2/Commands/StartupCommand.cs create mode 100644 samples/ModularApplication/Module2/Module2.csproj create mode 100644 samples/ModularApplication/Module2/ViewModels/Module2ViewModel.cs create mode 100644 samples/ModularApplication/Module2/Views/Converters/BoolVisibilityConverter.cs create mode 100644 samples/ModularApplication/Module2/Views/Converters/EnumVisibilityConverter.cs create mode 100644 samples/ModularApplication/Module2/Views/Converters/InverseBoolConverter.cs create mode 100644 samples/ModularApplication/Module2/Views/Converters/InverseBoolVisibilityConverter.cs create mode 100644 samples/ModularApplication/Module2/Views/Module2View.xaml create mode 100644 samples/ModularApplication/Module2/Views/Module2View.xaml.cs create mode 100644 samples/ModularApplication/Module3/DatabaseConnection.cs create mode 100644 samples/ModularApplication/Module3/Enums/EntryKey.cs create mode 100644 samples/ModularApplication/Module3/Module3.csproj create mode 100644 samples/ModularApplication/Module3/Schemas/ProjectInfoSchema.cs create mode 100644 samples/ModularApplication/RevitAddIn/Application.cs create mode 100644 samples/ModularApplication/RevitAddIn/Resources/Icons/RibbonIcon16.png create mode 100644 samples/ModularApplication/RevitAddIn/Resources/Icons/RibbonIcon32.png create mode 100644 samples/ModularApplication/RevitAddIn/RevitAddIn.addin create mode 100644 samples/ModularApplication/RevitAddIn/RevitAddIn.csproj create mode 100644 samples/Readme.md create mode 100644 samples/SingleApplication/RevitAddIn/Application.cs create mode 100644 samples/SingleApplication/RevitAddIn/Commands/StartupCommand.cs create mode 100644 samples/SingleApplication/RevitAddIn/Resources/Icons/RibbonIcon16.png create mode 100644 samples/SingleApplication/RevitAddIn/Resources/Icons/RibbonIcon32.png create mode 100644 samples/SingleApplication/RevitAddIn/RevitAddIn.addin create mode 100644 samples/SingleApplication/RevitAddIn/RevitAddIn.csproj create mode 100644 samples/SingleApplication/SingleApplication.sln create mode 100644 samples/SingleDependencyInjectionApplication/Application.cs create mode 100644 samples/SingleDependencyInjectionApplication/Commands/StartupCommand.cs create mode 100644 samples/SingleDependencyInjectionApplication/Host.cs create mode 100644 samples/SingleDependencyInjectionApplication/Resources/Icons/RibbonIcon16.png create mode 100644 samples/SingleDependencyInjectionApplication/Resources/Icons/RibbonIcon32.png create mode 100644 samples/SingleDependencyInjectionApplication/RevitAddIn.addin create mode 100644 samples/SingleDependencyInjectionApplication/RevitAddIn.csproj create mode 100644 samples/SingleDependencyInjectionApplication/SingleDependencyInjectionApplication.sln create mode 100644 samples/SingleDependencyInjectionApplication/ViewModels/RevitAddInViewModel.cs create mode 100644 samples/SingleDependencyInjectionApplication/Views/Converters/BoolVisibilityConverter.cs create mode 100644 samples/SingleDependencyInjectionApplication/Views/Converters/EnumVisibilityConverter.cs create mode 100644 samples/SingleDependencyInjectionApplication/Views/Converters/InverseBoolConverter.cs create mode 100644 samples/SingleDependencyInjectionApplication/Views/Converters/InverseBoolVisibilityConverter.cs create mode 100644 samples/SingleDependencyInjectionApplication/Views/RevitAddInView.xaml create mode 100644 samples/SingleDependencyInjectionApplication/Views/RevitAddInView.xaml.cs create mode 100644 samples/SingleHostingApplication/Application.cs create mode 100644 samples/SingleHostingApplication/Commands/StartupCommand.cs create mode 100644 samples/SingleHostingApplication/Host.cs create mode 100644 samples/SingleHostingApplication/Resources/Icons/RibbonIcon16.png create mode 100644 samples/SingleHostingApplication/Resources/Icons/RibbonIcon32.png create mode 100644 samples/SingleHostingApplication/RevitAddIn.addin create mode 100644 samples/SingleHostingApplication/RevitAddIn.csproj create mode 100644 samples/SingleHostingApplication/SingleHostingApplication.sln create mode 100644 samples/SingleHostingApplication/ViewModels/RevitAddInViewModel.cs create mode 100644 samples/SingleHostingApplication/Views/Converters/BoolVisibilityConverter.cs create mode 100644 samples/SingleHostingApplication/Views/Converters/EnumVisibilityConverter.cs create mode 100644 samples/SingleHostingApplication/Views/Converters/InverseBoolConverter.cs create mode 100644 samples/SingleHostingApplication/Views/Converters/InverseBoolVisibilityConverter.cs create mode 100644 samples/SingleHostingApplication/Views/RevitAddInView.xaml create mode 100644 samples/SingleHostingApplication/Views/RevitAddInView.xaml.cs create mode 100644 samples/SingleUiApplication/RevitAddIn/Application.cs create mode 100644 samples/SingleUiApplication/RevitAddIn/Commands/StartupCommand.cs create mode 100644 samples/SingleUiApplication/RevitAddIn/Resources/Icons/RibbonIcon16.png create mode 100644 samples/SingleUiApplication/RevitAddIn/Resources/Icons/RibbonIcon32.png create mode 100644 samples/SingleUiApplication/RevitAddIn/RevitAddIn.addin create mode 100644 samples/SingleUiApplication/RevitAddIn/RevitAddIn.csproj create mode 100644 samples/SingleUiApplication/RevitAddIn/ViewModels/RevitAddInViewModel.cs create mode 100644 samples/SingleUiApplication/RevitAddIn/Views/Converters/BoolVisibilityConverter.cs create mode 100644 samples/SingleUiApplication/RevitAddIn/Views/Converters/EnumVisibilityConverter.cs create mode 100644 samples/SingleUiApplication/RevitAddIn/Views/Converters/InverseBoolConverter.cs create mode 100644 samples/SingleUiApplication/RevitAddIn/Views/Converters/InverseBoolVisibilityConverter.cs create mode 100644 samples/SingleUiApplication/RevitAddIn/Views/RevitAddInView.xaml create mode 100644 samples/SingleUiApplication/RevitAddIn/Views/RevitAddInView.xaml.cs create mode 100644 samples/SingleUiApplication/SingleUiApplication.sln create mode 100644 samples/SingleUiModelessApplication/RevitAddIn/Application.cs create mode 100644 samples/SingleUiModelessApplication/RevitAddIn/Commands/StartupCommand.cs create mode 100644 samples/SingleUiModelessApplication/RevitAddIn/Resources/Icons/RibbonIcon16.png create mode 100644 samples/SingleUiModelessApplication/RevitAddIn/Resources/Icons/RibbonIcon32.png create mode 100644 samples/SingleUiModelessApplication/RevitAddIn/RevitAddIn.csproj create mode 100644 samples/SingleUiModelessApplication/RevitAddIn/RevitAddin.addin create mode 100644 samples/SingleUiModelessApplication/RevitAddIn/Utils/WindowController.cs create mode 100644 samples/SingleUiModelessApplication/RevitAddIn/ViewModels/RevitAddinViewModel.cs create mode 100644 samples/SingleUiModelessApplication/RevitAddIn/Views/Converters/BoolVisibilityConverter.cs create mode 100644 samples/SingleUiModelessApplication/RevitAddIn/Views/Converters/EnumVisibilityConverter.cs create mode 100644 samples/SingleUiModelessApplication/RevitAddIn/Views/Converters/InverseBoolConverter.cs create mode 100644 samples/SingleUiModelessApplication/RevitAddIn/Views/Converters/InverseBoolVisibilityConverter.cs create mode 100644 samples/SingleUiModelessApplication/RevitAddIn/Views/RevitAddinView.xaml create mode 100644 samples/SingleUiModelessApplication/RevitAddIn/Views/RevitAddinView.xaml.cs create mode 100644 samples/SingleUiModelessApplication/SingleUiModelessApplication.sln diff --git a/samples/AllInOneSolution/.github/workflows/Workflow.yml b/samples/AllInOneSolution/.github/workflows/Workflow.yml new file mode 100644 index 0000000..68cb7b7 --- /dev/null +++ b/samples/AllInOneSolution/.github/workflows/Workflow.yml @@ -0,0 +1,19 @@ +name: Workflow + +on: + push: + branches: + - '**' + pull_request: + branches: + - '!main' + +jobs: + windows: + name: windows-2022 + runs-on: windows-2022 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Run Nuke build + run: ./.nuke/build.cmd Compile PublishGitHub --GitHubToken ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/samples/AllInOneSolution/.gitignore b/samples/AllInOneSolution/.gitignore new file mode 100644 index 0000000..3ca39af --- /dev/null +++ b/samples/AllInOneSolution/.gitignore @@ -0,0 +1,21 @@ +#IDE folders +*.idea/ +*.vs/ +*.vscode/ + +#Project-specific folders +*obj/ +*bin/ +*temp/ + +#Deprecated Nuget folder +/packages/ + +#Nuke output folder +/output/ + +#Project-specific files +*/build.schema.json + +#User-specific files +*.user \ No newline at end of file diff --git a/samples/AllInOneSolution/.nuke/build.cmd b/samples/AllInOneSolution/.nuke/build.cmd new file mode 100644 index 0000000..9930d5b --- /dev/null +++ b/samples/AllInOneSolution/.nuke/build.cmd @@ -0,0 +1 @@ +powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0Build.ps1" %* diff --git a/samples/AllInOneSolution/.nuke/build.ps1 b/samples/AllInOneSolution/.nuke/build.ps1 new file mode 100644 index 0000000..4763cd5 --- /dev/null +++ b/samples/AllInOneSolution/.nuke/build.ps1 @@ -0,0 +1,69 @@ +[CmdletBinding()] +Param( + [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] + [string[]]$BuildArguments +) + +Write-Output "PowerShell $($PSVersionTable.PSEdition) version $($PSVersionTable.PSVersion)" + +Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { Write-Error $_ -ErrorAction Continue; exit 1 } + +########################################################################### +# CONFIGURATION +########################################################################### + +$SolutionDirectory = Split-Path $PSScriptRoot -Parent +$BuildProjectFile = "$SolutionDirectory\Build\Build.csproj" +$TempDirectory = "$SolutionDirectory\.nuke\temp" + +$DotNetGlobalFile = "$SolutionDirectory\global.json" +$DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1" +$DotNetChannel = "Current" + +$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1 +$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1 +$env:DOTNET_MULTILEVEL_LOOKUP = 0 + +########################################################################### +# EXECUTION +########################################################################### + +function ExecSafe([scriptblock] $cmd) { + & $cmd + if ($LASTEXITCODE) { exit $LASTEXITCODE } +} + +# If dotnet CLI is installed globally and it matches requested version, use for execution +if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and ` + $(dotnet --version) -and $LASTEXITCODE -eq 0) { + $env:DOTNET_EXE = (Get-Command "dotnet").Path +} +else { + # Download install script + $DotNetInstallFile = "$TempDirectory\dotnet-install.ps1" + New-Item -ItemType Directory -Path $TempDirectory -Force | Out-Null + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 + (New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile) + + # If global.json exists, load expected version + if (Test-Path $DotNetGlobalFile) { + $DotNetGlobal = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json) + if ($DotNetGlobal.PSObject.Properties["sdk"] -and $DotNetGlobal.sdk.PSObject.Properties["version"]) { + $DotNetVersion = $DotNetGlobal.sdk.version + } + } + + # Install by channel or version + $DotNetDirectory = "$TempDirectory\dotnet-win" + if (!(Test-Path variable:DotNetVersion)) { + ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath } + } else { + ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath } + } + $env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe" +} + +Write-Output "Microsoft (R) .NET SDK version $(& $env:DOTNET_EXE --version)" + +ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet } +ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments } \ No newline at end of file diff --git a/samples/AllInOneSolution/.nuke/parameters.json b/samples/AllInOneSolution/.nuke/parameters.json new file mode 100644 index 0000000..c7ad8d8 --- /dev/null +++ b/samples/AllInOneSolution/.nuke/parameters.json @@ -0,0 +1,5 @@ +{ + "$schema": "./build.schema.json", + "Solution": "AllInOneSolution.sln", + "Verbosity": "Normal" +} \ No newline at end of file diff --git a/samples/AllInOneSolution/.run/Nuke Clean.run.xml b/samples/AllInOneSolution/.run/Nuke Clean.run.xml new file mode 100644 index 0000000..2f92b35 --- /dev/null +++ b/samples/AllInOneSolution/.run/Nuke Clean.run.xml @@ -0,0 +1,25 @@ + + + + \ No newline at end of file diff --git a/samples/AllInOneSolution/.run/Nuke Plan.run.xml b/samples/AllInOneSolution/.run/Nuke Plan.run.xml new file mode 100644 index 0000000..0f37d01 --- /dev/null +++ b/samples/AllInOneSolution/.run/Nuke Plan.run.xml @@ -0,0 +1,22 @@ + + + + \ No newline at end of file diff --git a/samples/AllInOneSolution/.run/Nuke.run.xml b/samples/AllInOneSolution/.run/Nuke.run.xml new file mode 100644 index 0000000..4e8a7a5 --- /dev/null +++ b/samples/AllInOneSolution/.run/Nuke.run.xml @@ -0,0 +1,22 @@ + + + + \ No newline at end of file diff --git a/samples/AllInOneSolution/AllInOneSolution.sln b/samples/AllInOneSolution/AllInOneSolution.sln new file mode 100644 index 0000000..6480e84 --- /dev/null +++ b/samples/AllInOneSolution/AllInOneSolution.sln @@ -0,0 +1,141 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C8C1B8A6-4218-414C-AACC-7F8F6EE16D79}" + ProjectSection(SolutionItems) = preProject + .gitignore = .gitignore + Changelog.md = Changelog.md + Readme.md = Readme.md + Build\Build.Configuration.cs = Build\Build.Configuration.cs + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build", "build\Build.csproj", "{67EDBAB7-E0A8-46E7-B7F2-3F004B0B0FA4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Installer", "install\Installer.csproj", "{AC520AB0-D2D3-403E-8B5B-8895ACBB8E89}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RevitAddIn", "source\RevitAddIn\RevitAddIn.csproj", "{DDCE6DF1-727A-4C02-91FE-A8957980B2ED}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModalModule", "source\ModalModule\ModalModule.csproj", "{7670A05E-950C-4CDC-A9FE-D1D6FFE9B836}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModelessModule", "source\ModelessModule\ModelessModule.csproj", "{C0E878A2-AAEF-4E84-8B06-3EDB6E9C708A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug R20|Any CPU = Debug R20|Any CPU + Debug R21|Any CPU = Debug R21|Any CPU + Debug R22|Any CPU = Debug R22|Any CPU + Debug R23|Any CPU = Debug R23|Any CPU + Debug R24|Any CPU = Debug R24|Any CPU + Debug R25|Any CPU = Debug R25|Any CPU + Release R20|Any CPU = Release R20|Any CPU + Release R21|Any CPU = Release R21|Any CPU + Release R22|Any CPU = Release R22|Any CPU + Release R23|Any CPU = Release R23|Any CPU + Release R24|Any CPU = Release R24|Any CPU + Release R25|Any CPU = Release R25|Any CPU + Installer|Any CPU = Installer|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {67EDBAB7-E0A8-46E7-B7F2-3F004B0B0FA4}.Debug R20|Any CPU.ActiveCfg = Debug|Any CPU + {67EDBAB7-E0A8-46E7-B7F2-3F004B0B0FA4}.Debug R21|Any CPU.ActiveCfg = Debug|Any CPU + {67EDBAB7-E0A8-46E7-B7F2-3F004B0B0FA4}.Debug R22|Any CPU.ActiveCfg = Debug|Any CPU + {67EDBAB7-E0A8-46E7-B7F2-3F004B0B0FA4}.Debug R23|Any CPU.ActiveCfg = Debug|Any CPU + {67EDBAB7-E0A8-46E7-B7F2-3F004B0B0FA4}.Debug R24|Any CPU.ActiveCfg = Debug|Any CPU + {67EDBAB7-E0A8-46E7-B7F2-3F004B0B0FA4}.Debug R25|Any CPU.ActiveCfg = Debug|Any CPU + {67EDBAB7-E0A8-46E7-B7F2-3F004B0B0FA4}.Release R20|Any CPU.ActiveCfg = Release|Any CPU + {67EDBAB7-E0A8-46E7-B7F2-3F004B0B0FA4}.Release R21|Any CPU.ActiveCfg = Release|Any CPU + {67EDBAB7-E0A8-46E7-B7F2-3F004B0B0FA4}.Release R22|Any CPU.ActiveCfg = Release|Any CPU + {67EDBAB7-E0A8-46E7-B7F2-3F004B0B0FA4}.Release R23|Any CPU.ActiveCfg = Release|Any CPU + {67EDBAB7-E0A8-46E7-B7F2-3F004B0B0FA4}.Release R24|Any CPU.ActiveCfg = Release|Any CPU + {67EDBAB7-E0A8-46E7-B7F2-3F004B0B0FA4}.Release R25|Any CPU.ActiveCfg = Release|Any CPU + {67EDBAB7-E0A8-46E7-B7F2-3F004B0B0FA4}.Installer|Any CPU.ActiveCfg = Release|Any CPU + {AC520AB0-D2D3-403E-8B5B-8895ACBB8E89}.Debug R20|Any CPU.ActiveCfg = Debug|Any CPU + {AC520AB0-D2D3-403E-8B5B-8895ACBB8E89}.Debug R21|Any CPU.ActiveCfg = Debug|Any CPU + {AC520AB0-D2D3-403E-8B5B-8895ACBB8E89}.Debug R22|Any CPU.ActiveCfg = Debug|Any CPU + {AC520AB0-D2D3-403E-8B5B-8895ACBB8E89}.Debug R23|Any CPU.ActiveCfg = Debug|Any CPU + {AC520AB0-D2D3-403E-8B5B-8895ACBB8E89}.Debug R24|Any CPU.ActiveCfg = Debug|Any CPU + {AC520AB0-D2D3-403E-8B5B-8895ACBB8E89}.Debug R25|Any CPU.ActiveCfg = Debug|Any CPU + {AC520AB0-D2D3-403E-8B5B-8895ACBB8E89}.Release R20|Any CPU.ActiveCfg = Release|Any CPU + {AC520AB0-D2D3-403E-8B5B-8895ACBB8E89}.Release R21|Any CPU.ActiveCfg = Release|Any CPU + {AC520AB0-D2D3-403E-8B5B-8895ACBB8E89}.Release R22|Any CPU.ActiveCfg = Release|Any CPU + {AC520AB0-D2D3-403E-8B5B-8895ACBB8E89}.Release R23|Any CPU.ActiveCfg = Release|Any CPU + {AC520AB0-D2D3-403E-8B5B-8895ACBB8E89}.Release R24|Any CPU.ActiveCfg = Release|Any CPU + {AC520AB0-D2D3-403E-8B5B-8895ACBB8E89}.Release R25|Any CPU.ActiveCfg = Release|Any CPU + {AC520AB0-D2D3-403E-8B5B-8895ACBB8E89}.Installer|Any CPU.ActiveCfg = Release|Any CPU + {AC520AB0-D2D3-403E-8B5B-8895ACBB8E89}.Installer|Any CPU.Build.0 = Release|Any CPU + {7670A05E-950C-4CDC-A9FE-D1D6FFE9B836}.Debug R20|Any CPU.ActiveCfg = Debug R20|Any CPU + {7670A05E-950C-4CDC-A9FE-D1D6FFE9B836}.Debug R20|Any CPU.Build.0 = Debug R20|Any CPU + {7670A05E-950C-4CDC-A9FE-D1D6FFE9B836}.Debug R21|Any CPU.ActiveCfg = Debug R21|Any CPU + {7670A05E-950C-4CDC-A9FE-D1D6FFE9B836}.Debug R21|Any CPU.Build.0 = Debug R21|Any CPU + {7670A05E-950C-4CDC-A9FE-D1D6FFE9B836}.Debug R22|Any CPU.ActiveCfg = Debug R22|Any CPU + {7670A05E-950C-4CDC-A9FE-D1D6FFE9B836}.Debug R22|Any CPU.Build.0 = Debug R22|Any CPU + {7670A05E-950C-4CDC-A9FE-D1D6FFE9B836}.Debug R23|Any CPU.ActiveCfg = Debug R23|Any CPU + {7670A05E-950C-4CDC-A9FE-D1D6FFE9B836}.Debug R23|Any CPU.Build.0 = Debug R23|Any CPU + {7670A05E-950C-4CDC-A9FE-D1D6FFE9B836}.Debug R25|Any CPU.ActiveCfg = Debug R25|Any CPU + {7670A05E-950C-4CDC-A9FE-D1D6FFE9B836}.Debug R25|Any CPU.Build.0 = Debug R25|Any CPU + {7670A05E-950C-4CDC-A9FE-D1D6FFE9B836}.Debug R24|Any CPU.ActiveCfg = Debug R24|Any CPU + {7670A05E-950C-4CDC-A9FE-D1D6FFE9B836}.Debug R24|Any CPU.Build.0 = Debug R24|Any CPU + {7670A05E-950C-4CDC-A9FE-D1D6FFE9B836}.Installer|Any CPU.ActiveCfg = Release R25|Any CPU + {7670A05E-950C-4CDC-A9FE-D1D6FFE9B836}.Release R20|Any CPU.ActiveCfg = Release R20|Any CPU + {7670A05E-950C-4CDC-A9FE-D1D6FFE9B836}.Release R21|Any CPU.ActiveCfg = Release R21|Any CPU + {7670A05E-950C-4CDC-A9FE-D1D6FFE9B836}.Release R22|Any CPU.ActiveCfg = Release R22|Any CPU + {7670A05E-950C-4CDC-A9FE-D1D6FFE9B836}.Release R23|Any CPU.ActiveCfg = Release R23|Any CPU + {7670A05E-950C-4CDC-A9FE-D1D6FFE9B836}.Release R24|Any CPU.ActiveCfg = Release R24|Any CPU + {7670A05E-950C-4CDC-A9FE-D1D6FFE9B836}.Release R25|Any CPU.ActiveCfg = Release R25|Any CPU + {7670A05E-950C-4CDC-A9FE-D1D6FFE9B836}.Release R20|Any CPU.Build.0 = Release R20|Any CPU + {7670A05E-950C-4CDC-A9FE-D1D6FFE9B836}.Release R21|Any CPU.Build.0 = Release R21|Any CPU + {7670A05E-950C-4CDC-A9FE-D1D6FFE9B836}.Release R22|Any CPU.Build.0 = Release R22|Any CPU + {7670A05E-950C-4CDC-A9FE-D1D6FFE9B836}.Release R23|Any CPU.Build.0 = Release R23|Any CPU + {7670A05E-950C-4CDC-A9FE-D1D6FFE9B836}.Release R24|Any CPU.Build.0 = Release R24|Any CPU + {7670A05E-950C-4CDC-A9FE-D1D6FFE9B836}.Release R25|Any CPU.Build.0 = Release R25|Any CPU + {C0E878A2-AAEF-4E84-8B06-3EDB6E9C708A}.Debug R20|Any CPU.ActiveCfg = Debug R20|Any CPU + {C0E878A2-AAEF-4E84-8B06-3EDB6E9C708A}.Debug R20|Any CPU.Build.0 = Debug R20|Any CPU + {C0E878A2-AAEF-4E84-8B06-3EDB6E9C708A}.Debug R21|Any CPU.ActiveCfg = Debug R21|Any CPU + {C0E878A2-AAEF-4E84-8B06-3EDB6E9C708A}.Debug R21|Any CPU.Build.0 = Debug R21|Any CPU + {C0E878A2-AAEF-4E84-8B06-3EDB6E9C708A}.Debug R22|Any CPU.ActiveCfg = Debug R22|Any CPU + {C0E878A2-AAEF-4E84-8B06-3EDB6E9C708A}.Debug R22|Any CPU.Build.0 = Debug R22|Any CPU + {C0E878A2-AAEF-4E84-8B06-3EDB6E9C708A}.Debug R23|Any CPU.ActiveCfg = Debug R23|Any CPU + {C0E878A2-AAEF-4E84-8B06-3EDB6E9C708A}.Debug R23|Any CPU.Build.0 = Debug R23|Any CPU + {C0E878A2-AAEF-4E84-8B06-3EDB6E9C708A}.Debug R24|Any CPU.ActiveCfg = Debug R24|Any CPU + {C0E878A2-AAEF-4E84-8B06-3EDB6E9C708A}.Debug R24|Any CPU.Build.0 = Debug R24|Any CPU + {C0E878A2-AAEF-4E84-8B06-3EDB6E9C708A}.Debug R25|Any CPU.ActiveCfg = Debug R25|Any CPU + {C0E878A2-AAEF-4E84-8B06-3EDB6E9C708A}.Debug R25|Any CPU.Build.0 = Debug R25|Any CPU + {C0E878A2-AAEF-4E84-8B06-3EDB6E9C708A}.Installer|Any CPU.ActiveCfg = Release R25|Any CPU + {C0E878A2-AAEF-4E84-8B06-3EDB6E9C708A}.Release R20|Any CPU.ActiveCfg = Release R20|Any CPU + {C0E878A2-AAEF-4E84-8B06-3EDB6E9C708A}.Release R21|Any CPU.ActiveCfg = Release R21|Any CPU + {C0E878A2-AAEF-4E84-8B06-3EDB6E9C708A}.Release R22|Any CPU.ActiveCfg = Release R22|Any CPU + {C0E878A2-AAEF-4E84-8B06-3EDB6E9C708A}.Release R23|Any CPU.ActiveCfg = Release R23|Any CPU + {C0E878A2-AAEF-4E84-8B06-3EDB6E9C708A}.Release R24|Any CPU.ActiveCfg = Release R24|Any CPU + {C0E878A2-AAEF-4E84-8B06-3EDB6E9C708A}.Release R25|Any CPU.ActiveCfg = Release R25|Any CPU + {C0E878A2-AAEF-4E84-8B06-3EDB6E9C708A}.Release R20|Any CPU.Build.0 = Release R20|Any CPU + {C0E878A2-AAEF-4E84-8B06-3EDB6E9C708A}.Release R21|Any CPU.Build.0 = Release R21|Any CPU + {C0E878A2-AAEF-4E84-8B06-3EDB6E9C708A}.Release R22|Any CPU.Build.0 = Release R22|Any CPU + {C0E878A2-AAEF-4E84-8B06-3EDB6E9C708A}.Release R23|Any CPU.Build.0 = Release R23|Any CPU + {C0E878A2-AAEF-4E84-8B06-3EDB6E9C708A}.Release R24|Any CPU.Build.0 = Release R24|Any CPU + {C0E878A2-AAEF-4E84-8B06-3EDB6E9C708A}.Release R25|Any CPU.Build.0 = Release R25|Any CPU + {DDCE6DF1-727A-4C02-91FE-A8957980B2ED}.Debug R20|Any CPU.ActiveCfg = Debug R20|Any CPU + {DDCE6DF1-727A-4C02-91FE-A8957980B2ED}.Debug R20|Any CPU.Build.0 = Debug R20|Any CPU + {DDCE6DF1-727A-4C02-91FE-A8957980B2ED}.Debug R21|Any CPU.ActiveCfg = Debug R21|Any CPU + {DDCE6DF1-727A-4C02-91FE-A8957980B2ED}.Debug R21|Any CPU.Build.0 = Debug R21|Any CPU + {DDCE6DF1-727A-4C02-91FE-A8957980B2ED}.Debug R22|Any CPU.ActiveCfg = Debug R22|Any CPU + {DDCE6DF1-727A-4C02-91FE-A8957980B2ED}.Debug R22|Any CPU.Build.0 = Debug R22|Any CPU + {DDCE6DF1-727A-4C02-91FE-A8957980B2ED}.Debug R23|Any CPU.ActiveCfg = Debug R23|Any CPU + {DDCE6DF1-727A-4C02-91FE-A8957980B2ED}.Debug R23|Any CPU.Build.0 = Debug R23|Any CPU + {DDCE6DF1-727A-4C02-91FE-A8957980B2ED}.Debug R24|Any CPU.ActiveCfg = Debug R24|Any CPU + {DDCE6DF1-727A-4C02-91FE-A8957980B2ED}.Debug R24|Any CPU.Build.0 = Debug R24|Any CPU + {DDCE6DF1-727A-4C02-91FE-A8957980B2ED}.Debug R25|Any CPU.ActiveCfg = Debug R25|Any CPU + {DDCE6DF1-727A-4C02-91FE-A8957980B2ED}.Debug R25|Any CPU.Build.0 = Debug R25|Any CPU + {DDCE6DF1-727A-4C02-91FE-A8957980B2ED}.Installer|Any CPU.ActiveCfg = Release R25|Any CPU + {DDCE6DF1-727A-4C02-91FE-A8957980B2ED}.Release R20|Any CPU.ActiveCfg = Release R20|Any CPU + {DDCE6DF1-727A-4C02-91FE-A8957980B2ED}.Release R21|Any CPU.ActiveCfg = Release R21|Any CPU + {DDCE6DF1-727A-4C02-91FE-A8957980B2ED}.Release R22|Any CPU.ActiveCfg = Release R22|Any CPU + {DDCE6DF1-727A-4C02-91FE-A8957980B2ED}.Release R23|Any CPU.ActiveCfg = Release R23|Any CPU + {DDCE6DF1-727A-4C02-91FE-A8957980B2ED}.Release R24|Any CPU.ActiveCfg = Release R24|Any CPU + {DDCE6DF1-727A-4C02-91FE-A8957980B2ED}.Release R25|Any CPU.ActiveCfg = Release R25|Any CPU + {DDCE6DF1-727A-4C02-91FE-A8957980B2ED}.Release R20|Any CPU.Build.0 = Release R20|Any CPU + {DDCE6DF1-727A-4C02-91FE-A8957980B2ED}.Release R21|Any CPU.Build.0 = Release R21|Any CPU + {DDCE6DF1-727A-4C02-91FE-A8957980B2ED}.Release R22|Any CPU.Build.0 = Release R22|Any CPU + {DDCE6DF1-727A-4C02-91FE-A8957980B2ED}.Release R23|Any CPU.Build.0 = Release R23|Any CPU + {DDCE6DF1-727A-4C02-91FE-A8957980B2ED}.Release R24|Any CPU.Build.0 = Release R24|Any CPU + {DDCE6DF1-727A-4C02-91FE-A8957980B2ED}.Release R25|Any CPU.Build.0 = Release R25|Any CPU + EndGlobalSection +EndGlobal diff --git a/samples/AllInOneSolution/Changelog.md b/samples/AllInOneSolution/Changelog.md new file mode 100644 index 0000000..6bab9d6 --- /dev/null +++ b/samples/AllInOneSolution/Changelog.md @@ -0,0 +1,3 @@ +# 1.0.0 + +Initial release. Enjoy! \ No newline at end of file diff --git a/samples/AllInOneSolution/Readme.md b/samples/AllInOneSolution/Readme.md new file mode 100644 index 0000000..87b5652 --- /dev/null +++ b/samples/AllInOneSolution/Readme.md @@ -0,0 +1,105 @@ +# AllInOneApplication + +Autodesk Revit plugin project organised into multiple solution files that target versions 2020 - 2025. + +### Technologies Used + +* C# 12 +* .NET Framework 4.8 +* .NET 8 + +### Getting Started + +Before you can build this project, you will need to install .NET, depending upon the solution file you are building. If you haven't already installed these +frameworks, you can do so by visiting the following: + +* [.NET Framework 4.8](https://dotnet.microsoft.com/download/dotnet-framework/net48) +* [.NET 8](https://dotnet.microsoft.com/en-us/download/dotnet) + +After installing necessary frameworks, clone this repository to your local machine and navigate to the project directory. + +### Building + +We recommend JetBrains Rider as preferred IDE, since it has outstanding .NET support. If you don't have Rider installed, you can download it +from [here](https://www.jetbrains.com/rider/). + +1. Open JetBrains Rider +2. Click on `File -> Open` and choose the solution file that you want to open. +3. After the solution loads, you can build it by clicking on `Build -> Build Solution`. + +Also, you can use Visual Studio. If you don't have Visual Studio installed, download it from [here](https://visualstudio.microsoft.com/downloads/). + +1. Open Visual Studio +2. Click on `File -> Open -> Project/Solution` and locate your solution file to open. +3. Upon loading the solution, build it via `Build -> Build Solution`. + +### MSI installer and bundle build on local machine + +To build the project for all versions, create the installer and bundle, the project uses [NUKE](https://github.com/nuke-build/nuke) + +To execute your NUKE build locally, you can follow these steps: + +1. **Install NUKE as a global tool**. First, make sure you have NUKE installed as a global tool. You can install it using dotnet CLI: + + ```powershell + dotnet tool install Nuke.GlobalTool --global + ``` + + You only need to do this once on your machine. + +2. **Navigate to your project directory**. Open a terminal / command prompt and navigate to your project's root directory. +3. **Run the build**. Once you have navigated to your project's root directory, you can run the NUKE build by calling: + + Compile: + ```powershell + nuke + ``` + + Create installer: + ```powershell + nuke CreateInstaller + ``` + + Create installer and bundle: + ```powershell + nuke CreateInstaller CreateBundle + ``` + + This command will execute the NUKE build defined in your project. + +### Create new release on GitHub + +Publishing the release, generating the installer and bundle, is performed automatically on GitHub. + +To execute your NUKE build on GitHub, you can follow these steps: + +1. Merge all your commits into the `main` / `master` branch. +2. Navigate to the `Build/Build.Configuration.cs` file. +3. Increase the `Version` value. +4. Make a commit. +5. Push your changes to GitHub, everything will happen automatically, and you can follow the progress in the Actions section of the repository page. + +### Solution structure + +| Folder | Description | +|---------|----------------------------------------------------------------------------| +| build | Nuke build system. Used to automate project builds | +| install | Add-in installer, called implicitly by the Nuke build | +| source | Project source code folder. Contains all solution projects | +| output | Folder of generated files by the build system, such as bundles, installers | + +### Project structure + +| Folder | Description | +|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Commands | External commands invoked from the Revit ribbon. Registered in the `Application` class | +| Core | Provides main add-in logic | +| Models | Classes that encapsulate the app's data, include data transfer objects (DTOs). More [details](https://learn.microsoft.com/en-us/dotnet/architecture/maui/mvvm) | +| ViewModels | Classes that implement properties and commands to which the view can bind data. More [details](https://learn.microsoft.com/en-us/dotnet/architecture/maui/mvvm) | +| Views | Classes that are responsible for defining the structure, layout and appearance of what the user sees on the screen. More [details](https://learn.microsoft.com/en-us/dotnet/architecture/maui/mvvm) | +| Resources | Images, sounds, localisation files, etc | +| Utils | Utilities, extensions, helpers used across the application | + +### Learn More + +* You can explore more in the [RevitTemplates wiki](https://github.com/Nice3point/RevitTemplates/wiki) page. \ No newline at end of file diff --git a/samples/AllInOneSolution/build/.editorconfig b/samples/AllInOneSolution/build/.editorconfig new file mode 100644 index 0000000..95a3862 --- /dev/null +++ b/samples/AllInOneSolution/build/.editorconfig @@ -0,0 +1,15 @@ +# noinspection EditorConfigKeyCorrectness +[*.cs] +dotnet_style_qualification_for_field = false:warning +dotnet_style_qualification_for_property = false:warning +dotnet_style_qualification_for_method = false:warning +dotnet_style_qualification_for_event = false:warning +dotnet_style_require_accessibility_modifiers = never:warning + +csharp_style_expression_bodied_methods = true:silent +csharp_style_expression_bodied_properties = true:warning +csharp_style_expression_bodied_indexers = true:warning +csharp_style_expression_bodied_accessors = true:warning + +resharper_check_namespace_highlighting = none +resharper_class_never_instantiated_global_highlighting = none \ No newline at end of file diff --git a/samples/AllInOneSolution/build/Build.Bundle.cs b/samples/AllInOneSolution/build/Build.Bundle.cs new file mode 100644 index 0000000..6726a49 --- /dev/null +++ b/samples/AllInOneSolution/build/Build.Bundle.cs @@ -0,0 +1,104 @@ +using Autodesk.PackageBuilder; +using System.Xml.Linq; +using Nuke.Common.Git; +using Nuke.Common.ProjectModel; +using Nuke.Common.Utilities; + +sealed partial class Build +{ + Target CreateBundle => _ => _ + .DependsOn(Compile) + .OnlyWhenStatic(() => IsLocalBuild || GitRepository.IsOnMainOrMasterBranch()) + .Executes(() => + { + foreach (var project in Bundles) + { + Log.Information("Project: {Name}", project.Name); + + var directories = Directory.GetDirectories(project.Directory, "* Release *", SearchOption.AllDirectories); + Assert.NotEmpty(directories, "No files were found to create a bundle"); + + var bundleRoot = ArtifactsDirectory / project.Name; + var bundlePath = bundleRoot / $"{project.Name}.bundle"; + var manifestPath = bundlePath / "PackageContents.xml"; + var contentsDirectory = bundlePath / "Contents"; + foreach (var path in directories) + { + var version = YearRegex.Match(path).Value; + + Log.Information("Bundle files for version {Version}:", version); + CopyAssemblies(path, contentsDirectory / version); + } + + GenerateManifest(project, directories, manifestPath); + CompressFolder(bundleRoot); + } + }); + + void GenerateManifest(Project project, string[] directories, AbsolutePath manifestDirectory) + { + BuilderUtils.Build(builder => + { + var versions = directories.Select(path => YearRegex.Match(path).Value).Select(int.Parse); + var company = GetConfigurationValue(project, config => config.Name == "VendorId"); + var email = GetConfigurationValue(project, config => config.Name == "VendorEmail"); + + builder.ApplicationPackage.Create() + .ProductType(ProductTypes.Application) + .AutodeskProduct(AutodeskProducts.Revit) + .Name(Solution.Name) + .AppVersion(Version); + + builder.CompanyDetails.Create(company) + .Email(email); + + foreach (var version in versions) + { + builder.Components.CreateEntry($"Revit {version}") + .RevitPlatform(version) + .AppName(project.Name) + .ModuleName($"./Contents/{version}/{project.Name}.addin"); + } + }, manifestDirectory); + } + + string GetConfigurationValue(Project project, Func filter) + { + var defaultValue = string.Empty; + var configPath = project.Directory.GetFiles("*.addin").FirstOrDefault(); + + if (configPath is null) return defaultValue; + + var configDocument = configPath.ReadXml(); + if (configDocument.Root is null) return defaultValue; + + var sectionElement = configDocument.Root.Elements().FirstOrDefault(); + if (sectionElement is null) return defaultValue; + + var configElement = sectionElement.Elements().FirstOrDefault(filter); + if (configElement is null) return defaultValue; + + return configElement.Value; + } + + static void CompressFolder(AbsolutePath bundleRoot) + { + var bundleName = bundleRoot.WithExtension(".zip"); + bundleRoot.CompressTo(bundleName); + bundleRoot.DeleteDirectory(); + + Log.Information("Compressing into a Zip: {Name}", bundleName); + } + + static void CopyAssemblies(string sourcePath, string targetPath) + { + foreach (var dirPath in Directory.GetDirectories(sourcePath, "*", SearchOption.AllDirectories)) + Directory.CreateDirectory(dirPath.Replace(sourcePath, targetPath)); + + foreach (var filePath in Directory.GetFiles(sourcePath, "*", SearchOption.AllDirectories)) + { + Log.Information("{Assembly}", filePath); + File.Copy(filePath, filePath.Replace(sourcePath, targetPath), true); + } + } +} \ No newline at end of file diff --git a/samples/AllInOneSolution/build/Build.CI.GitHub.cs b/samples/AllInOneSolution/build/Build.CI.GitHub.cs new file mode 100644 index 0000000..2298216 --- /dev/null +++ b/samples/AllInOneSolution/build/Build.CI.GitHub.cs @@ -0,0 +1,139 @@ +using System.Text; +using Nuke.Common.Git; +using Nuke.Common.Tools.Git; +using Nuke.Common.Tools.GitHub; +using Octokit; + +sealed partial class Build +{ + Target PublishGitHub => _ => _ + .DependsOn(CreateInstaller, CreateBundle) + .Requires(() => GitHubToken) + .Requires(() => GitRepository) + .OnlyWhenStatic(() => IsServerBuild && GitRepository.IsOnMainOrMasterBranch()) + .Executes(async () => + { + GitHubTasks.GitHubClient = new GitHubClient(new ProductHeaderValue(Solution.Name)) + { + Credentials = new Credentials(GitHubToken) + }; + + var gitHubName = GitRepository.GetGitHubName(); + var gitHubOwner = GitRepository.GetGitHubOwner(); + + ValidateRelease(); + + var artifacts = Directory.GetFiles(ArtifactsDirectory, "*"); + var changelog = CreateGithubChangelog(); + Assert.NotEmpty(artifacts, "No artifacts were found to create the Release"); + + var newRelease = new NewRelease(Version) + { + Name = Version, + Body = changelog, + TargetCommitish = GitRepository.Commit + }; + + var release = await GitHubTasks.GitHubClient.Repository.Release.Create(gitHubOwner, gitHubName, newRelease); + await UploadArtifactsAsync(release, artifacts); + }); + + void ValidateRelease() + { + var tags = GitTasks.Git("describe --tags --abbrev=0 --always", logInvocation: false, logOutput: false); + var latestTag = tags.First().Text; + if (latestTag == GitRepository.Commit) return; + + Assert.False(latestTag == Version, $"A Release with the specified tag already exists in the repository: {Version}"); + Log.Information("Version: {Version}", Version); + } + + static async Task UploadArtifactsAsync(Release release, IEnumerable artifacts) + { + foreach (var file in artifacts) + { + var releaseAssetUpload = new ReleaseAssetUpload + { + ContentType = "application/x-binary", + FileName = Path.GetFileName(file), + RawData = File.OpenRead(file) + }; + + await GitHubTasks.GitHubClient.Repository.Release.UploadAsset(release, releaseAssetUpload); + Log.Information("Artifact: {Path}", file); + } + } + + string CreateGithubChangelog() + { + if (!File.Exists(ChangeLogPath)) + { + Log.Warning("Unable to locate the changelog file: {Log}", ChangeLogPath); + return string.Empty; + } + + Log.Information("Changelog: {Path}", ChangeLogPath); + + var changelog = BuildChangelog(); + if (changelog.Length == 0) + { + Log.Warning("No version entry exists in the changelog: {Version}", Version); + return string.Empty; + } + + WriteCompareUrl(changelog); + return changelog.ToString(); + } + + void WriteCompareUrl(StringBuilder changelog) + { + var tags = GitTasks.Git("describe --tags --abbrev=0 --always", logInvocation: false, logOutput: false); + var latestTag = tags.First().Text; + if (latestTag == GitRepository.Commit) return; + + if (changelog[^1] != '\r' || changelog[^1] != '\n') changelog.AppendLine(Environment.NewLine); + changelog.Append("Full changelog: "); + changelog.Append(GitRepository.GetGitHubCompareTagsUrl(Version, latestTag)); + } + + StringBuilder BuildChangelog() + { + const string separator = "# "; + + var hasEntry = false; + var changelog = new StringBuilder(); + foreach (var line in File.ReadLines(ChangeLogPath)) + { + if (hasEntry) + { + if (line.StartsWith(separator)) break; + + changelog.AppendLine(line); + continue; + } + + if (line.StartsWith(separator) && line.Contains(Version)) + { + hasEntry = true; + } + } + + TrimEmptyLines(changelog); + return changelog; + } + + static void TrimEmptyLines(StringBuilder builder) + { + if (builder.Length == 0) return; + + while (builder[^1] == '\r' || builder[^1] == '\n') + { + builder.Remove(builder.Length - 1, 1); + } + + while (builder[0] == '\r' || builder[0] == '\n') + { + builder.Remove(0, 1); + } + } +} \ No newline at end of file diff --git a/samples/AllInOneSolution/build/Build.Clean.cs b/samples/AllInOneSolution/build/Build.Clean.cs new file mode 100644 index 0000000..60a9e6c --- /dev/null +++ b/samples/AllInOneSolution/build/Build.Clean.cs @@ -0,0 +1,29 @@ +using Nuke.Common.Tools.DotNet; +using static Nuke.Common.Tools.DotNet.DotNetTasks; + +sealed partial class Build +{ + Target Clean => _ => _ + .OnlyWhenStatic(() => IsLocalBuild) + .Executes(() => + { + foreach (var project in Solution.AllProjects.Where(project => project != Solution.Build)) + { + CleanDirectory(project.Directory / "bin"); + CleanDirectory(project.Directory / "obj"); + } + + foreach (var configuration in GlobBuildConfigurations()) + DotNetClean(settings => settings + .SetConfiguration(configuration) + .SetVerbosity(DotNetVerbosity.minimal)); + + CleanDirectory(ArtifactsDirectory); + }); + + static void CleanDirectory(AbsolutePath path) + { + Log.Information("Cleaning directory: {Directory}", path); + path.CreateOrCleanDirectory(); + } +} \ No newline at end of file diff --git a/samples/AllInOneSolution/build/Build.Compile.cs b/samples/AllInOneSolution/build/Build.Compile.cs new file mode 100644 index 0000000..3f255ec --- /dev/null +++ b/samples/AllInOneSolution/build/Build.Compile.cs @@ -0,0 +1,29 @@ +using System.IO.Enumeration; +using Nuke.Common.Tools.DotNet; +using static Nuke.Common.Tools.DotNet.DotNetTasks; + +sealed partial class Build +{ + Target Compile => _ => _ + .DependsOn(Clean) + .Executes(() => + { + foreach (var configuration in GlobBuildConfigurations()) + DotNetBuild(settings => settings + .SetConfiguration(configuration) + .SetVersion(Version) + .SetVerbosity(DotNetVerbosity.minimal)); + }); + + List GlobBuildConfigurations() + { + var configurations = Solution.Configurations + .Select(pair => pair.Key) + .Select(config => config.Remove(config.LastIndexOf('|'))) + .Where(config => Configurations.Any(wildcard => FileSystemName.MatchesSimpleExpression(wildcard, config))) + .ToList(); + + Assert.NotEmpty(configurations, $"No solution configurations have been found. Pattern: {string.Join(" | ", Configurations)}"); + return configurations; + } +} \ No newline at end of file diff --git a/samples/AllInOneSolution/build/Build.Configuration.cs b/samples/AllInOneSolution/build/Build.Configuration.cs new file mode 100644 index 0000000..431fe33 --- /dev/null +++ b/samples/AllInOneSolution/build/Build.Configuration.cs @@ -0,0 +1,25 @@ +sealed partial class Build +{ + const string Version = "1.0.0"; + readonly AbsolutePath ArtifactsDirectory = RootDirectory / "output"; + readonly AbsolutePath ChangeLogPath = RootDirectory / "Changelog.md"; + + protected override void OnBuildInitialized() + { + Configurations = + [ + "Release*", + "Installer*" + ]; + + Bundles = + [ + Solution.RevitAddIn + ]; + + InstallersMap = new() + { + { Solution.Installer, Solution.RevitAddIn } + }; + } +} \ No newline at end of file diff --git a/samples/AllInOneSolution/build/Build.Installer.cs b/samples/AllInOneSolution/build/Build.Installer.cs new file mode 100644 index 0000000..6722278 --- /dev/null +++ b/samples/AllInOneSolution/build/Build.Installer.cs @@ -0,0 +1,55 @@ +using System.Diagnostics.CodeAnalysis; +using Nuke.Common.Git; +using Nuke.Common.Tooling; +using Nuke.Common.Utilities; + +sealed partial class Build +{ + Target CreateInstaller => _ => _ + .DependsOn(Compile) + .OnlyWhenStatic(() => IsLocalBuild || GitRepository.IsOnMainOrMasterBranch()) + .Executes(() => + { + foreach (var (installer, project) in InstallersMap) + { + Log.Information("Project: {Name}", project.Name); + + var exePattern = $"*{installer.Name}.exe"; + var exeFile = Directory.EnumerateFiles(installer.Directory, exePattern, SearchOption.AllDirectories) + .FirstOrDefault() + .NotNull($"No installer file was found for the project: {installer.Name}"); + + var directories = Directory.GetDirectories(project.Directory, "* Release *", SearchOption.AllDirectories); + Assert.NotEmpty(directories, "No files were found to create an installer"); + + var arguments = directories.Select(path => path.DoubleQuoteIfNeeded()).JoinSpace(); + var process = ProcessTasks.StartProcess(exeFile, arguments, logInvocation: false, logger: InstallLogger); + process.AssertZeroExitCode(); + } + }); + + [SuppressMessage("ReSharper", "TemplateIsNotCompileTimeConstantProblem")] + void InstallLogger(OutputType outputType, string output) + { + if (outputType == OutputType.Err) + { + Log.Error(output); + return; + } + + var arguments = ArgumentsRegex.Matches(output); + if (arguments.Count == 0) + { + Log.Debug(output); + return; + } + + var properties = arguments + .Select(match => match.Value.Substring(1, match.Value.Length - 2)) + .Cast() + .ToArray(); + + var messageTemplate = ArgumentsRegex.Replace(output, match => $"{{Property{match.Index}}}"); + Log.Information(messageTemplate, properties); + } +} \ No newline at end of file diff --git a/samples/AllInOneSolution/build/Build.Regex.cs b/samples/AllInOneSolution/build/Build.Regex.cs new file mode 100644 index 0000000..30d2ae2 --- /dev/null +++ b/samples/AllInOneSolution/build/Build.Regex.cs @@ -0,0 +1,13 @@ +using System.Text.RegularExpressions; + +sealed partial class Build +{ + readonly Regex YearRegex = YearRegexGenerator(); + readonly Regex ArgumentsRegex = ArgumentsRegexGenerator(); + + [GeneratedRegex(@"\d{4}")] + private static partial Regex YearRegexGenerator(); + + [GeneratedRegex("'(.+?)'", RegexOptions.Compiled)] + private static partial Regex ArgumentsRegexGenerator(); +} \ No newline at end of file diff --git a/samples/AllInOneSolution/build/Build.cs b/samples/AllInOneSolution/build/Build.cs new file mode 100644 index 0000000..4bf81e6 --- /dev/null +++ b/samples/AllInOneSolution/build/Build.cs @@ -0,0 +1,15 @@ +using Nuke.Common.Git; +using Nuke.Common.ProjectModel; + +sealed partial class Build : NukeBuild +{ + string[] Configurations; + Project[] Bundles; + Dictionary InstallersMap; + + [Secret] [Parameter] string GitHubToken; + [GitRepository] readonly GitRepository GitRepository; + [Solution(GenerateProjects = true)] Solution Solution; + + public static int Main() => Execute(x => x.Compile); +} \ No newline at end of file diff --git a/samples/AllInOneSolution/build/Build.csproj b/samples/AllInOneSolution/build/Build.csproj new file mode 100644 index 0000000..61f9a65 --- /dev/null +++ b/samples/AllInOneSolution/build/Build.csproj @@ -0,0 +1,25 @@ + + + + Exe + CS0649;CS0169 + latest + true + net8.0 + .. + .. + 1 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/AllInOneSolution/build/Build.csproj.DotSettings b/samples/AllInOneSolution/build/Build.csproj.DotSettings new file mode 100644 index 0000000..edf5b55 --- /dev/null +++ b/samples/AllInOneSolution/build/Build.csproj.DotSettings @@ -0,0 +1,31 @@ + + DO_NOT_SHOW + DO_NOT_SHOW + DO_NOT_SHOW + DO_NOT_SHOW + DO_NOT_SHOW + Implicit + Implicit + ExpressionBody + 0 + NEXT_LINE + True + False + 120 + IF_OWNER_IS_SINGLE_LINE + WRAP_IF_LONG + False + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy><Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"><ElementKinds><Kind Name="FIELD" /><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></Policy> + <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"><ElementKinds><Kind Name="FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></Policy> + True + True + True + True + True + True + True + True + True + True diff --git a/samples/AllInOneSolution/global.json b/samples/AllInOneSolution/global.json new file mode 100644 index 0000000..5a77aba --- /dev/null +++ b/samples/AllInOneSolution/global.json @@ -0,0 +1,6 @@ +{ + "sdk": { + "version": "8.0.0", + "rollForward": "latestMinor" + } +} \ No newline at end of file diff --git a/samples/AllInOneSolution/install/Installer.Generator.cs b/samples/AllInOneSolution/install/Installer.Generator.cs new file mode 100644 index 0000000..0b01cb6 --- /dev/null +++ b/samples/AllInOneSolution/install/Installer.Generator.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.RegularExpressions; +using WixSharp; + +namespace Installer; + +public static class Generator +{ + public static WixEntity[] GenerateWixEntities(IEnumerable args) + { + var versionRegex = new Regex(@"\d+"); + var versionStorages = new Dictionary>(); + + foreach (var directory in args) + { + var directoryInfo = new DirectoryInfo(directory); + var fileVersion = versionRegex.Match(directoryInfo.Name).Value; + var feature = new Feature + { + Name = $"Revit {fileVersion}", + Description = $"Install add-in for Revit {fileVersion}", + ConfigurableDir = $"INSTALL{fileVersion}" + }; + + var files = new Files(feature, $@"{directory}\*.*"); + if (versionStorages.TryGetValue(fileVersion, out var storage)) + storage.Add(files); + else + versionStorages.Add(fileVersion, [files]); + + var assemblies = Directory.GetFiles(directory, "*", SearchOption.AllDirectories); + Console.WriteLine($"Installer files for version '{fileVersion}':"); + foreach (var assembly in assemblies) Console.WriteLine($"'{assembly}'"); + } + + return versionStorages + .Select(storage => new Dir(new Id($"INSTALL{storage.Key}"), storage.Key, storage.Value.ToArray())) + .Cast() + .ToArray(); + } +} \ No newline at end of file diff --git a/samples/AllInOneSolution/install/Installer.cs b/samples/AllInOneSolution/install/Installer.cs new file mode 100644 index 0000000..a385c62 --- /dev/null +++ b/samples/AllInOneSolution/install/Installer.cs @@ -0,0 +1,55 @@ +using System; +using Installer; +using WixSharp; +using WixSharp.CommonTasks; +using WixSharp.Controls; +using Assembly = System.Reflection.Assembly; + +const string outputName = "AllInOneApplication"; +const string projectName = "AllInOneApplication"; + +var project = new Project +{ + OutDir = "output", + Name = projectName, + Platform = Platform.x64, + UI = WUI.WixUI_FeatureTree, + MajorUpgrade = MajorUpgrade.Default, + GUID = new Guid("235D1107-BED9-48BA-9D2F-37B4B046C071"), + BannerImage = @"install\Resources\Icons\BannerImage.png", + BackgroundImage = @"install\Resources\Icons\BackgroundImage.png", + Version = Assembly.GetExecutingAssembly().GetName().Version.ClearRevision(), + ControlPanelInfo = + { + Manufacturer = Environment.UserName, + ProductIcon = @"install\Resources\Icons\ShellIcon.ico" + } +}; + +var wixEntities = Generator.GenerateWixEntities(args); +project.RemoveDialogsBetween(NativeDialogs.WelcomeDlg, NativeDialogs.CustomizeDlg); + +BuildSingleUserMsi(); +BuildMultiUserUserMsi(); + +void BuildSingleUserMsi() +{ + project.InstallScope = InstallScope.perUser; + project.OutFileName = $"{outputName}-{project.Version}-SingleUser"; + project.Dirs = + [ + new InstallDir(@"%AppDataFolder%\Autodesk\Revit\Addins\", wixEntities) + ]; + project.BuildMsi(); +} + +void BuildMultiUserUserMsi() +{ + project.InstallScope = InstallScope.perMachine; + project.OutFileName = $"{outputName}-{project.Version}-MultiUser"; + project.Dirs = + [ + new InstallDir(@"%CommonAppDataFolder%\Autodesk\Revit\Addins\", wixEntities) + ]; + project.BuildMsi(); +} \ No newline at end of file diff --git a/samples/AllInOneSolution/install/Installer.csproj b/samples/AllInOneSolution/install/Installer.csproj new file mode 100644 index 0000000..d8f7ad0 --- /dev/null +++ b/samples/AllInOneSolution/install/Installer.csproj @@ -0,0 +1,16 @@ + + + + Exe + latest + x64 + net48 + false + + + + + + + + \ No newline at end of file diff --git a/samples/AllInOneSolution/install/Resources/Icons/BackgroundImage.png b/samples/AllInOneSolution/install/Resources/Icons/BackgroundImage.png new file mode 100644 index 0000000000000000000000000000000000000000..ffedfde462f5c973780e4a8eef47344a8a9a6dd1 GIT binary patch literal 5331 zcmd^DXIm3%w;n)1rENtJk)j*HD7}jkL5iXXp@v>WAygxsP{T$=M8pCD(m|vqC`fNn z1SAl86_Q8^p+^D%LVd@5uJZ%Vr}N?cFxNbpXV$&etXb>6*Cfuw_!iG`;o|@R@Z2`g zGXnsYRq(iSloh;k@?@+scslmTz{Vc{(DcQ5E#g#EBTd4A%_!B?q3G z{yh+zqt_`WY8N_T%e^1JM!^`#WlfmC>!#?Cq%Iz`zL#a8AsW7nuJ4U5H{Ji5)ur zWRlQXs1ME>$Z@?6{W~gYDo0-9`aDC#|BA@z-Yt1KpAVyIJVK{|FSx1f;I#}>(#pae zZoZ5J#&8Iqs~`~DelMOLs$*~Xl8-k*Qzp6QsQT6&*y)TP)VO&OX$Nk*zztL5&#@qb{FqHw_GLdv>ARclm^J^EAHE=-9>0P#-*yui+1BKjaoZ#t;Hc|PnWpeU zTI5~>?`*AKd?k44K|oS)^ZX4EP4DI{=D2myy8o>E2kJEQfH&$Apwc=I(OTX5NpFgq zihc-7k#*t$coeSUCx*%@$}^R^H0+v%0b%EWBu?-5$)%)QpxX}$5#xjH$ii+`?c@IW zlkJ!4bU^S^b2sab?GwQup5e;E#p9+}bZ@c(!wS;m*a^yAGdC7zH8;vG*EZ;fMVEsO zXi$_c=K_;1bsz3152C(kD{FKFt%bV!AhfaKYR*5PX-CK(#|1mr{6*Y(aVp(-zNboD z0NWX1id1hnm~yJOAaGMr1=aLoz#BAYs_yx4YKQ<_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Resources/Icons/ShellIcon.ico b/samples/AllInOneSolution/install/Resources/Icons/ShellIcon.ico new file mode 100644 index 0000000000000000000000000000000000000000..940e075dd275b732c6a23d9d7d70b1a2591c99a7 GIT binary patch literal 32988 zcmeHPX>?W96@FdIKmO_RM_UOL4H!s7rZ5vAq(v>QBQCM+vZ7_##d0WCNFeiMKxP$$ zLMx$^L8f96P>?cJ#$vH$kTJ9i1w_pQnMnw{`#Z^gIq&AaJ0$Nu9`xR|ZqB*)p0mHR z_t|F;=fDdDz7x1DkdYDKGBJ?C<%5AhAThD-`HnzfIKOMwtnT^tKw!q>fxsR7UbVk1 z5ZLg`Kp=(taI-)$-*_MCD(ss={_V@a*8yJ#d>!z0peZ^q({TV``GTCG3OsLUzqcf=eXecgSW=g$-|$8_!YkOa_qqFo{t5( z3Y~+zfsHx9_?n`_R((NR=h3R}^%}rfcCTLEU_4&yo)ypfw+*wWc`^@?_|~z#TnBb~ zFXMnsu+k;B->{y{=3DUe66?UL^(Sjh$1|%3PktU1{=o-yNw=?Nc*b|pmcPu`w#9#H zu;z@|^4!!pXbj(i4SC6!qgi51f?-!S)&?Smfd1IgkMte9!!JaWZ=nUABH- zCnfAwQ}_nHm%M`qH~hn1IpG^Lo!S+njE&EY)j22Qlr~1pNYC&U(#NcfCf^tX){PlX zwBJSI*X+HS4TKMeeKu>~*mtqw9kO(zt9mTrBz9>G|FPuVE&s3qUhxfC#hQ2U@5TqZ zja%Hz|Bc`s{KK!g8K)O*Zxrv~-;EEv)p!U0SkGSY<%H&qoOkdpx0A6(yN%O$O2+7A z+0;1It!(0ncgWRE4B(bmWBYjH9sIlTfkuAZJjWyN;6D~VFkX2F|6cn*&b!FptJqf0nFK2yOD}x@{43T!>`W~7G#VpcjL(f;H>E9fEnZ?jkyWgG zpvcXuJ#FE~ZRxcS5Wc0f+fQ>l{-(CS5qVHk#~khcGB>d*z1r7rtX!azvEm&#ZqF1N z%a_xB(cZ_klV!Zwz*zeL#2ilNCKm1BlkMg#n&0D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-A3RSQlunn=pOfx%t*VNam1fb-US$jyCZ7;zP{nBQ`V3PeMfNXz8@!!$5mv`yYhz_ekTfjeQb1_S&IH>U5+orC`24 zp^!%0_x&*1k?7++<`{bwxP+Fm6x#T=nb3W+nBGi2ppW)zr%$k?Uvur6@~tl=-p=c> zHQVv}{2Vl_#t&cgZqCaxL{lEBuU_GOkvVGLXbi{FDyFTYYezr3>)q@zW;~g zeAq;+Z=r29evAWqD*HFBMfZsG)kpsG-s`!habcwK0~>oxTNch%B+SN*ceoCGyk6xx z#<5$DU+HK9t(sC=N53Ht_;B&;8MVI#o2Bm`iHxkqk3RT+4VTZ=+acjYf%2dC#^x%U zAoPr-6@9c-G4kL6NLL2qniUG-(z&xV{^2y1 zd*mDoeKq>w{@oZWv92Pf%3*&$@719+f8_I&*R^HHkAsfcUGLwWoMR*h3wpN=W~Dag zyG5|DpZ&Q9&M9z4f;fqPidmhhI6F^C4(9hv3TAdr2=e|gW2Km$ujKV;&0}g4EKbMw z`tuN+ca(8#Id}LFn$B`B=4{`aa}QmQG`Xc5*PKNa@KFio2w(<8vpQy{6>un3@Ay-^ExkUMD@u|lC@DDiu!8*ewc0 +/// Command entry point invoked from the Revit AddIn Application +/// +public class ShowWindowHandler(ModalModuleView view) +{ + public void Execute(ExternalCommand shell) + { + view.ShowDialog(); + } +} \ No newline at end of file diff --git a/samples/AllInOneSolution/source/ModalModule/Core/RevitShell.cs b/samples/AllInOneSolution/source/ModalModule/Core/RevitShell.cs new file mode 100644 index 0000000..546c5fc --- /dev/null +++ b/samples/AllInOneSolution/source/ModalModule/Core/RevitShell.cs @@ -0,0 +1,8 @@ +namespace ModalModule.Core; + +/// +/// The class contains wrapping methods for working with the Revit API +/// +public static class RevitShell +{ +} \ No newline at end of file diff --git a/samples/AllInOneSolution/source/ModalModule/ModalModule.csproj b/samples/AllInOneSolution/source/ModalModule/ModalModule.csproj new file mode 100644 index 0000000..5a75a64 --- /dev/null +++ b/samples/AllInOneSolution/source/ModalModule/ModalModule.csproj @@ -0,0 +1,85 @@ + + + + true + latest + x64 + true + Debug R20;Debug R21;Debug R22;Debug R23;Debug R24;Debug R25 + $(Configurations);Release R20;Release R21;Release R22;Release R23;Release R24;Release R25 + + + + full + true + $(DefineConstants);DEBUG + + + true + none + $(DefineConstants);RELEASE + + + 2020 + net48 + $(DefineConstants);R20 + $(DefineConstants);R20_OR_GREATER + + + 2021 + net48 + $(DefineConstants);R21 + $(DefineConstants);R20_OR_GREATER;R21_OR_GREATER + + + 2022 + net48 + $(DefineConstants);R22 + $(DefineConstants);R20_OR_GREATER;R21_OR_GREATER;R22_OR_GREATER + + + 2023 + net48 + $(DefineConstants);R23 + $(DefineConstants);R20_OR_GREATER;R21_OR_GREATER;R22_OR_GREATER;R23_OR_GREATER + + + 2024 + net48 + $(DefineConstants);R24 + $(DefineConstants);R20_OR_GREATER;R21_OR_GREATER;R22_OR_GREATER;R23_OR_GREATER;R24_OR_GREATER + + + 2025 + net8.0-windows + $(DefineConstants);R25 + $(DefineConstants);R20_OR_GREATER;R21_OR_GREATER;R22_OR_GREATER;R23_OR_GREATER;R24_OR_GREATER;R25_OR_GREATER + + + + $(RevitVersion) + true + true + false + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/AllInOneSolution/source/ModalModule/ViewModels/ModalModuleViewModel.cs b/samples/AllInOneSolution/source/ModalModule/ViewModels/ModalModuleViewModel.cs new file mode 100644 index 0000000..ddb582d --- /dev/null +++ b/samples/AllInOneSolution/source/ModalModule/ViewModels/ModalModuleViewModel.cs @@ -0,0 +1,24 @@ +using Autodesk.Revit.DB; +using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Input; +using Microsoft.Extensions.Logging; +using Nice3point.Revit.Toolkit; + +namespace ModalModule.ViewModels; + +public sealed partial class ModalModuleViewModel(ILogger logger) : ObservableObject +{ + [ObservableProperty] private string _projectName = Context.Document.ProjectInformation.Name; + + [RelayCommand] + private void SaveProjectName() + { + var transaction = new Transaction(Context.Document); + transaction.Start("Save project name"); + + Context.Document.ProjectInformation.Name = ProjectName; + + transaction.Commit(); + logger.LogInformation("Saving successful"); + } +} \ No newline at end of file diff --git a/samples/AllInOneSolution/source/ModalModule/Views/Converters/BoolVisibilityConverter.cs b/samples/AllInOneSolution/source/ModalModule/Views/Converters/BoolVisibilityConverter.cs new file mode 100644 index 0000000..b0c2a79 --- /dev/null +++ b/samples/AllInOneSolution/source/ModalModule/Views/Converters/BoolVisibilityConverter.cs @@ -0,0 +1,24 @@ +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; + +namespace ModalModule.Views.Converters; + +public class BoolVisibilityConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return (bool)value! ? Visibility.Visible : Visibility.Hidden; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return (Visibility)value! == Visibility.Visible; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} \ No newline at end of file diff --git a/samples/AllInOneSolution/source/ModalModule/Views/Converters/EnumVisibilityConverter.cs b/samples/AllInOneSolution/source/ModalModule/Views/Converters/EnumVisibilityConverter.cs new file mode 100644 index 0000000..521b6c4 --- /dev/null +++ b/samples/AllInOneSolution/source/ModalModule/Views/Converters/EnumVisibilityConverter.cs @@ -0,0 +1,34 @@ +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; + +namespace ModalModule.Views.Converters; + +public class EnumVisibilityConverter : MarkupExtension, IValueConverter where TEnum : Enum +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is not TEnum valueEnum) + { + throw new ArgumentException($"{nameof(value)} is not type: {typeof(TEnum)}"); + } + + if (parameter is not TEnum parameterEnum) + { + throw new ArgumentException($"{nameof(parameter)} is not type: {typeof(TEnum)}"); + } + + return EqualityComparer.Default.Equals(valueEnum, parameterEnum) ? Visibility.Visible : Visibility.Hidden; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotSupportedException(); + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} \ No newline at end of file diff --git a/samples/AllInOneSolution/source/ModalModule/Views/Converters/InverseBoolConverter.cs b/samples/AllInOneSolution/source/ModalModule/Views/Converters/InverseBoolConverter.cs new file mode 100644 index 0000000..5892412 --- /dev/null +++ b/samples/AllInOneSolution/source/ModalModule/Views/Converters/InverseBoolConverter.cs @@ -0,0 +1,23 @@ +using System.Globalization; +using System.Windows.Data; +using System.Windows.Markup; + +namespace ModalModule.Views.Converters; + +public class InverseBoolConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return !(bool)value!; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return !(bool)value!; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} \ No newline at end of file diff --git a/samples/AllInOneSolution/source/ModalModule/Views/Converters/InverseBoolVisibilityConverter.cs b/samples/AllInOneSolution/source/ModalModule/Views/Converters/InverseBoolVisibilityConverter.cs new file mode 100644 index 0000000..a83f59c --- /dev/null +++ b/samples/AllInOneSolution/source/ModalModule/Views/Converters/InverseBoolVisibilityConverter.cs @@ -0,0 +1,24 @@ +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using System.Windows.Markup; + +namespace ModalModule.Views.Converters; + +public class InverseBoolVisibilityConverter : MarkupExtension, IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return (bool)value! == false ? Visibility.Visible : Visibility.Hidden; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return (Visibility)value! != Visibility.Visible; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return this; + } +} \ No newline at end of file diff --git a/samples/AllInOneSolution/source/ModalModule/Views/ModalModuleView.xaml b/samples/AllInOneSolution/source/ModalModule/Views/ModalModuleView.xaml new file mode 100644 index 0000000..594dfae --- /dev/null +++ b/samples/AllInOneSolution/source/ModalModule/Views/ModalModuleView.xaml @@ -0,0 +1,44 @@ + + + + + + + + + + + + +