Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RevitPluginExample: Создал плагин #132

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
859eaf9
Создан новый плагин RevitPluginExample
KGubin Dec 6, 2024
2c68b18
Создал плагин
KGubin Dec 9, 2024
c9fcf59
Создал плагин
KGubin Dec 9, 2024
428662c
Создал плагин
KGubin Dec 9, 2024
645c139
Добавил локализацию и позицию окна
KGubin Dec 9, 2024
9caa859
Вынес изменения темы в базовое окно и добавил реализацию инфраструкту…
KGubin Dec 10, 2024
5c361a7
Добавил сервисы изменения темы и больше примеров использования локали…
KGubin Dec 11, 2024
a7820c0
Исправил локализацию
KGubin Dec 11, 2024
e0e8866
Исправил подключение сервисов
KGubin Dec 11, 2024
f93fd60
Исправление по коду
dosymep Dec 11, 2024
73d55f7
исправлен сервис обновления темы
dosymep Dec 11, 2024
fa40fb8
Добавил сеттеры
dosymep Dec 11, 2024
89a73ca
форматирование кода
dosymep Dec 11, 2024
43d7dd4
Исправления по коду
dosymep Dec 11, 2024
424427f
Добавил применение стандартной темы
dosymep Dec 11, 2024
6b16827
починил отображение окна
dosymep Dec 11, 2024
442c05d
Добавил DataContext
dosymep Dec 11, 2024
ae327d3
удалил ненужный класс
dosymep Dec 11, 2024
39f48ac
Добавил больше локализации
KGubin Dec 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/publish.RevitPluginExample.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: publish RevitPluginExample

on:
workflow_dispatch:
pull_request:
types: [ closed, synchronize, review_requested ]
branches: [ main, master ]
paths:
- '**RevitPluginExample**.cs'
- '**RevitPluginExample**.xaml'

env:
plugin-name: "RevitPluginExample"

jobs:
build:
name: build
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

# Install the .NET workload
- name: Install .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

# Add DevExrepress package source: https://nuget.devexpress.com/
- name: Add DevExpress package source
run: dotnet nuget add source https://nuget.devexpress.com/api -n DXFeed -u DevExpress -p ${{ secrets.DEVEXPRESS_FEED_AUTHORIZATION_KEY }}

