Skip to content

Commit

Permalink
- Special Icons8 class
Browse files Browse the repository at this point in the history
  • Loading branch information
ricaun committed Feb 2, 2022
1 parent e93f56b commit 95df152
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ 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.0.6] / 2022-02-02
- Special Icons8 class
- Update Example Version
- Add Icon / InstallationFiles
- Add More Icons
Expand Down
42 changes: 42 additions & 0 deletions ricaun.Revit.UI.Example/Proprieties/Icons8.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using System;
using System.Runtime.CompilerServices;
using System.Windows.Media.Imaging;
using ricaun.Revit.UI;

namespace ricaun.Revit.UI.Example.Proprieties
{
/// <summary>
/// https://icons8.com/
/// https://img.icons8.com/small/32/000000/circled.png
/// https://img.icons8.com/{0}/{1}/{2}/{3}.png
/// </summary>
public class Icons8
{
#region Private
private static string Color => "000000";
private static string Type => "color";
private static string Size => "32";
private static string BaseUri => @"https://img.icons8.com/{0}/{1}/{2}/{3}.png";
#endregion

#region Icons
public static BitmapSource Icon([CallerMemberName] string name = null) => string.Format(BaseUri, Type, Size, Color, name.ToLower()).GetBitmapSource();
public static BitmapSource Ok => Icon();
public static BitmapSource Document => Icon();
public static BitmapSource File => Icon();
public static BitmapSource Support => Icon();
public static BitmapSource Settings => Icon();
public static BitmapSource About => Icon();
public static BitmapSource Restart => Icon();
public static BitmapSource Filter => Icon();
public static BitmapSource Search => Icon();
public static BitmapSource Trash => Icon();
public static BitmapSource Home => Icon();
public static BitmapSource Menu => Icon();
public static BitmapSource Info => Icon();
public static BitmapSource Circled => Icon();
public static BitmapSource Checked => Icon();
public static BitmapSource Cancel => Icon();
#endregion
}
}
35 changes: 18 additions & 17 deletions ricaun.Revit.UI.Example/Revit/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Autodesk.Revit.ApplicationServices;
using System;
using System.Linq;
using ricaun.Revit.UI.Example.Proprieties;

