Skip to content

Commit

Permalink
Merge pull request #18 from ricaun-io/develop
Browse files Browse the repository at this point in the history
Version 0.2.0
  • Loading branch information
ricaun authored Jul 10, 2022
2 parents 2a9e36b + 75cd3ed commit a508fa2
Show file tree
Hide file tree
Showing 12 changed files with 147 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: NuGet Setup
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
dotnet-version: 6.0.x
- name: "NuGet Add Source Organization"
run: if ("${{ secrets.ORGANIZATION_SOURCE_PACKAGE_PASSWORD }}" -ne "") { dotnet nuget add source --username ${{ secrets.ORGANIZATION_SOURCE_PACKAGE_USERNAME }} --password ${{ secrets.ORGANIZATION_SOURCE_PACKAGE_PASSWORD }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/${{github.repository_owner}}/index.json" }

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: NuGet Setup
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
dotnet-version: 6.0.x
- name: "NuGet Add Source Organization"
run: if ("${{ secrets.ORGANIZATION_SOURCE_PACKAGE_PASSWORD }}" -ne "") { dotnet nuget add source --username ${{ secrets.ORGANIZATION_SOURCE_PACKAGE_USERNAME }} --password ${{ secrets.ORGANIZATION_SOURCE_PACKAGE_PASSWORD }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/${{github.repository_owner}}/index.json" }

Expand Down
1 change: 0 additions & 1 deletion Build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using ricaun.Nuke;
using ricaun.Nuke.Components;

[CheckBuildProjectConfigurations]
class Build : NukeBuild, IPublishPack, IRevitPackageBuilder
{
string IHazPackageBuilderProject.Name => "Example";
Expand Down
2 changes: 1 addition & 1 deletion Build/Build.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace></RootNamespace>
<NoWarn>CS0649;CS0169</NoWarn>
<NukeRootDirectory>.</NukeRootDirectory>
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [0.2.0] / 2022-07-09
### Added
- Add `CreatePushButton` and Obsolete `AddPushButton`
### Updated
- Update `RibbonSettings` Add with Action
- Update `RibbonDescription` (LanguageType)

## [0.1.2] / 2022-05-17
### Added
- Add `IExternalCommandAvailability` on `NewPushButtonData` Command
Expand Down Expand Up @@ -151,6 +158,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- First Release

[vNext]: ../../compare/1.0.0...HEAD
[0.2.0]: ../../compare/0.1.2...0.2.0
[0.1.2]: ../../compare/0.1.1...0.1.2
[0.1.1]: ../../compare/0.1.0...0.1.1
[0.1.0]: ../../compare/0.0.9...0.1.0
[0.0.9]: ../../compare/0.0.8...0.0.9
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ricaun.Revit.UI

[![Revit 2017](https://img.shields.io/badge/Revit-2017+-blue.svg)](../..)
[![Visual Studio 2019](https://img.shields.io/badge/Visual%20Studio%202019-16.11.7+-blue)](../..)
[![Visual Studio 2022](https://img.shields.io/badge/Visual%20Studio-2022-blue)](../..)
[![Nuke](https://img.shields.io/badge/Nuke-Build-blue)](https://nuke.build/)
[![License MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![Publish](../../actions/workflows/Publish.yml/badge.svg)](../../actions)
Expand Down
3 changes: 3 additions & 0 deletions nuke.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cd .\Build\
call build.cmd
timeout 15
71 changes: 44 additions & 27 deletions ricaun.Revit.UI.Example/Revit/App.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.ApplicationServices;
using System;
using System.Linq;
using ricaun.Revit.UI.Example.Proprieties;
using System.Windows.Media;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Media;

namespace ricaun.Revit.UI.Example.Revit
{
Expand All @@ -21,10 +21,10 @@ public Result OnStartup(UIControlledApplication application)
{
ribbonPanel = application.CreatePanel(TabName, PanelName);

ribbonPanel.AddPushButton<Commands.CommandWithAvailability>("Revit")
ribbonPanel.CreatePushButton<Commands.CommandWithAvailability>("Revit")
.SetLargeImage("/UIFrameworkRes;component/ribbon/images/revit.ico");

var button = ribbonPanel.AddPushButton<Commands.Command>();
var button = ribbonPanel.CreatePushButton<Commands.Command>();

var ri = button.GetRibbonItem() as Autodesk.Windows.RibbonButton;

Expand All @@ -46,10 +46,10 @@ public Result OnStartup(UIControlledApplication application)
return Autodesk.Windows.ComponentManager.IsApplicationFrameEnabled && UIFramework.ControlHelper.IsEnabled(ri);
});

ribbonPanel.AddPushButton<Commands.Command<Construction>>("-")
ribbonPanel.CreatePushButton<Commands.Command<Construction>>("-")
.SetLargeImage(GetBase64LargeImage());

ribbonPanel.AddPushButton<Commands.Command<Construction>>("-")
ribbonPanel.CreatePushButton<Commands.Command<Construction>>("-")
.SetLargeImage(GetResourcesLargeImage());

ribbonPanel.CreatePulldownButton("PulldownButton",
Expand All @@ -66,7 +66,7 @@ public Result OnStartup(UIControlledApplication application)
ribbonPanel.NewPushButtonData<Commands.Command<string>>()
);

ribbonPanel.AddPushButton<Commands.Command<Commands.Command>>();
ribbonPanel.CreatePushButton<Commands.Command<Commands.Command>>();

ribbonPanel.AddStackedItems(
ribbonPanel.NewPushButtonData<Commands.Command<UIApplication>>(),
Expand Down Expand Up @@ -179,42 +179,42 @@ public Result OnStartup(UIControlledApplication application)
#endregion

#region Autodesk Icons Buttons
ribbonPanel.AddPushButton<Commands.Command<Point>>()
ribbonPanel.CreatePushButton<Commands.Command<Point>>()
.SetLargeImage(Pack.Power)
.SetText("Power")
.AddQuickAccessToolBar();

ribbonPanel.AddPushButton<Commands.Command<Point>>()
ribbonPanel.CreatePushButton<Commands.Command<Point>>()
.SetLargeImage(Pack.Data)
.SetText("Data")
.AddQuickAccessToolBar();

ribbonPanel.AddPushButton<Commands.Command<Point>>()
ribbonPanel.CreatePushButton<Commands.Command<Point>>()
.SetLargeImage(Pack.Communication)
.SetText("Communication")
.AddQuickAccessToolBar();

ribbonPanel.AddPushButton<Commands.Command<Point>>()
ribbonPanel.CreatePushButton<Commands.Command<Point>>()
.SetLargeImage(Pack.Alarm)
.SetText("Alarm")
.AddQuickAccessToolBar();

ribbonPanel.AddPushButton<Commands.Command<Point>>()
ribbonPanel.CreatePushButton<Commands.Command<Point>>()
.SetLargeImage(Pack.Nurce)
.SetText("Nurce")
.AddQuickAccessToolBar();

ribbonPanel.AddPushButton<Commands.Command<Point>>()
ribbonPanel.CreatePushButton<Commands.Command<Point>>()
.SetLargeImage(Pack.Security)
.SetText("Security")
.AddQuickAccessToolBar();

ribbonPanel.AddPushButton<Commands.Command<Point>>()
ribbonPanel.CreatePushButton<Commands.Command<Point>>()
.SetLargeImage(Pack.Telephone)
.SetText("Telephone")
.AddQuickAccessToolBar();

var sw = ribbonPanel.AddPushButton<Commands.Command<Point>, Commands.Availability.AvailableOnAnyDocument>()
var sw = ribbonPanel.CreatePushButton<Commands.Command<Point>, Commands.Availability.AvailableOnAnyDocument>()
.SetLargeImage(Pack.Switch)
.SetText("Switch")
.AddQuickAccessToolBar();
Expand All @@ -237,7 +237,7 @@ public Result OnStartup(UIControlledApplication application)
private void AddNewPanelToMove(UIControlledApplication application)
{
ribbonPanelMove = application.CreateOrSelectPanel(TabName, PanelName + "0");
ribbonPanelMove.AddPushButton<Commands.Command>("Teste")
ribbonPanelMove.CreatePushButton<Commands.Command>("Teste")
.SetLargeImage("/UIFrameworkRes;component/ribbon/images/revit.ico");

var task = Task.Run(async () =>
Expand Down Expand Up @@ -267,19 +267,36 @@ private void UpdateRibbonDescription(RibbonPanel ribbonPanel)
}
);

//setting.Add<Commands.Command>(
// new RibbonDescription()
// {
// LargeImage = Resource.LargeImage.GetBitmapSource(),
// Text = "ricaun",
// ToolTip = "This is a Tool Tip",
// LongDescription = "This is a Long Description",
// },
// new RibbonDescription(LanguageType.Brazilian_Portuguese)
// {
// Text = "Ola",
// ToolTip = "Este é um Tool Tip",
// LongDescription = "Este é um Long Description",
// }
//);

setting.Add<Commands.Command>(
new RibbonDescription()
(ribbon) =>
{
LargeImage = Resource.LargeImage.GetBitmapSource(),
Text = "ricaun",
ToolTip = "This is a Tool Tip",
LongDescription = "This is a Long Description",
ribbon.LargeImage = Resource.LargeImage.GetBitmapSource();
ribbon.Text = "ricaun";
ribbon.ToolTip = "This is a Tool Tip";
ribbon.LongDescription = "This is a Long Description";
},
new RibbonDescription(LanguageType.Brazilian_Portuguese)
(ribbon) =>
{
Text = "Ola",
ToolTip = "Este é um Tool Tip",
LongDescription = "Este é um Long Description",
ribbon.LanguageType = LanguageType.Brazilian_Portuguese;
ribbon.Text = "Ola";
ribbon.ToolTip = "Este é um Tool Tip";
ribbon.LongDescription = "Este é um Long Description";
}
);

Expand Down
7 changes: 3 additions & 4 deletions ricaun.Revit.UI.Example/ricaun.Revit.UI.Example.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net46</TargetFramework>
<OutputType>Library</OutputType>
<PlatformTarget>AnyCPU</PlatformTarget>
<UseWPF>true</UseWPF>
<LangVersion>9</LangVersion>
<LangVersion>latest</LangVersion>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
<Configurations>Debug;Release</Configurations>
Expand Down Expand Up @@ -77,7 +76,7 @@

<PropertyGroup>
<PackageId>ricaun.Revit.UI.Example</PackageId>
<Version>1.1.2</Version>
<Version>1.2.0</Version>
<ProjectGuid>{f736f68f-7101-4640-9093-8715f88ccb95}</ProjectGuid>
</PropertyGroup>

Expand Down Expand Up @@ -120,7 +119,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" IncludeAssets="build; compile" PrivateAssets="All" />
<PackageReference Include="Newtonsoft.Json" Version="*" IncludeAssets="build; compile" PrivateAssets="All" />
<PackageReference Include="Revit_All_Main_Versions_API_x64" Version="$(RevitVersion).*" IncludeAssets="build; compile" PrivateAssets="All" />
</ItemGroup>

Expand Down
38 changes: 33 additions & 5 deletions ricaun.Revit.UI/RibbonButtonExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,35 @@ public static PushButtonData NewPushButtonData(this RibbonPanel ribbonPanel, Typ
}
#endregion

#region CreatePushButton
/// <summary>
/// CreatePushButton
/// </summary>
/// <typeparam name="TExternalCommand"></typeparam>
/// <param name="ribbonPanel"></param>
/// <param name="text"></param>
/// <returns></returns>
public static PushButton CreatePushButton<TExternalCommand>(this RibbonPanel ribbonPanel, string text = null) where TExternalCommand : class, IExternalCommand, new()
{
PushButton pushButton = ribbonPanel.AddItem(ribbonPanel.NewPushButtonData<TExternalCommand>(text)) as PushButton;
return pushButton;
}
/// <summary>
/// CreatePushButton
/// </summary>
/// <typeparam name="TExternalCommand"></typeparam>
/// <typeparam name="TAvailability"></typeparam>
/// <param name="ribbonPanel"></param>
/// <param name="text"></param>
/// <returns></returns>
public static PushButton CreatePushButton<TExternalCommand, TAvailability>(this RibbonPanel ribbonPanel, string text = null) where TExternalCommand : class, IExternalCommand, new() where TAvailability : class, IExternalCommandAvailability, new()
{
PushButton pushButton = ribbonPanel.CreatePushButton<TExternalCommand>(text);
pushButton.AvailabilityClassName = typeof(TAvailability).FullName;
return pushButton;
}
#endregion

#region AddPushButton
/// <summary>
/// AddPushButton
Expand All @@ -74,10 +103,10 @@ public static PushButtonData NewPushButtonData(this RibbonPanel ribbonPanel, Typ
/// <param name="ribbonPanel"></param>
/// <param name="text"></param>
/// <returns></returns>
[Obsolete("AddPushButton is deprecated, please use CreatePushButton instead.")]
public static PushButton AddPushButton<TExternalCommand>(this RibbonPanel ribbonPanel, string text = null) where TExternalCommand : class, IExternalCommand, new()
{
PushButton pushButton = ribbonPanel.AddItem(ribbonPanel.NewPushButtonData<TExternalCommand>(text)) as PushButton;
return pushButton;
return ribbonPanel.CreatePushButton<TExternalCommand>(text);
}
/// <summary>
/// AddPushButton
Expand All @@ -87,11 +116,10 @@ public static PushButtonData NewPushButtonData(this RibbonPanel ribbonPanel, Typ
/// <param name="ribbonPanel"></param>
/// <param name="text"></param>
/// <returns></returns>
[Obsolete("AddPushButton is deprecated, please use CreatePushButton instead.")]
public static PushButton AddPushButton<TExternalCommand, TAvailability>(this RibbonPanel ribbonPanel, string text = null) where TExternalCommand : class, IExternalCommand, new() where TAvailability : class, IExternalCommandAvailability, new()
{
PushButton pushButton = ribbonPanel.AddPushButton<TExternalCommand>(text);
pushButton.AvailabilityClassName = typeof(TAvailability).FullName;
return pushButton;
return ribbonPanel.CreatePushButton<TExternalCommand, TAvailability>(text);
}
#endregion
}
Expand Down
Loading

0 comments on commit a508fa2

Please sign in to comment.