Skip to content

Commit

Permalink
Merge pull request #23 from ricaun-io/develop
Browse files Browse the repository at this point in the history
Version 0.4.0
  • Loading branch information
ricaun authored Aug 23, 2022
2 parents 00e8c72 + 0896325 commit ec16a44
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 31 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ 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.4.0] / 2022-08-23
### Features
- Bitmap to BitmapSource perfect pixel

## [0.3.2] / 2022-08-16
### Features
- Add `AppLoader` Attribute
Expand Down Expand Up @@ -184,6 +188,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- First Release

[vNext]: ../../compare/1.0.0...HEAD
[0.4.0]: ../../compare/0.3.2...0.4.0
[0.3.2]: ../../compare/0.3.1...0.3.2
[0.3.1]: ../../compare/0.3.0...0.3.1
[0.3.0]: ../../compare/0.2.1...0.3.0
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

## Features

`ricaun.Revit.UI` package is design to work with the plugin [ApplicationLoader](https://ricaun.com/ApplicationLoader/) that allow loading Revit Applications on runtime.
`ricaun.Revit.UI` package is design to work with the plugin [AppLoader](https://ricaun.com/AppLoader/) that allow loading Revit Applications on runtime.

```C#
[ApplicationLoader]
[AppLoader]
public class App : IExternalApplication
{
private static RibbonPanel ribbonPanel;
Expand Down
4 changes: 3 additions & 1 deletion ricaun.Revit.UI.Example/Models/TestModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ namespace ricaun.Revit.UI.Example.Models
{
public class TestModel : NotifyPropertyBase
{
public string Text { get; set; }
public string Text { get; set; } = "Test";
public string Title { get; set; } = "Title";
public object Icon { get; set; } = Proprieties.Icons8.Circled;
public ICommand CommandTest { get; set; }
public ICommand CommandTest2 { get; set; }
}
Expand Down
28 changes: 17 additions & 11 deletions ricaun.Revit.UI.Example/Views/TestView.xaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
<Window x:Class="ricaun.Revit.UI.Example.Views.TestView"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ricaun.Revit.UI.Example.Views"
Width="320" Height="240"
mc:Ignorable="d"
>
DataContext="{Binding RelativeSource={RelativeSource Self}}"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ricaun.Revit.UI.Example.Views"
Width="320"
Height="240"
Icon="{Binding Icon}"
Title="{Binding Title}"
mc:Ignorable="d">

<Grid Background="WhiteSmoke">
<StackPanel Margin="15">
<TextBlock Text="{Binding Text}"></TextBlock>
<Button Margin="0,8,0,0" Height="24" Command="{Binding CommandTest}">Write</Button>
<Button Margin="0,8,0,0" Height="24" Command="{Binding CommandTest2}">Clear</Button>
<Button Margin="0,8,0,0"
Height="24"
Command="{Binding CommandTest}">Write</Button>
<Button Margin="0,8,0,0"
Height="24"
Command="{Binding CommandTest2}">Clear</Button>
</StackPanel>
</Grid>
</Window>
2 changes: 1 addition & 1 deletion ricaun.Revit.UI.Example/ricaun.Revit.UI.Example.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@

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

Expand Down
7 changes: 0 additions & 7 deletions ricaun.Revit.UI/AppLoaderAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,4 @@ public class ConsoleAttribute : Attribute
public class AppLoaderAttribute : Attribute
{
}

/// <summary>
/// ApplicationLoader Attribute for ricaun.AppLoader
/// </summary>
public class ApplicationLoaderAttribute : Attribute
{
}
}
21 changes: 13 additions & 8 deletions ricaun.Revit.UI/BitmapExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,28 @@ namespace ricaun.Revit.UI
public static class BitmapExtension
{
/// <summary>
/// GetBitmapSource
/// Convert <paramref name="bitmap"/> to <seealso cref="BitmapSource"/>
/// </summary>
/// <param name="bitmap"></param>
/// <returns></returns>
public static BitmapSource GetBitmapSource(this System.Drawing.Bitmap bitmap)
{
var bitmapSource = Imaging.CreateBitmapSourceFromHBitmap(
bitmap.GetHbitmap(),
IntPtr.Zero,
Int32Rect.Empty,
BitmapSizeOptions.FromEmptyOptions());
var data = bitmap.LockBits(
new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height),
System.Drawing.Imaging.ImageLockMode.ReadOnly, bitmap.PixelFormat);

var bitmapSource = BitmapSource.Create(
data.Width, data.Height, 96.0, 96.0,
System.Windows.Media.PixelFormats.Bgra32, null,
data.Scan0, data.Stride * data.Height, data.Stride);

bitmap.UnlockBits(data);

return bitmapSource;
}

/// <summary>
/// GetBitmapSource
/// Convert <paramref name="icon"/> to <seealso cref="BitmapSource"/>
/// </summary>
/// <param name="icon"></param>
/// <returns></returns>
Expand All @@ -43,7 +48,7 @@ public static BitmapSource GetBitmapSource(this System.Drawing.Icon icon)
}

/// <summary>
/// GetBitmapSource
/// Convert <paramref name="image"/> to <seealso cref="BitmapSource"/>
/// </summary>
/// <param name="image"></param>
/// <returns></returns>
Expand Down
2 changes: 1 addition & 1 deletion ricaun.Revit.UI/ricaun.Revit.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@

<PropertyGroup>
<PackageId>ricaun.Revit.UI</PackageId>
<Version>0.3.2</Version>
<Version>0.4.0</Version>
<ProjectGuid>{2064ba4d-5527-41e9-8b76-0cbfefa35900}</ProjectGuid>
</PropertyGroup>

Expand Down

0 comments on commit ec16a44

Please sign in to comment.