-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from ricaun-io/develop
Version 0.5.7
- Loading branch information
Showing
19 changed files
with
322 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using ricaun.Revit.UI; | ||
using System; | ||
using System.Collections; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Windows.Media.Imaging; | ||
|
||
namespace ricaun.Revit.UI.Example.Proprieties | ||
{ | ||
public static class Icons | ||
{ | ||
/// <summary> | ||
/// Get Icon | ||
/// </summary> | ||
public static BitmapSource Icon => GetIcon().GetBitmapSource(); | ||
public static string[] IconResources { get; } = GetIcons(); | ||
private static int IndexResource = 0; | ||
private static string GetIcon() | ||
{ | ||
var icon = IconResources[IndexResource]; | ||
IndexResource = (IndexResource + 1) % IconResources.Length; | ||
return icon; | ||
} | ||
private static string AssemblyName => "UIFrameworkRes"; | ||
private static string[] GetIcons() | ||
{ | ||
var assembly = AppDomain.CurrentDomain.GetAssemblies() | ||
.FirstOrDefault(e => e.GetName().Name.Equals(AssemblyName, StringComparison.InvariantCultureIgnoreCase)); | ||
|
||
return GetResourceNames(assembly) | ||
.Where(e => e.Contains("ribbon")) | ||
.Where(e => e.EndsWith(".ico")) | ||
.Select(e => $"/{AssemblyName};component/{e}") | ||
.ToArray(); | ||
} | ||
/// <summary> | ||
/// GetResourceNames | ||
/// </summary> | ||
/// <param name="assembly"></param> | ||
/// <returns></returns> | ||
private static string[] GetResourceNames(Assembly assembly) | ||
{ | ||
string resName = assembly.GetName().Name + ".g.resources"; | ||
using (var stream = assembly.GetManifestResourceStream(resName)) | ||
using (var reader = new System.Resources.ResourceReader(stream)) | ||
{ | ||
var resources = reader.Cast<DictionaryEntry>().Select(entry => (string)entry.Key).OrderBy(e => e).ToArray(); | ||
return resources; | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.