namespace ricaun.Revit.UI.Example.Revit
{
Expand Down Expand Up @@ -80,7 +81,7 @@ private void UpdateRibbonDescription(RibbonPanel ribbonPanel)
setting.Add<Commands.Command>(
new RibbonDescription()
{
LargeImage = Proprieties.Resource.LargeImage.GetBitmapSource(),
LargeImage = Resource.LargeImage.GetBitmapSource(),
Text = "Hello",
ToolTip = "This is a Tool Tip",
LongDescription = "This is a Long Description",
Expand All @@ -97,53 +98,53 @@ private void UpdateRibbonDescription(RibbonPanel ribbonPanel)
new RibbonDescription()
{
Text = "Ok",
LargeImage = @"https://img.icons8.com/small/32/000000/ok.png".GetBitmapSource()
LargeImage = Icons8.Ok
}
);

setting.Add<Commands.Command<int>>(
new RibbonDescription()
{
Text = "int",
LargeImage = @"https://img.icons8.com/small/32/000000/document.png".GetBitmapSource()
LargeImage = Icons8.Document
}
);

setting.Add<Commands.Command<double>>(
new RibbonDescription()
{
Text = "double",
LargeImage = @"https://img.icons8.com/small/32/000000/file.png".GetBitmapSource()
LargeImage = Icons8.File
}
);

setting.Add<Commands.Command<bool>>(
new RibbonDescription()
{
Text = "bool",
LargeImage = @"https://img.icons8.com/small/32/000000/support.png".GetBitmapSource()
LargeImage = Icons8.Support
}
);

setting.Add<Commands.Command<string>>(
new RibbonDescription()
{
Text = "text",
LargeImage = @"https://img.icons8.com/small/32/000000/settings.png".GetBitmapSource()
LargeImage = Icons8.Settings
}
);

setting.Add("PulldownButton", new RibbonDescription()
{
Text = "Menu",
LargeImage = @"https://img.icons8.com/small/32/000000/about.png".GetBitmapSource()
LargeImage = Icons8.About
});


setting.Add<Commands.Command<UIApplication>>(new RibbonDescription()
{
Text = "UIApplication",
LargeImage = @"https://img.icons8.com/small/32/000000/restart.png".GetBitmapSource(),
LargeImage = Icons8.Restart,
Action = (ribbonItem) =>
{
ribbonItem.SetItemSize();
Expand All @@ -154,7 +155,7 @@ private void UpdateRibbonDescription(RibbonPanel ribbonPanel)
setting.Add<Commands.Command<UIDocument>>(new RibbonDescription()
{
Text = "UIDocument",
LargeImage = @"https://img.icons8.com/small/32/000000/filter.png".GetBitmapSource(),
LargeImage = Icons8.Filter,
Action = (ribbonItem) =>
{
ribbonItem.SetItemSize();
Expand All @@ -165,7 +166,7 @@ private void UpdateRibbonDescription(RibbonPanel ribbonPanel)
setting.Add<Commands.Command<Application>>(new RibbonDescription()
{
Text = "Application",
LargeImage = @"https://img.icons8.com/small/32/000000/search.png".GetBitmapSource(),
LargeImage = Icons8.Search,
Action = (ribbonItem) =>
{
ribbonItem.SetItemSize();
Expand All @@ -176,7 +177,7 @@ private void UpdateRibbonDescription(RibbonPanel ribbonPanel)
setting.Add<Commands.Command<Document>>(new RibbonDescription()
{
Text = "Document",
LargeImage = @"https://img.icons8.com/small/32/000000/trash.png".GetBitmapSource(),
LargeImage = Icons8.Trash,
Action = (ribbonItem) =>
{
ribbonItem.SetItemSize();
Expand All @@ -187,7 +188,7 @@ private void UpdateRibbonDescription(RibbonPanel ribbonPanel)
setting.Add<Commands.Command<RibbonItem>>(new RibbonDescription()
{
Text = "RibbonItem",
LargeImage = @"https://img.icons8.com/small/32/000000/home.png".GetBitmapSource(),
LargeImage = Icons8.Home,
Action = (ribbonItem) =>
{
ribbonItem.GetRibbonItem().AddQuickAccessToolBar();
Expand All @@ -198,7 +199,7 @@ private void UpdateRibbonDescription(RibbonPanel ribbonPanel)
setting.Add<Commands.Command<RibbonButton>>(new RibbonDescription()
{
Text = "RibbonButton",
LargeImage = @"https://img.icons8.com/small/32/000000/menu.png".GetBitmapSource(),
LargeImage = Icons8.Menu,
Action = (ribbonItem) =>
{
ribbonItem.GetRibbonItem().AddQuickAccessToolBar();
Expand All @@ -209,7 +210,7 @@ private void UpdateRibbonDescription(RibbonPanel ribbonPanel)
setting.Add<Commands.Command<RibbonPanel>>(new RibbonDescription()
{
Text = "RibbonPanel",
LargeImage = @"https://img.icons8.com/small/32/000000/info.png".GetBitmapSource(),
LargeImage = Icons8.Info,
Action = (ribbonItem) =>
{
ribbonItem.GetRibbonItem().AddQuickAccessToolBar();
Expand All @@ -220,7 +221,7 @@ private void UpdateRibbonDescription(RibbonPanel ribbonPanel)
setting.Add<Commands.Command<Element>>(new RibbonDescription()
{
Text = "Element",
LargeImage = @"https://img.icons8.com/small/32/000000/unchecked-circle.png".GetBitmapSource(),
LargeImage = Icons8.Circled,
Action = (ribbonItem) =>
{
ribbonItem.SetShowText();
Expand All @@ -230,7 +231,7 @@ private void UpdateRibbonDescription(RibbonPanel ribbonPanel)
setting.Add<Commands.Command<ElementType>>(new RibbonDescription()
{
Text = "ElementType",
LargeImage = @"https://img.icons8.com/small/32/000000/checked.png".GetBitmapSource(),
LargeImage = Icons8.Checked,
Action = (ribbonItem) =>
{
ribbonItem.SetShowText();
Expand All @@ -240,7 +241,7 @@ private void UpdateRibbonDescription(RibbonPanel ribbonPanel)
setting.Add<Commands.Command<ElementArray>>(new RibbonDescription()
{
Text = "ElementArray",
LargeImage = @"https://img.icons8.com/small/32/000000/cancel.png".GetBitmapSource(),
LargeImage = Icons8.Cancel,
Action = (ribbonItem) =>
{
ribbonItem.SetShowText();
Expand Down
2 changes: 0 additions & 2 deletions ricaun.Revit.UI.Example/Revit/Commands/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ public Result Execute(ExternalCommandData commandData, ref string message, Eleme
{
UIApplication uiapp = commandData.Application;

System.Windows.MessageBox.Show(AutodeskExtension.GetAutodeskOwner(), $"Hello Revit\n{DateTime.Now}");

return Result.Succeeded;
}
}
Expand Down

0 comments on commit 95df152

Please sign in to comment.