- name: Run './build.cmd '
run: ./build.cmd publish --profile ${{ env.plugin-name }} --pull-request-merged ${{ github.event.pull_request.merged }} --extensions-app-token ${{ secrets.EXTENSIONS_APP_TOKEN }} --revit-plugins-app-token ${{ secrets.REVIT_PLUGINS_APP_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15 changes: 15 additions & 0 deletions .nuke/parameters.RevitPluginExample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "./build.schema.json",
"Solution": "RevitPlugins.sln",
"PluginName": "RevitPluginExample",
"PublishDirectory": "01.BIM.extension\\BIM.tab\\bin",
"RevitVersions": [
"Rv2022",
"Rv2023",
"Rv2024"
],
"IconUrl": "https://icons8.com/icon/15046/invert-selection",
"BundleName": "Пример плагина",
"BundleType": "InvokeButton",
"BundleOutput": "01.BIM.extension\\BIM.tab"
}
16 changes: 16 additions & 0 deletions RevitPlugins.sln
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RevitValueModifier", "src\R
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RevitMirroredElements", "src\RevitMirroredElements\RevitMirroredElements.csproj", "{827319DD-D76C-4757-9DF0-220BCB852135}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RevitPluginExample", "src\RevitPluginExample\RevitPluginExample.csproj", "{CC1F415E-063B-4576-B6C8-83B747F4369A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
D2020|x64 = D2020|x64
Expand Down Expand Up @@ -950,6 +952,20 @@ Global
{827319DD-D76C-4757-9DF0-220BCB852135}.Debug|x64.Build.0 = D2020|x64
{827319DD-D76C-4757-9DF0-220BCB852135}.Release|x64.ActiveCfg = D2020|x64
{827319DD-D76C-4757-9DF0-220BCB852135}.Release|x64.Build.0 = D2020|x64
{CC1F415E-063B-4576-B6C8-83B747F4369A}.D2020|x64.ActiveCfg = D2020|x64
{CC1F415E-063B-4576-B6C8-83B747F4369A}.D2020|x64.Build.0 = D2020|x64
{CC1F415E-063B-4576-B6C8-83B747F4369A}.D2021|x64.ActiveCfg = D2021|x64
{CC1F415E-063B-4576-B6C8-83B747F4369A}.D2021|x64.Build.0 = D2021|x64
{CC1F415E-063B-4576-B6C8-83B747F4369A}.D2022|x64.ActiveCfg = D2022|x64
{CC1F415E-063B-4576-B6C8-83B747F4369A}.D2022|x64.Build.0 = D2022|x64
{CC1F415E-063B-4576-B6C8-83B747F4369A}.D2023|x64.ActiveCfg = D2023|x64
{CC1F415E-063B-4576-B6C8-83B747F4369A}.D2023|x64.Build.0 = D2023|x64
{CC1F415E-063B-4576-B6C8-83B747F4369A}.D2024|x64.ActiveCfg = D2024|x64
{CC1F415E-063B-4576-B6C8-83B747F4369A}.D2024|x64.Build.0 = D2024|x64
{CC1F415E-063B-4576-B6C8-83B747F4369A}.Debug|x64.ActiveCfg = D2020|x64
{CC1F415E-063B-4576-B6C8-83B747F4369A}.Debug|x64.Build.0 = D2020|x64
{CC1F415E-063B-4576-B6C8-83B747F4369A}.Release|x64.ActiveCfg = D2020|x64
{CC1F415E-063B-4576-B6C8-83B747F4369A}.Release|x64.Build.0 = D2020|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
27 changes: 27 additions & 0 deletions src/RevitPluginExample/Converters/ThemeConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using dosymep.SimpleServices;

using Wpf.Ui.Appearance;

namespace RevitPluginExample.Converters {
public class ThemeConverter {
public static ApplicationTheme ConvertToApplicationTheme(UIThemes theme) {
if(theme == UIThemes.Dark) {
return ApplicationTheme.Dark;
} else if(theme == UIThemes.Light) {
return ApplicationTheme.Light;
} else {
return ApplicationTheme.Unknown;
}
}

public static UIThemes ConvertToUIThemes(ApplicationTheme theme) {
if(theme == ApplicationTheme.Dark) {
return UIThemes.Dark;
} else if(theme == ApplicationTheme.Light) {
return UIThemes.Light;
} else {
return UIThemes.Light;
}
}
}
}
39 changes: 39 additions & 0 deletions src/RevitPluginExample/Localization/Language.cs-CZ.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">

<!-- Пример перевода на чешский язык (google translate) -->

<system:String x:Key="MainWindow.Title">Příklad příkazu</system:String>
<system:String x:Key="MainWindow.Hello">Ahoj Revit!</system:String>
<system:String x:Key="MainWindow.HelloCheck">Zadejte hodnotu vlastnosti, kterou chcete uložit.</system:String>


<system:String x:Key="MainWindow.ButtonOk">OK</system:String>
<system:String x:Key="MainWindow.ChangeTheme">Změnit téma</system:String>
<system:String x:Key="MainWindow.PanelName">Super panel</system:String>
<system:String x:Key="MainWindow.ButtonCancel">Zrušit</system:String>
<system:String x:Key="MainWindow.InformationalMessage">Tady jsou informace!</system:String>
<system:String x:Key="MainWindow.ErrorMessage">Tady je chyba!</system:String>
<system:String x:Key="MainWindow.SuccessMessage">Tady je něco úspěšného!</system:String>
<system:String x:Key="MainWindow.WarningMessage">Tady je varování!</system:String>
<system:String x:Key="MainWindow.Footer">Zápatí</system:String>
<system:String x:Key="MainWindow.Header">Záhlaví</system:String>
<system:String x:Key="MainWindow.Username1">Uživatel 1</system:String>
<system:String x:Key="MainWindow.Username2">Uživatel 2</system:String>
<system:String x:Key="MainWindow.Username3">Uživatel 3</system:String>
<system:String x:Key="MainWindow.Username4">Uživatel 4</system:String>
<system:String x:Key="MainWindow.Edit">Upravit</system:String>
<system:String x:Key="MainWindow.Undo">Zpět</system:String>
<system:String x:Key="MainWindow.Cut">Vyjmout</system:String>
<system:String x:Key="MainWindow.Copy">Kopírovat</system:String>
<system:String x:Key="MainWindow.Paste">Vložit</system:String>
<system:String x:Key="MainWindow.SearchWithBrowser">Hledat v prohlížeči</system:String>
<system:String x:Key="MainWindow.Find">Najít...</system:String>
<system:String x:Key="MainWindow.FindNext">Najít další</system:String>
<system:String x:Key="MainWindow.SelectAll">Vybrat vše</system:String>
<system:String x:Key="MainWindow.File">Soubor</system:String>
<system:String x:Key="MainWindow.Open">Otevřít...</system:String>
<system:String x:Key="MainWindow.Save">Uložit</system:String>
<system:String x:Key="MainWindow.Search">Hledat</system:String>
</ResourceDictionary>
38 changes: 38 additions & 0 deletions src/RevitPluginExample/Localization/Language.de-DE.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">

<!-- Пример перевода на немецкий язык (google translate) -->

<system:String x:Key="MainWindow.Title">Beispielbefehl</system:String>
<system:String x:Key="MainWindow.Hello">Hallo Revit!</system:String>
<system:String x:Key="MainWindow.HelloCheck">Geben Sie einen Wert für die zu speichernde Eigenschaft ein.</system:String>

<system:String x:Key="MainWindow.ButtonOk">OK</system:String>
<system:String x:Key="MainWindow.ChangeTheme">Thema ändern</system:String>
<system:String x:Key="MainWindow.PanelName">Super-Panel</system:String>
<system:String x:Key="MainWindow.ButtonCancel">Stornierung</system:String>
<system:String x:Key="MainWindow.InformationalMessage">Hier sind Informationen!</system:String>
<system:String x:Key="MainWindow.ErrorMessage">Hier ist ein Fehler!</system:String>
<system:String x:Key="MainWindow.SuccessMessage">Hier ist etwas Erfolgreiches!</system:String>
<system:String x:Key="MainWindow.WarningMessage">Hier ist eine Warnung!</system:String>
<system:String x:Key="MainWindow.Footer">Fußzeile</system:String>
<system:String x:Key="MainWindow.Header">Kopfzeile</system:String>
<system:String x:Key="MainWindow.Username1">Benutzer 1</system:String>
<system:String x:Key="MainWindow.Username2">Benutzer 2</system:String>
<system:String x:Key="MainWindow.Username3">Benutzer 3</system:String>
<system:String x:Key="MainWindow.Username4">Benutzer 4</system:String>
<system:String x:Key="MainWindow.Edit">Bearbeiten</system:String>
<system:String x:Key="MainWindow.Undo">Rückgängig</system:String>
<system:String x:Key="MainWindow.Cut">Ausschneiden</system:String>
<system:String x:Key="MainWindow.Copy">Kopieren</system:String>
<system:String x:Key="MainWindow.Paste">Einfügen</system:String>
<system:String x:Key="MainWindow.SearchWithBrowser">Mit Browser suchen</system:String>
<system:String x:Key="MainWindow.Find">Finden...</system:String>
<system:String x:Key="MainWindow.FindNext">Nächstes finden</system:String>
<system:String x:Key="MainWindow.SelectAll">Alles auswählen</system:String>
<system:String x:Key="MainWindow.File">Datei</system:String>
<system:String x:Key="MainWindow.Open">Öffnen...</system:String>
<system:String x:Key="MainWindow.Save">Speichern</system:String>
<system:String x:Key="MainWindow.Search">Suchen</system:String>
</ResourceDictionary>
38 changes: 38 additions & 0 deletions src/RevitPluginExample/Localization/Language.en-GB.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">

<!-- Пример перевода на английский британский язык (google translate) -->

<system:String x:Key="MainWindow.Title">Sample command</system:String>
<system:String x:Key="MainWindow.Hello">Hello Revit!</system:String>
<system:String x:Key="MainWindow.HelloCheck">Enter a value for the property to save.</system:String>

<system:String x:Key="MainWindow.ButtonOk">OK</system:String>
<system:String x:Key="MainWindow.ChangeTheme">Change Theme</system:String>
<system:String x:Key="MainWindow.PanelName">Super Panel</system:String>
<system:String x:Key="MainWindow.ButtonCancel">Cancel</system:String>
<system:String x:Key="MainWindow.InformationalMessage">Here is information!</system:String>
<system:String x:Key="MainWindow.ErrorMessage">Here is an error!</system:String>
<system:String x:Key="MainWindow.SuccessMessage">Here is something successful!</system:String>
<system:String x:Key="MainWindow.WarningMessage">Here is a warning!</system:String>
<system:String x:Key="MainWindow.Footer">Footer</system:String>
<system:String x:Key="MainWindow.Header">Header</system:String>
<system:String x:Key="MainWindow.Username1">User 1</system:String>
<system:String x:Key="MainWindow.Username2">User 2</system:String>
<system:String x:Key="MainWindow.Username3">User 3</system:String>
<system:String x:Key="MainWindow.Username4">User 4</system:String>
<system:String x:Key="MainWindow.Edit">Edit</system:String>
<system:String x:Key="MainWindow.Undo">Undo</system:String>
<system:String x:Key="MainWindow.Cut">Cut</system:String>
<system:String x:Key="MainWindow.Copy">Copy</system:String>
<system:String x:Key="MainWindow.Paste">Paste</system:String>
<system:String x:Key="MainWindow.SearchWithBrowser">Search with browser</system:String>
<system:String x:Key="MainWindow.Find">Find...</system:String>
<system:String x:Key="MainWindow.FindNext">Find next</system:String>
<system:String x:Key="MainWindow.SelectAll">Select all</system:String>
<system:String x:Key="MainWindow.File">File</system:String>
<system:String x:Key="MainWindow.Open">Open...</system:String>
<system:String x:Key="MainWindow.Save">Save</system:String>
<system:String x:Key="MainWindow.Search">Search</system:String>
</ResourceDictionary>
38 changes: 38 additions & 0 deletions src/RevitPluginExample/Localization/Language.en-US.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">

<!-- Пример перевода на английский американский язык (google translate) -->

<system:String x:Key="MainWindow.Title">Sample command</system:String>
<system:String x:Key="MainWindow.Hello">Hello Revit!</system:String>
<system:String x:Key="MainWindow.HelloCheck">Enter a value for the property to save.</system:String>

<system:String x:Key="MainWindow.ButtonOk">OK</system:String>
<system:String x:Key="MainWindow.ChangeTheme">Change Theme</system:String>
<system:String x:Key="MainWindow.PanelName">Super Panel</system:String>
<system:String x:Key="MainWindow.ButtonCancel">Cancel</system:String>
<system:String x:Key="MainWindow.InformationalMessage">Here is information!</system:String>
<system:String x:Key="MainWindow.ErrorMessage">Here is an error!</system:String>
<system:String x:Key="MainWindow.SuccessMessage">Here is something successful!</system:String>
<system:String x:Key="MainWindow.WarningMessage">Here is a warning!</system:String>
<system:String x:Key="MainWindow.Footer">Footer</system:String>
<system:String x:Key="MainWindow.Header">Header</system:String>
<system:String x:Key="MainWindow.Username1">User 1</system:String>
<system:String x:Key="MainWindow.Username2">User 2</system:String>
<system:String x:Key="MainWindow.Username3">User 3</system:String>
<system:String x:Key="MainWindow.Username4">User 4</system:String>
<system:String x:Key="MainWindow.Edit">Edit</system:String>
<system:String x:Key="MainWindow.Undo">Undo</system:String>
<system:String x:Key="MainWindow.Cut">Cut</system:String>
<system:String x:Key="MainWindow.Copy">Copy</system:String>
<system:String x:Key="MainWindow.Paste">Paste</system:String>
<system:String x:Key="MainWindow.SearchWithBrowser">Search with browser</system:String>
<system:String x:Key="MainWindow.Find">Find...</system:String>
<system:String x:Key="MainWindow.FindNext">Find next</system:String>
<system:String x:Key="MainWindow.SelectAll">Select all</system:String>
<system:String x:Key="MainWindow.File">File</system:String>
<system:String x:Key="MainWindow.Open">Open...</system:String>
<system:String x:Key="MainWindow.Save">Save</system:String>
<system:String x:Key="MainWindow.Search">Search</system:String>
</ResourceDictionary>
38 changes: 38 additions & 0 deletions src/RevitPluginExample/Localization/Language.es-ES.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">

<!-- Пример перевода на испанский язык (google translate) -->

<system:String x:Key="MainWindow.Title">Comando de ejemplo</system:String>
<system:String x:Key="MainWindow.Hello">Hola Revit!</system:String>
<system:String x:Key="MainWindow.HelloCheck">Introduzca un valor para la propiedad que desea guardar.</system:String>

<system:String x:Key="MainWindow.ButtonOk">OK</system:String>
<system:String x:Key="MainWindow.ChangeTheme">Cambiar tema</system:String>
<system:String x:Key="MainWindow.PanelName">Súper panel</system:String>
<system:String x:Key="MainWindow.ButtonCancel">Cancelar</system:String>
<system:String x:Key="MainWindow.InformationalMessage">Aquí hay información!</system:String>
<system:String x:Key="MainWindow.ErrorMessage">¡Aquí hay un error!</system:String>
<system:String x:Key="MainWindow.SuccessMessage">¡Aquí hay algo exitoso!</system:String>
<system:String x:Key="MainWindow.WarningMessage">¡Aquí hay una advertencia!</system:String>
<system:String x:Key="MainWindow.Footer">Pie de página</system:String>
<system:String x:Key="MainWindow.Header">Encabezado</system:String>
<system:String x:Key="MainWindow.Username1">Usuario 1</system:String>
<system:String x:Key="MainWindow.Username2">Usuario 2</system:String>
<system:String x:Key="MainWindow.Username3">Usuario 3</system:String>
<system:String x:Key="MainWindow.Username4">Usuario 4</system:String>
<system:String x:Key="MainWindow.Edit">Editar</system:String>
<system:String x:Key="MainWindow.Undo">Deshacer</system:String>
<system:String x:Key="MainWindow.Cut">Cortar</system:String>
<system:String x:Key="MainWindow.Copy">Copiar</system:String>
<system:String x:Key="MainWindow.Paste">Pegar</system:String>
<system:String x:Key="MainWindow.SearchWithBrowser">Buscar con navegador</system:String>
<system:String x:Key="MainWindow.Find">Buscar...</system:String>
<system:String x:Key="MainWindow.FindNext">Buscar siguiente</system:String>
<system:String x:Key="MainWindow.SelectAll">Seleccionar todo</system:String>
<system:String x:Key="MainWindow.File">Archivo</system:String>
<system:String x:Key="MainWindow.Open">Abrir...</system:String>
<system:String x:Key="MainWindow.Save">Guardar</system:String>
<system:String x:Key="MainWindow.Search">Buscar</system:String>
</ResourceDictionary>
Loading