Skip to content

Commit

Permalink
Update Version 0.0.2
Browse files Browse the repository at this point in the history
Update Version 0.0.2
  • Loading branch information
ricaun authored Dec 17, 2021
2 parents 2e87fa7 + 1fd58b4 commit 3e4eb7a
Show file tree
Hide file tree
Showing 13 changed files with 787 additions and 44 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ 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.0.2] / 2021-12-11
- Empty Text error (use `ShowText = false`)
- Add `<Revision>`
- Add Text to empty
- Fix Text on `NewPushButtonData`
- Add `AssemblyName` on Develop Version
- Fix Unique Name Problem
- Add `ricaun.Revit.UI.Example` Project
- Try not valid Button Item
- Add Scale ImageSource
- Add RibbonItemExtension
- Fix net47 to net46

## [0.0.1] / 2021-12-11
- Fix Release / Content Build folder
- Add README / LICENSE
Expand All @@ -17,4 +30,5 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- First Release

[vNext]: https://github.com/ricaun-io/ricaun.Revit.UI/compare/1.0.0...HEAD
[0.0.2]: https://github.com/ricaun-io/ricaun.Revit.UI/compare/0.0.1...0.0.2
[0.0.1]: https://github.com/ricaun-io/ricaun.Revit.UI/compare/0.0.1
3 changes: 3 additions & 0 deletions ricaun.Revit.UI.Example/FodyWeavers.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Weavers>
<PropertyChanged/>
</Weavers>
73 changes: 73 additions & 0 deletions ricaun.Revit.UI.Example/Proprieties/Resource.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 124 additions & 0 deletions ricaun.Revit.UI.Example/Proprieties/Resource.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\icon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
Binary file added ricaun.Revit.UI.Example/Resources/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
101 changes: 101 additions & 0 deletions ricaun.Revit.UI.Example/Revit/App.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using ricaun.Revit.UI;
using System;

namespace ricaun.Revit.UI.Example.Revit
{
[Console]
public class App : IExternalApplication
{
private static RibbonPanel ribbonPanel;
public Result OnStartup(UIControlledApplication application)
{
ribbonPanel = application.CreatePanel("Example");
ribbonPanel.AddPushButton<Commands.Command>();

ribbonPanel.CreatePulldownButton(new[] {
ribbonPanel.NewPushButtonData<Commands.Command>(),
ribbonPanel.NewPushButtonData<Commands.Command>(),
ribbonPanel.NewPushButtonData<Commands.Command>(),
ribbonPanel.NewPushButtonData<Commands.Command>(),
ribbonPanel.NewPushButtonData<Commands.Command>(),
ribbonPanel.NewPushButtonData<Commands.Command>(),
ribbonPanel.NewPushButtonData<Commands.Command>() });

ribbonPanel.CreateSplitButton(new[] {
ribbonPanel.NewPushButtonData<Commands.Command>(),
ribbonPanel.NewPushButtonData<Commands.Command>(),
ribbonPanel.NewPushButtonData<Commands.Command>(),
ribbonPanel.NewPushButtonData<Commands.Command>(),
ribbonPanel.NewPushButtonData<Commands.Command>(),
ribbonPanel.NewPushButtonData<Commands.Command>(),
ribbonPanel.NewPushButtonData<Commands.Command>(),
ribbonPanel.NewPushButtonData<Commands.Command>() });

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

var items = ribbonPanel.AddStackedItems(
ribbonPanel.NewPushButtonData<Commands.Command>("Item1"),
ribbonPanel.NewPushButtonData<Commands.Command>("Item2"));

foreach (var item in items)
{
var ri = item.GetRibbonItem();
ri.ShowText = false;
ri.Size = Autodesk.Windows.RibbonItemSize.Large;
}

var item3s = ribbonPanel.AddStackedItems(
ribbonPanel.NewPushButtonData<Commands.Command>("1"),
ribbonPanel.NewPushButtonData<Commands.Command>("2"),
ribbonPanel.NewPushButtonData<Commands.Command>("3"));

foreach (var item in item3s)
{
var ri = item.GetRibbonItem();
ri.ShowText = false;
}

foreach (var item in ribbonPanel.GetItems())
{
if (item is PushButton pushButton)
{
pushButton.LargeImage = Proprieties.Resource.icon.GetBitmapSource();
pushButton.Image = Proprieties.Resource.icon.GetBitmapSource().Scale(0.5);
pushButton.ToolTipImage = Proprieties.Resource.icon.GetBitmapSource().Scale(2);
}
if (item is PulldownButton pulldownButton)
{
pulldownButton.LargeImage = Proprieties.Resource.icon.GetBitmapSource();
pulldownButton.Image = Proprieties.Resource.icon.GetBitmapSource().Scale(0.5);
pulldownButton.ToolTipImage = Proprieties.Resource.icon.GetBitmapSource().Scale(2);
}
if (item is SplitButton splitButton)
{
foreach (var i in splitButton.GetItems())
{
if (i is PushButton pb)
{
pb.LargeImage = Proprieties.Resource.icon.GetBitmapSource();
pb.Image = Proprieties.Resource.icon.GetBitmapSource().Scale(0.5);
pb.ToolTipImage = Proprieties.Resource.icon.GetBitmapSource().Scale(2);
}
}
}
}

return Result.Succeeded;
}

public Result OnShutdown(UIControlledApplication application)
{
ribbonPanel.Close();
return Result.Succeeded;
}
}

internal class ConsoleAttribute : Attribute
{
}
}
22 changes: 22 additions & 0 deletions ricaun.Revit.UI.Example/Revit/Commands/Command.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using System;

namespace ricaun.Revit.UI.Example.Revit.Commands
{
[Transaction(TransactionMode.Manual)]
public class Command : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet)
{
UIApplication uiapp = commandData.Application;

Console.WriteLine(typeof(Command).Assembly);

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

return Result.Succeeded;
}
}
}
Loading

0 comments on commit 3e4eb7a

Please sign in to comment.