From 244e7bb4fa966f1db9cb3ef598819d9e4fa48c47 Mon Sep 17 00:00:00 2001 From: Martin Topfstedt Date: Wed, 11 May 2022 19:04:28 +0200 Subject: [PATCH 01/20] fixed not using global color settings --- .../AttachedProperties/FontAwesome.cs | 2 +- .../AttachedProperties/FontAwesomePro.cs | 2 +- src/FontAwesome6.Fonts.Net/ImageAwesome.cs | 4 ++-- src/FontAwesome6.Fonts.Net/ImageAwesomePro.cs | 2 +- .../AttachedProperties/FontAwesome.cs | 2 +- .../AttachedProperties/FontAwesomePro.cs | 2 +- src/FontAwesome6.Svg.UWP/SvgAwesome.cs | 16 +--------------- 7 files changed, 8 insertions(+), 22 deletions(-) diff --git a/src/FontAwesome6.Fonts.Net/AttachedProperties/FontAwesome.cs b/src/FontAwesome6.Fonts.Net/AttachedProperties/FontAwesome.cs index 4efc94f..f5b3cbc 100644 --- a/src/FontAwesome6.Fonts.Net/AttachedProperties/FontAwesome.cs +++ b/src/FontAwesome6.Fonts.Net/AttachedProperties/FontAwesome.cs @@ -23,7 +23,7 @@ public static partial class FontAwesome /// Identifies the FontAwesome.Fonts.PrimaryColor dependency property. /// public static readonly DependencyProperty PrimaryColorProperty = - DependencyProperty.RegisterAttached("PrimaryColor", typeof(Brush), typeof(FontAwesome), new PropertyMetadata(Brushes.Black, OnRenderingTriggered)); + DependencyProperty.RegisterAttached("PrimaryColor", typeof(Brush), typeof(FontAwesome), new PropertyMetadata(FontAwesomeDefaults.PrimaryColor, OnRenderingTriggered)); /// /// Identifies the FontAwesome.Fonts.Spin dependency property. diff --git a/src/FontAwesome6.Fonts.Net/AttachedProperties/FontAwesomePro.cs b/src/FontAwesome6.Fonts.Net/AttachedProperties/FontAwesomePro.cs index bf72d0d..431a9f1 100644 --- a/src/FontAwesome6.Fonts.Net/AttachedProperties/FontAwesomePro.cs +++ b/src/FontAwesome6.Fonts.Net/AttachedProperties/FontAwesomePro.cs @@ -9,7 +9,7 @@ public static partial class FontAwesome /// Identifies the FontAwesome.Fonts.SecondaryColor dependency property. /// public static readonly DependencyProperty SecondaryColorProperty = - DependencyProperty.RegisterAttached("SecondaryColor", typeof(Brush), typeof(FontAwesome), new PropertyMetadata(Brushes.Black, OnRenderingTriggered)); + DependencyProperty.RegisterAttached("SecondaryColor", typeof(Brush), typeof(FontAwesome), new PropertyMetadata(FontAwesomeDefaults.SecondaryColor, OnRenderingTriggered)); /// /// Identifies the FontAwesome.Fonts.PrimaryOpacity dependency property. diff --git a/src/FontAwesome6.Fonts.Net/ImageAwesome.cs b/src/FontAwesome6.Fonts.Net/ImageAwesome.cs index 9ced5eb..64c2495 100644 --- a/src/FontAwesome6.Fonts.Net/ImageAwesome.cs +++ b/src/FontAwesome6.Fonts.Net/ImageAwesome.cs @@ -17,7 +17,7 @@ public partial class ImageAwesome /// Identifies the FontAwesome6.Fonts.ImageAwesome.Foreground dependency property. /// public static readonly DependencyProperty ForegroundProperty = - DependencyProperty.Register("Foreground", typeof(Brush), typeof(ImageAwesome), new PropertyMetadata(Brushes.Black, OnIconPropertyChanged)); + DependencyProperty.Register("Foreground", typeof(Brush), typeof(ImageAwesome), new PropertyMetadata(FontAwesomeDefaults.PrimaryColor, OnIconPropertyChanged)); /// /// Identifies the FontAwesome6.Fonts.ImageAwesome.Icon dependency property. /// @@ -28,7 +28,7 @@ public partial class ImageAwesome /// Identifies the FontAwesome6.Svg.ImageAwesome.PrimaryColor dependency property. /// public static readonly DependencyProperty PrimaryColorProperty = - DependencyProperty.Register("PrimaryColor", typeof(Brush), typeof(ImageAwesome), new PropertyMetadata(Brushes.Black, OnIconPropertyChanged)); + DependencyProperty.Register("PrimaryColor", typeof(Brush), typeof(ImageAwesome), new PropertyMetadata(FontAwesomeDefaults.PrimaryColor, OnIconPropertyChanged)); /// /// Identifies the FontAwesome6.Fonts.ImageAwesome.Spin dependency property. diff --git a/src/FontAwesome6.Fonts.Net/ImageAwesomePro.cs b/src/FontAwesome6.Fonts.Net/ImageAwesomePro.cs index a2bccdb..eefea6b 100644 --- a/src/FontAwesome6.Fonts.Net/ImageAwesomePro.cs +++ b/src/FontAwesome6.Fonts.Net/ImageAwesomePro.cs @@ -16,7 +16,7 @@ public partial class ImageAwesome /// Identifies the FontAwesome6.Svg.ImageAwesome.SecondaryColor dependency property. /// public static readonly DependencyProperty SecondaryColorProperty = - DependencyProperty.Register("SecondaryColor", typeof(Brush), typeof(ImageAwesome), new PropertyMetadata(Brushes.Black, OnIconPropertyChanged)); + DependencyProperty.Register("SecondaryColor", typeof(Brush), typeof(ImageAwesome), new PropertyMetadata(FontAwesomeDefaults.SecondaryColor, OnIconPropertyChanged)); /// /// Identifies the FontAwesome6.Svg.ImageAwesome.PrimaryOpacity dependency property. diff --git a/src/FontAwesome6.Svg.Net/AttachedProperties/FontAwesome.cs b/src/FontAwesome6.Svg.Net/AttachedProperties/FontAwesome.cs index 8eb95f0..7709801 100644 --- a/src/FontAwesome6.Svg.Net/AttachedProperties/FontAwesome.cs +++ b/src/FontAwesome6.Svg.Net/AttachedProperties/FontAwesome.cs @@ -20,7 +20,7 @@ public static partial class FontAwesome /// Identifies the FontAwesome.Svg.PrimaryColor dependency property. /// public static readonly DependencyProperty PrimaryColorProperty = - DependencyProperty.RegisterAttached("PrimaryColor", typeof(Brush), typeof(FontAwesome), new PropertyMetadata(Brushes.Black, OnRenderingTriggered)); + DependencyProperty.RegisterAttached("PrimaryColor", typeof(Brush), typeof(FontAwesome), new PropertyMetadata(FontAwesomeDefaults.PrimaryColor, OnRenderingTriggered)); /// /// Identifies the FontAwesome.Svg.Spin dependency property. diff --git a/src/FontAwesome6.Svg.Net/AttachedProperties/FontAwesomePro.cs b/src/FontAwesome6.Svg.Net/AttachedProperties/FontAwesomePro.cs index 373c5ad..4207aac 100644 --- a/src/FontAwesome6.Svg.Net/AttachedProperties/FontAwesomePro.cs +++ b/src/FontAwesome6.Svg.Net/AttachedProperties/FontAwesomePro.cs @@ -10,7 +10,7 @@ public static partial class FontAwesome /// Identifies the FontAwesome.Svg.SecondaryColor dependency property. /// public static readonly DependencyProperty SecondaryColorProperty = - DependencyProperty.RegisterAttached("SecondaryColor", typeof(Brush), typeof(FontAwesome), new PropertyMetadata(Brushes.Black, OnRenderingTriggered)); + DependencyProperty.RegisterAttached("SecondaryColor", typeof(Brush), typeof(FontAwesome), new PropertyMetadata(FontAwesomeDefaults.SecondaryColor, OnRenderingTriggered)); /// /// Identifies the FontAwesome.Svg.PrimaryOpacity dependency property. diff --git a/src/FontAwesome6.Svg.UWP/SvgAwesome.cs b/src/FontAwesome6.Svg.UWP/SvgAwesome.cs index 5595e8f..c4b8da4 100644 --- a/src/FontAwesome6.Svg.UWP/SvgAwesome.cs +++ b/src/FontAwesome6.Svg.UWP/SvgAwesome.cs @@ -52,19 +52,6 @@ public partial class SvgAwesome : ContentControl, ISpinable, IRotatable, IFlippa public static readonly DependencyProperty FlipOrientationProperty = DependencyProperty.Register("FlipOrientation", typeof(EFlipOrientation), typeof(SvgAwesome), new PropertyMetadata(EFlipOrientation.Normal, FlipOrientationChanged)); - static SvgAwesome() - { - - } - - public SvgAwesome() - { - } - - private static void OpacityChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - } - /// /// Gets or sets the FontAwesome icon. Changing this property will cause the icon to be redrawn. /// @@ -234,8 +221,7 @@ private static void OnIconPropertyChanged(DependencyObject d, DependencyProperty viewBox.Height = svgAwesome.Height; svgAwesome.Content = viewBox; #if FontAwesomePro - - viewBox.Child = svgAwesome.Icon.CreateCanvas(svgAwesome.PrimaryColor, svgAwesome.SecondaryColor, svgAwesome.SwapOpacity, svgAwesome.PrimaryOpacity, svgAwesome.SecondaryOpacity); + viewBox.Child = svgAwesome.Icon.CreateCanvas(svgAwesome.PrimaryColor, svgAwesome.SecondaryColor, svgAwesome.SwapOpacity, svgAwesome.PrimaryOpacity, svgAwesome.SecondaryOpacity); #else viewBox.Child = svgAwesome.Icon.CreateCanvas(svgAwesome.PrimaryColor); #endif From c534660d4c47f1bb161f15476bec9440ac3c8a9d Mon Sep 17 00:00:00 2001 From: Martin Topfstedt Date: Thu, 19 May 2022 20:41:01 +0200 Subject: [PATCH 02/20] fixed desing time exception and new way to load svg for designer --- README.md | 37 +++ .../FontAwesome6.Example.WPF.NetCore.csproj | 1 - ...ntAwesome6.Example.WPF.NetFramework.csproj | 304 +++++++++--------- src/FontAwesome6.Example.WPF.Shared/App.xaml | 2 +- .../App.xaml.cs | 17 +- .../DesignTimeFontAwesome.xaml | 11 + .../DesignTimeFontAwesome.xaml.cs | 23 ++ .../FontAwesome6.Example.WPF.Shared.projitems | 13 + .../MainWindow.xaml | 5 +- .../MainWindow.xaml.cs | 4 +- .../MainWindowViewModel.cs | 1 + .../Properties/DesignTimeResources.xaml | 6 + .../Extensions/EFontAwesomeIconExtensions.cs | 13 +- src/FontAwesome6.Svg.Net/FontAwesomeSvg.cs | 12 +- src/FontAwesome6.Svg.Net/ImageAwesome.cs | 35 -- .../Extensions/EFontAwesomeIconExtensions.cs | 22 ++ .../FontAwesome6.Svg.Shared.projitems | 1 + .../Extensions/EFontAwesomeIconExtensions.cs | 10 +- src/FontAwesome6.Svg.UWP/FontAwesomeSvg.cs | 7 +- .../Extensions/EFontAwesomeIconExtensions.cs | 11 +- src/FontAwesome6.Svg.WinUI/FontAwesomeSvg.cs | 7 +- 21 files changed, 315 insertions(+), 227 deletions(-) create mode 100644 src/FontAwesome6.Example.WPF.Shared/DesignTimeFontAwesome.xaml create mode 100644 src/FontAwesome6.Example.WPF.Shared/DesignTimeFontAwesome.xaml.cs create mode 100644 src/FontAwesome6.Example.WPF.Shared/Properties/DesignTimeResources.xaml create mode 100644 src/FontAwesome6.Svg.Shared/Extensions/EFontAwesomeIconExtensions.cs diff --git a/README.md b/README.md index 984b13b..454ab63 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ Control | .Net Framework & .Net | WinUI | UWP ------- | ---- | ----- | ---- SvgAwesome | :white_check_mark: | :white_check_mark: | :white_check_mark: | ImageAwesome | :white_check_mark: | :x: | :x: | +Attached Properties | :white_check_mark: | :x: | :x: | ```xaml ``` +### Load Icons inside Designer + +Add a `DesignTimeResource.xaml` inside the `Properties` directory and a new UserControl (e.x. `DesignTimeFontAwesome.xaml`) anywhere. +Then add the UserControl to the ResourceDirectory. +```xaml + + + +``` +After that, you need to modify the `.csproj` file and change the entry of `DesignTimeResource.xaml` to the following: +``` + + MSBuild:Compile + Designer + true + +``` +Create a new UserControl called `DesignTimeFontAwesome.xaml` and add the icon / font loading inside the constructor. +```csharp +using System.Windows.Controls; +namespace FontAwesome6.Example.WPF +{ + public partial class DesignTimeFontAwesome : UserControl + { + public DesignTimeFontAwesome() + { + InitializeComponent(); + Svg.FontAwesomeSvg.LoadFromResource("FontAwesome6.Example.WPF.Svg.FontAwesomeSvg.all.json", typeof(App).Assembly); + } + } +} +``` \ No newline at end of file diff --git a/src/FontAwesome6.Example.NetCore/FontAwesome6.Example.WPF.NetCore.csproj b/src/FontAwesome6.Example.NetCore/FontAwesome6.Example.WPF.NetCore.csproj index 6ed0353..db9ee12 100644 --- a/src/FontAwesome6.Example.NetCore/FontAwesome6.Example.WPF.NetCore.csproj +++ b/src/FontAwesome6.Example.NetCore/FontAwesome6.Example.WPF.NetCore.csproj @@ -50,5 +50,4 @@ - diff --git a/src/FontAwesome6.Example.NetFramework/FontAwesome6.Example.WPF.NetFramework.csproj b/src/FontAwesome6.Example.NetFramework/FontAwesome6.Example.WPF.NetFramework.csproj index fb7b82f..3b44a3d 100644 --- a/src/FontAwesome6.Example.NetFramework/FontAwesome6.Example.WPF.NetFramework.csproj +++ b/src/FontAwesome6.Example.NetFramework/FontAwesome6.Example.WPF.NetFramework.csproj @@ -1,155 +1,155 @@  - - - - Debug - AnyCPU - {F371A551-7B55-491A-8C5A-8A2AA1C7BFC1} - WinExe - FontAwesome6.Example.WPF - FontAwesome6.Example.WPF.NetFramework - v4.7.2 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - true - true - - - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - true - bin\DebugPro\ - TRACE;DEBUG;FontAwesomePro - full - AnyCPU - 7.3 - prompt - true - - - bin\ReleasePro\ - TRACE;FontAwesomePro - true - pdbonly - AnyCPU - 7.3 - prompt - true - - - - ..\packages\PropertyChanged.Fody.3.4.0\lib\net40\PropertyChanged.dll - - - - - - - - - - - 4.0 - - - - - - - - Code - - - True - True - Resources.resx - - - True - Settings.settings - True - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - - - {b65d1717-f056-4086-9ec8-bc4594c8feaa} - FontAwesome6.Core - - - {51152fa9-9588-4add-b693-ffaf5bbfbd65} - FontAwesome6.Fonts.Net - - - {88f88494-28f2-4340-8762-4c01d599bbf1} - FontAwesome6.Shared.Net - - - {dc8f0d88-4bb3-4877-b453-04fe6ab420c4} - FontAwesome6.Svg.Net - - - - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - + + + + Debug + AnyCPU + {F371A551-7B55-491A-8C5A-8A2AA1C7BFC1} + WinExe + FontAwesome6.Example.WPF + FontAwesome6.Example.WPF.NetFramework + v4.7.2 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + true + + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + true + bin\DebugPro\ + TRACE;DEBUG;FontAwesomePro + full + AnyCPU + 7.3 + prompt + true + + + bin\ReleasePro\ + TRACE;FontAwesomePro + true + pdbonly + AnyCPU + 7.3 + prompt + true + + + + ..\packages\PropertyChanged.Fody.3.4.0\lib\net40\PropertyChanged.dll + + + + + + + + + + + 4.0 + + + + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + {b65d1717-f056-4086-9ec8-bc4594c8feaa} + FontAwesome6.Core + + + {51152fa9-9588-4add-b693-ffaf5bbfbd65} + FontAwesome6.Fonts.Net + + + {88f88494-28f2-4340-8762-4c01d599bbf1} + FontAwesome6.Shared.Net + + + {dc8f0d88-4bb3-4877-b453-04fe6ab420c4} + FontAwesome6.Svg.Net + + + + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + \ No newline at end of file diff --git a/src/FontAwesome6.Example.WPF.Shared/App.xaml b/src/FontAwesome6.Example.WPF.Shared/App.xaml index ed08a57..3f10be3 100644 --- a/src/FontAwesome6.Example.WPF.Shared/App.xaml +++ b/src/FontAwesome6.Example.WPF.Shared/App.xaml @@ -1,7 +1,7 @@  diff --git a/src/FontAwesome6.Example.WPF.Shared/App.xaml.cs b/src/FontAwesome6.Example.WPF.Shared/App.xaml.cs index 333d6dc..7c0478c 100644 --- a/src/FontAwesome6.Example.WPF.Shared/App.xaml.cs +++ b/src/FontAwesome6.Example.WPF.Shared/App.xaml.cs @@ -1,4 +1,5 @@ -using System.IO; +using System.CodeDom; +using System.IO; using System.Reflection; using System.Windows; @@ -12,12 +13,12 @@ public partial class App : Application public App() { LoadFontAwesomeFonts(); - LoadFontAwesomeSvg(); + LoadFontAwesomeSvg(); } - public void LoadFontAwesomeFonts() + public static void LoadFontAwesomeFonts() { - var directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + var directory = Path.GetDirectoryName(typeof(App).Assembly.Location); #if FontAwesomePro // loading FontAwesome 6 Font Files (otfs) var fontDirectory = Path.Combine(directory, "Fonts") + "/"; @@ -36,20 +37,20 @@ public void LoadFontAwesomeFonts() #endif } - public void LoadFontAwesomeSvg() + public static void LoadFontAwesomeSvg() { var directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); #if FontAwesomePro // load SVG Data - // loading FontAwesome6 SVG Data from Resource for all EFontAwesomeStyles - Svg.FontAwesomeSvg.LoadFromResource("FontAwesome6.Example.WPF.Svg.FontAwesomeSvg.all.json", Assembly.GetExecutingAssembly()); + // loading FontAwesome6 SVG Data from Resource for all EFontAwesomeStylesapp.xaml + Svg.FontAwesomeSvg.LoadFromResource("FontAwesome6.Example.WPF.Svg.FontAwesomeSvg.all.json", typeof(App).Assembly); // loading FontAwesome6 SVG Data from Resource for the EFontAwesomeStyle.Thin // Svg.FontAwesomeSvg.LoadFromResource("FontAwesome6.Example.WPF.Svg.FontAwesomeSvg.thin.json", Assembly.GetExecutingAssembly()); // loading FontAwesome6 SVG Data from directory - // Svg.FontAwesomeSvg.LoadFromDirectory(Path.Combine(directory, "Svg", "FontAwesomeSvg.all.json")); + //Svg.FontAwesomeSvg.LoadFromDirectory(Path.Combine(directory, "Svg", "FontAwesomeSvg.all.json")); #endif } diff --git a/src/FontAwesome6.Example.WPF.Shared/DesignTimeFontAwesome.xaml b/src/FontAwesome6.Example.WPF.Shared/DesignTimeFontAwesome.xaml new file mode 100644 index 0000000..55392a3 --- /dev/null +++ b/src/FontAwesome6.Example.WPF.Shared/DesignTimeFontAwesome.xaml @@ -0,0 +1,11 @@ + + + + + diff --git a/src/FontAwesome6.Example.WPF.Shared/DesignTimeFontAwesome.xaml.cs b/src/FontAwesome6.Example.WPF.Shared/DesignTimeFontAwesome.xaml.cs new file mode 100644 index 0000000..66ff439 --- /dev/null +++ b/src/FontAwesome6.Example.WPF.Shared/DesignTimeFontAwesome.xaml.cs @@ -0,0 +1,23 @@ +using System.IO; +using System.Windows.Controls; + +namespace FontAwesome6.Example.WPF +{ + public partial class DesignTimeFontAwesome : UserControl + { + public DesignTimeFontAwesome() + { + InitializeComponent(); +#if FontAwesomePro + var directory = Path.GetDirectoryName(typeof(App).Assembly.Location); + // loading FontAwesome 6 Font Files (otfs) + var fontDirectory = Path.Combine(directory, "Fonts") + "/"; + + // load all styles from a directory + Fonts.FontAwesomeFonts.LoadAllStyles(fontDirectory); + + Svg.FontAwesomeSvg.LoadFromResource("FontAwesome6.Example.WPF.Svg.FontAwesomeSvg.all.json", typeof(App).Assembly); +#endif + } + } +} diff --git a/src/FontAwesome6.Example.WPF.Shared/FontAwesome6.Example.WPF.Shared.projitems b/src/FontAwesome6.Example.WPF.Shared/FontAwesome6.Example.WPF.Shared.projitems index 9d1cd9d..5a03f1e 100644 --- a/src/FontAwesome6.Example.WPF.Shared/FontAwesome6.Example.WPF.Shared.projitems +++ b/src/FontAwesome6.Example.WPF.Shared/FontAwesome6.Example.WPF.Shared.projitems @@ -9,6 +9,16 @@ FontAwesome6.Example.WPF + + $(DefaultXamlRuntime) + Designer + MSBuild:Compile + true + + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -20,6 +30,9 @@ + + DesignTimeFontAwesome.xaml + Code MainWindow.xaml diff --git a/src/FontAwesome6.Example.WPF.Shared/MainWindow.xaml b/src/FontAwesome6.Example.WPF.Shared/MainWindow.xaml index 5237922..592f4b0 100644 --- a/src/FontAwesome6.Example.WPF.Shared/MainWindow.xaml +++ b/src/FontAwesome6.Example.WPF.Shared/MainWindow.xaml @@ -40,10 +40,7 @@ - - message-arrow-down# - message-arrow-down## - + diff --git a/src/FontAwesome6.Example.WPF.Shared/MainWindow.xaml.cs b/src/FontAwesome6.Example.WPF.Shared/MainWindow.xaml.cs index 6a7b9ff..2c72423 100644 --- a/src/FontAwesome6.Example.WPF.Shared/MainWindow.xaml.cs +++ b/src/FontAwesome6.Example.WPF.Shared/MainWindow.xaml.cs @@ -1,4 +1,6 @@ -using System.Windows; +using System.IO; +using System.Reflection; +using System.Windows; namespace FontAwesome6.Example.WPF { diff --git a/src/FontAwesome6.Example.WPF.Shared/MainWindowViewModel.cs b/src/FontAwesome6.Example.WPF.Shared/MainWindowViewModel.cs index e32ae72..2a4364c 100644 --- a/src/FontAwesome6.Example.WPF.Shared/MainWindowViewModel.cs +++ b/src/FontAwesome6.Example.WPF.Shared/MainWindowViewModel.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.IO; using System.Linq; using System.Text.RegularExpressions; using System.Windows; diff --git a/src/FontAwesome6.Example.WPF.Shared/Properties/DesignTimeResources.xaml b/src/FontAwesome6.Example.WPF.Shared/Properties/DesignTimeResources.xaml new file mode 100644 index 0000000..322ce34 --- /dev/null +++ b/src/FontAwesome6.Example.WPF.Shared/Properties/DesignTimeResources.xaml @@ -0,0 +1,6 @@ + + + diff --git a/src/FontAwesome6.Svg.Net/Extensions/EFontAwesomeIconExtensions.cs b/src/FontAwesome6.Svg.Net/Extensions/EFontAwesomeIconExtensions.cs index bc21516..843cabe 100644 --- a/src/FontAwesome6.Svg.Net/Extensions/EFontAwesomeIconExtensions.cs +++ b/src/FontAwesome6.Svg.Net/Extensions/EFontAwesomeIconExtensions.cs @@ -12,11 +12,6 @@ namespace FontAwesome6.Svg.Extensions /// public static partial class EFontAwesomeIconExtensions { - public static FontAwesomeSvgInformation GetSvgInformation(this EFontAwesomeIcon icon) - { - return FontAwesomeSvg.GetInformation(icon); - } - /// /// Creates a new System.Windows.Media.ImageSource of a specified FontAwesomeIcon and foreground System.Windows.Media.Brush. /// @@ -45,15 +40,14 @@ public static ImageSource CreateImageSource(this EFontAwesomeIcon icon, Brush pr /// A new System.Windows.Media.Drawing public static Drawing CreateDrawing(this EFontAwesomeIcon icon, Brush primary, Brush secondary = null, bool? swapOpacity = null, double? primaryOpacity = null, double? secondaryOpacity = null) { - if (icon == EFontAwesomeIcon.None) + if (icon == EFontAwesomeIcon.None || !icon.TryGetSvgInformation(out var information)) { return new DrawingVisual().Drawing; } - + var visual = new DrawingVisual(); using (var drawingContext = visual.RenderOpen()) { - var information = icon.GetSvgInformation(); if (information.Paths.Length > 1) { var primaryClone = primary.Clone(); @@ -95,12 +89,11 @@ public static Drawing CreateDrawing(this EFontAwesomeIcon icon, Brush primary, B /// A new System.Windows.UIElement public static UIElement CreateCanvas(this EFontAwesomeIcon icon, Brush primary, Brush secondary = null, bool? swapOpacity = null, double? primaryOpacity = null, double? secondaryOpacity = null) { - if (icon == EFontAwesomeIcon.None) + if (icon == EFontAwesomeIcon.None || !icon.TryGetSvgInformation(out var information)) { return new Canvas(); } - var information = icon.GetSvgInformation(); if (information.Paths.Length > 1) { var primaryClone = primary.Clone(); diff --git a/src/FontAwesome6.Svg.Net/FontAwesomeSvg.cs b/src/FontAwesome6.Svg.Net/FontAwesomeSvg.cs index e17f261..63a0070 100644 --- a/src/FontAwesome6.Svg.Net/FontAwesomeSvg.cs +++ b/src/FontAwesome6.Svg.Net/FontAwesomeSvg.cs @@ -4,8 +4,11 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.IO; +using System.Linq; using System.Reflection; +using System.Windows; namespace FontAwesome6.Svg { @@ -15,7 +18,7 @@ public static class FontAwesomeSvg static FontAwesomeSvg() { -#if !FontAwesomePro +#if !FontAwesomePro LoadFromResource("FontAwesome6.Svg.Data.FontAwesomeSvg.all.json", typeof(FontAwesomeSvg).Assembly); #endif } @@ -32,7 +35,12 @@ public static FontAwesomeSvgInformation GetInformation(EFontAwesomeIcon icon) return information; } - throw new Exception($"Couldn't load icon \"{icon}\". Please load the svg data for that icon first."); + if (!(bool)(DesignerProperties.IsInDesignModeProperty.GetMetadata(typeof(DependencyObject)).DefaultValue)) + { + throw new Exception($"Couldn't load icon \"{icon}\". Please load the svg data for that icon first."); + } + + return null; } public static void Clear() diff --git a/src/FontAwesome6.Svg.Net/ImageAwesome.cs b/src/FontAwesome6.Svg.Net/ImageAwesome.cs index d053637..3b63735 100644 --- a/src/FontAwesome6.Svg.Net/ImageAwesome.cs +++ b/src/FontAwesome6.Svg.Net/ImageAwesome.cs @@ -1,41 +1,6 @@ using FontAwesome6.Shared.Extensions; using FontAwesome6.Shared.Extensions; using FontAwesome6.Svg.Extensions; -/* Unmerged change from project 'FontAwesome6.Svg.Net (net462)' -Before: -using FontAwesome6.Shared.Extensions; -After: -using FontAwesome6.Svg.Extensions; -*/ - -/* Unmerged change from project 'FontAwesome6.Svg.Net (netcoreapp3.1)' -Before: -using FontAwesome6.Shared.Extensions; -After: -using FontAwesome6.Svg.Extensions; -*/ - -/* Unmerged change from project 'FontAwesome6.Svg.Net (net472)' -Before: -using FontAwesome6.Shared.Extensions; -After: -using FontAwesome6.Svg.Extensions; -*/ - -/* Unmerged change from project 'FontAwesome6.Svg.Net (net5.0-windows)' -Before: -using FontAwesome6.Shared.Extensions; -After: -using FontAwesome6.Svg.Extensions; -*/ - -/* Unmerged change from project 'FontAwesome6.Svg.Net (net6.0-windows)' -Before: -using FontAwesome6.Shared.Extensions; -After: -using FontAwesome6.Svg.Extensions; -*/ - using System; using System.Windows; diff --git a/src/FontAwesome6.Svg.Shared/Extensions/EFontAwesomeIconExtensions.cs b/src/FontAwesome6.Svg.Shared/Extensions/EFontAwesomeIconExtensions.cs new file mode 100644 index 0000000..505f012 --- /dev/null +++ b/src/FontAwesome6.Svg.Shared/Extensions/EFontAwesomeIconExtensions.cs @@ -0,0 +1,22 @@ +using FontAwesome6.Svg.Shared; + +namespace FontAwesome6.Svg.Extensions +{ + /// + /// EFontAwesomeIcon extensions + /// + public static partial class EFontAwesomeIconExtensions + { + public static bool TryGetSvgInformation(this EFontAwesomeIcon icon, out FontAwesomeSvgInformation svgInformation) + { + svgInformation = FontAwesomeSvg.GetInformation(icon); + return svgInformation != null; + } + + public static FontAwesomeSvgInformation GetSvgInformation(this EFontAwesomeIcon icon) + { + return FontAwesomeSvg.GetInformation(icon); + } + } + +} diff --git a/src/FontAwesome6.Svg.Shared/FontAwesome6.Svg.Shared.projitems b/src/FontAwesome6.Svg.Shared/FontAwesome6.Svg.Shared.projitems index ae24889..cdec0ea 100644 --- a/src/FontAwesome6.Svg.Shared/FontAwesome6.Svg.Shared.projitems +++ b/src/FontAwesome6.Svg.Shared/FontAwesome6.Svg.Shared.projitems @@ -9,6 +9,7 @@ FontAwesome6.Svg.Shared + \ No newline at end of file diff --git a/src/FontAwesome6.Svg.UWP/Extensions/EFontAwesomeIconExtensions.cs b/src/FontAwesome6.Svg.UWP/Extensions/EFontAwesomeIconExtensions.cs index 930c0f3..a1216eb 100644 --- a/src/FontAwesome6.Svg.UWP/Extensions/EFontAwesomeIconExtensions.cs +++ b/src/FontAwesome6.Svg.UWP/Extensions/EFontAwesomeIconExtensions.cs @@ -13,10 +13,6 @@ namespace FontAwesome6.Svg.Extensions /// public static partial class EFontAwesomeIconExtensions { - public static FontAwesomeSvgInformation GetSvgInformation(this EFontAwesomeIcon icon) - { - return FontAwesomeSvg.GetInformation(icon); - } ///// ///// Creates a new System.Windows.Media.ImageSource of a specified FontAwesomeIcon and foreground System.Windows.Media.Brush. @@ -90,7 +86,11 @@ public static FontAwesomeSvgInformation GetSvgInformation(this EFontAwesomeIcon /// A new System.Windows.UIElement public static UIElement CreateCanvas(this EFontAwesomeIcon icon, Brush primary, Brush secondary = null, bool? swapOpacity = null, double? primaryOpacity = null, double? secondaryOpacity = null) { - var information = icon.GetSvgInformation(); + if (icon == EFontAwesomeIcon.None || !icon.TryGetSvgInformation(out var information)) + { + return new Canvas(); + } + if (information.Paths.Length > 1) { var primaryClone = CloneBrush(primary); diff --git a/src/FontAwesome6.Svg.UWP/FontAwesomeSvg.cs b/src/FontAwesome6.Svg.UWP/FontAwesomeSvg.cs index 7713423..2a4d3c2 100644 --- a/src/FontAwesome6.Svg.UWP/FontAwesomeSvg.cs +++ b/src/FontAwesome6.Svg.UWP/FontAwesomeSvg.cs @@ -32,7 +32,12 @@ public static FontAwesomeSvgInformation GetInformation(EFontAwesomeIcon icon) return information; } - throw new Exception($"Couldn't load icon \"{icon}\". Please load the svg data for that icon first."); + if (!Windows.ApplicationModel.DesignMode.DesignModeEnabled) + { + throw new Exception($"Couldn't load icon \"{icon}\". Please load the svg data for that icon first."); + } + + return null; } public static void Clear() diff --git a/src/FontAwesome6.Svg.WinUI/Extensions/EFontAwesomeIconExtensions.cs b/src/FontAwesome6.Svg.WinUI/Extensions/EFontAwesomeIconExtensions.cs index 64bfa1f..2abf91d 100644 --- a/src/FontAwesome6.Svg.WinUI/Extensions/EFontAwesomeIconExtensions.cs +++ b/src/FontAwesome6.Svg.WinUI/Extensions/EFontAwesomeIconExtensions.cs @@ -13,11 +13,6 @@ namespace FontAwesome6.Svg.Extensions /// public static partial class EFontAwesomeIconExtensions { - public static FontAwesomeSvgInformation GetSvgInformation(this EFontAwesomeIcon icon) - { - return FontAwesomeSvg.GetInformation(icon); - } - ///// ///// Creates a new System.Windows.Media.ImageSource of a specified FontAwesomeIcon and foreground System.Windows.Media.Brush. ///// @@ -90,7 +85,11 @@ public static FontAwesomeSvgInformation GetSvgInformation(this EFontAwesomeIcon /// A new System.Windows.UIElement public static UIElement CreateCanvas(this EFontAwesomeIcon icon, Brush primary, Brush secondary = null, bool? swapOpacity = null, double? primaryOpacity = null, double? secondaryOpacity = null) { - var information = icon.GetSvgInformation(); + if (icon == EFontAwesomeIcon.None || !icon.TryGetSvgInformation(out var information)) + { + return new Canvas(); + } + if (information.Paths.Length > 1) { var primaryClone = CloneBrush(primary); diff --git a/src/FontAwesome6.Svg.WinUI/FontAwesomeSvg.cs b/src/FontAwesome6.Svg.WinUI/FontAwesomeSvg.cs index e17f261..dc1b82b 100644 --- a/src/FontAwesome6.Svg.WinUI/FontAwesomeSvg.cs +++ b/src/FontAwesome6.Svg.WinUI/FontAwesomeSvg.cs @@ -32,7 +32,12 @@ public static FontAwesomeSvgInformation GetInformation(EFontAwesomeIcon icon) return information; } - throw new Exception($"Couldn't load icon \"{icon}\". Please load the svg data for that icon first."); + if (!Windows.ApplicationModel.DesignMode.DesignModeEnabled) + { + throw new Exception($"Couldn't load icon \"{icon}\". Please load the svg data for that icon first."); + } + + return null; } public static void Clear() From 2a36863628db71179cde98175de8f4c45bb03066 Mon Sep 17 00:00:00 2001 From: Martin Topfstedt Date: Thu, 19 May 2022 21:16:34 +0200 Subject: [PATCH 03/20] smal changes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 454ab63..82a29bf 100644 --- a/README.md +++ b/README.md @@ -265,7 +265,7 @@ public sealed partial class MainPage : Page ``` ### Load Icons inside Designer -Add a `DesignTimeResource.xaml` inside the `Properties` directory and a new UserControl (e.x. `DesignTimeFontAwesome.xaml`) anywhere. +Add a `DesignTimeResource.xaml` inside the `Properties` directory and a new UserControl anywhere(e.x. `DesignTimeFontAwesome.xaml`). Then add the UserControl to the ResourceDirectory. ```xaml Date: Sat, 21 May 2022 17:13:28 +0100 Subject: [PATCH 04/20] Language tweaks and fix naming --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 454ab63..5f0f97a 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Font-Awesome Version: 6.1.1 ## Breaking Changes -The Package is now separated into two separate packages for SVG and Fonts. Therefore the namespace needed to be separate as well. Which means the old namespace `http://schemas.fontawesome.com/icons` has been split into `http://schemas.fontawesome.com/icons/svg` and `http://schemas.fontawesome.com/icons/fonts`. +The Package is now separated into two packages for SVG and Fonts. Therefore the namespace needed to be separate as well. Which means the old namespace `http://schemas.fontawesome.com/icons` has been split into `http://schemas.fontawesome.com/icons/svg` and `http://schemas.fontawesome.com/icons/fonts`. ## FontAwesome6 (Free) @@ -49,8 +49,8 @@ Available for following controls: ```xaml - @@ -28,15 +29,15 @@ Pro Version - + FontAwesome Svg Directory: - + Output Directory: - + From f3ff3442ae4161bc57d7412f53ad4e00dcb38fba Mon Sep 17 00:00:00 2001 From: Gareth Brown Date: Sat, 28 May 2022 10:04:17 +0100 Subject: [PATCH 13/20] Formatting --- src/FontAwesome.Generator/MainWindow.xaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/FontAwesome.Generator/MainWindow.xaml b/src/FontAwesome.Generator/MainWindow.xaml index e55d913..b519eca 100644 --- a/src/FontAwesome.Generator/MainWindow.xaml +++ b/src/FontAwesome.Generator/MainWindow.xaml @@ -5,11 +5,11 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:FontAwesome.Generator" mc:Ignorable="d" - SizeToContent="Height" + SizeToContent="Height" Title="FontAwesome Generator" Width="800" IsEnabled="{Binding IsWindowsEnabled}" d:DataContext="{d:DesignInstance local:MainWindowViewModel}"> - + @@ -22,7 +22,7 @@ - + @@ -30,17 +30,17 @@ Pro Version - FontAwesome Svg Directory: + FontAwesome Svg Directory: - + - Output Directory: + Output Directory: - + - + \ No newline at end of file From 1d04c3ce13b4c7ea0821c8254907929769d6b33a Mon Sep 17 00:00:00 2001 From: Gareth Brown Date: Sat, 28 May 2022 15:19:52 +0100 Subject: [PATCH 14/20] Implement folder browser --- .../MainWindowViewModel.cs | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/FontAwesome.Generator/MainWindowViewModel.cs b/src/FontAwesome.Generator/MainWindowViewModel.cs index f1a1844..e973056 100644 --- a/src/FontAwesome.Generator/MainWindowViewModel.cs +++ b/src/FontAwesome.Generator/MainWindowViewModel.cs @@ -6,10 +6,12 @@ using System.ComponentModel; using System.IO; using System.Linq; -using System.Windows; +using System.Windows.Forms; using System.Windows.Input; using System.Windows.Threading; +using MessageBox = System.Windows.MessageBox; + namespace FontAwesome.Generator { public class MainWindowViewModel : INotifyPropertyChanged @@ -27,15 +29,12 @@ public class MainWindowViewModel : INotifyPropertyChanged public string SvgOutputFileNamePrefix { get; set; } public ICommand GenerateSourceFilesCommand { get; set; } - public ICommand GenerateSvgFilesCommand { get; set; } + public ICommand BrowseSourceDirectoryCommand { get; set; } public ICommand BrowseFontAwesomeSvgDirectoryCommand { get; set; } - public ICommand BrowseSvgOutputDirectoryCommand { get; set; } - public ICommand BrowseSourceDirectoryCommand { get; set; } - public bool IsWindowsEnabled { get; set; } = true; public MainWindowViewModel() @@ -51,9 +50,9 @@ public MainWindowViewModel() GenerateSourceFilesCommand = new RelayCommand(obj => GenerateSourceFilesExecuted(), obj => CanExecuteGenerateSourceFiles()); GenerateSvgFilesCommand = new RelayCommand(obj => GenerateSvgFilesExecuted(), obj => CanExecuteGenerateSvgFiles()); + BrowseSourceDirectoryCommand = new RelayCommand(obj => BrowseSourceDirectoryExecuted()); BrowseFontAwesomeSvgDirectoryCommand = new RelayCommand(obj => BrowseFontAwesomeSvgDirectoryExecuted()); BrowseSvgOutputDirectoryCommand = new RelayCommand(obj => BrowseSvgOutputDirectoryExecuted()); - BrowseSourceDirectoryCommand = new RelayCommand(obj => BrowseSourceDirectoryExecuted()); } public event PropertyChangedEventHandler? PropertyChanged; @@ -114,18 +113,22 @@ private async void GenerateSvgFilesExecuted() } } - private void BrowseFontAwesomeSvgDirectoryExecuted() - { + private void BrowseSourceDirectoryExecuted() => + SourceDirectory = BrowseDirectory(SourceDirectory); - } + private void BrowseFontAwesomeSvgDirectoryExecuted() => + FontAwesomeSvgDirectory = BrowseDirectory(FontAwesomeSvgDirectory); - private void BrowseSvgOutputDirectoryExecuted() - { + private void BrowseSvgOutputDirectoryExecuted() => + SvgOutputDirectory = BrowseDirectory(SvgOutputDirectory); - } - private void BrowseSourceDirectoryExecuted() + private string BrowseDirectory(string initialDirectory) { - + var folderBrowserDialog = new FolderBrowserDialog + { + InitialDirectory = initialDirectory + }; + return folderBrowserDialog.ShowDialog() == DialogResult.OK ? folderBrowserDialog.SelectedPath : initialDirectory; } } } From 75a8608b5c1a404f3392332f598ca4feddfcb1ca Mon Sep 17 00:00:00 2001 From: Martin Topfstedt Date: Fri, 3 Jun 2022 21:27:42 +0200 Subject: [PATCH 15/20] added win ui packages, improvements for examples --- build/build.yml | 12 ++++ .../DesignTimeFontAwesome.xaml | 11 ++++ .../DesignTimeFontAwesome.xaml.cs | 19 +++++++ .../FontAwesome6.Example.UWP.csproj | 48 ++++++++++------ src/FontAwesome6.Example.UWP/MainPage.xaml | 9 ++- .../Properties/DesignTimeResources.xaml | 6 ++ .../MainWindow.xaml | 2 - .../FontAwesome6.Example.WinUI.csproj | 1 + .../MainWindow.xaml | 8 ++- src/FontAwesome6.sln | 38 +++++++------ src/NuGet/FontAwesome6.Fonts.WinUI.nuspec | 46 +++++++++++++++ src/NuGet/FontAwesome6.Pro.Fonts.WinUI.nuspec | 45 +++++++++++++++ src/NuGet/FontAwesome6.Pro.Svg.WinUI.nuspec | 56 +++++++++++++++++++ src/NuGet/FontAwesome6.Svg.WinUI.nuspec | 56 +++++++++++++++++++ 14 files changed, 315 insertions(+), 42 deletions(-) create mode 100644 src/FontAwesome6.Example.UWP/DesignTimeFontAwesome.xaml create mode 100644 src/FontAwesome6.Example.UWP/DesignTimeFontAwesome.xaml.cs create mode 100644 src/FontAwesome6.Example.UWP/Properties/DesignTimeResources.xaml create mode 100644 src/NuGet/FontAwesome6.Fonts.WinUI.nuspec create mode 100644 src/NuGet/FontAwesome6.Pro.Fonts.WinUI.nuspec create mode 100644 src/NuGet/FontAwesome6.Pro.Svg.WinUI.nuspec create mode 100644 src/NuGet/FontAwesome6.Svg.WinUI.nuspec diff --git a/build/build.yml b/build/build.yml index e706b3a..8372f94 100644 --- a/build/build.yml +++ b/build/build.yml @@ -86,12 +86,24 @@ steps: command: 'custom' arguments: 'pack src/NuGet/${{setting.key}}.Fonts.nuspec -Symbols -SymbolPackageFormat snupkg -Version $(GitVersion.NuGetVersionV2) -OutputDirectory $(Build.ArtifactStagingDirectory)' + - task: NuGetCommand@2 + displayName: '${{setting.key}}: Pack Fonts.WinUI' + inputs: + command: 'custom' + arguments: 'pack src/NuGet/${{setting.key}}.Fonts.WinUI.nuspec -Symbols -SymbolPackageFormat snupkg -Version $(GitVersion.NuGetVersionV2) -OutputDirectory $(Build.ArtifactStagingDirectory)' + - task: NuGetCommand@2 displayName: '${{setting.key}}: Pack Svg' inputs: command: 'custom' arguments: 'pack src/NuGet/${{setting.key}}.Svg.nuspec -Symbols -SymbolPackageFormat snupkg -Version $(GitVersion.NuGetVersionV2) -OutputDirectory $(Build.ArtifactStagingDirectory)' + - task: NuGetCommand@2 + displayName: '${{setting.key}}: Pack Svg.WinUI' + inputs: + command: 'custom' + arguments: 'pack src/NuGet/${{setting.key}}.Svg.WinUI.nuspec -Symbols -SymbolPackageFormat snupkg -Version $(GitVersion.NuGetVersionV2) -OutputDirectory $(Build.ArtifactStagingDirectory)' + - task: PublishBuildArtifacts@1 displayName: 'Publish Artifact' inputs: diff --git a/src/FontAwesome6.Example.UWP/DesignTimeFontAwesome.xaml b/src/FontAwesome6.Example.UWP/DesignTimeFontAwesome.xaml new file mode 100644 index 0000000..e59cf02 --- /dev/null +++ b/src/FontAwesome6.Example.UWP/DesignTimeFontAwesome.xaml @@ -0,0 +1,11 @@ + + + + + diff --git a/src/FontAwesome6.Example.UWP/DesignTimeFontAwesome.xaml.cs b/src/FontAwesome6.Example.UWP/DesignTimeFontAwesome.xaml.cs new file mode 100644 index 0000000..f81b30f --- /dev/null +++ b/src/FontAwesome6.Example.UWP/DesignTimeFontAwesome.xaml.cs @@ -0,0 +1,19 @@ +using System.IO; + +using Windows.UI.Xaml.Controls; + +namespace FontAwesome6.Example.UWP +{ + public partial class DesignTimeFontAwesome : UserControl + { + public DesignTimeFontAwesome() + { + InitializeComponent(); +#if FontAwesomePro + Fonts.FontAwesomeFonts.LoadAllStyles("ms-appx:///Fonts/"); + + Svg.FontAwesomeSvg.LoadFromResource("FontAwesome6.Example.UWP.Svg.FontAwesomeSvg.all.json", typeof(MainPage).Assembly); +#endif + } + } +} diff --git a/src/FontAwesome6.Example.UWP/FontAwesome6.Example.UWP.csproj b/src/FontAwesome6.Example.UWP/FontAwesome6.Example.UWP.csproj index f8aa62c..c59d292 100644 --- a/src/FontAwesome6.Example.UWP/FontAwesome6.Example.UWP.csproj +++ b/src/FontAwesome6.Example.UWP/FontAwesome6.Example.UWP.csproj @@ -121,6 +121,9 @@ + + DesignTimeFontAwesome.xaml + MainPage.xaml @@ -148,10 +151,19 @@ MSBuild:Compile Designer + + MSBuild:Compile + Designer + MSBuild:Compile Designer + + MSBuild:Compile + Designer + true + @@ -166,24 +178,24 @@ - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + diff --git a/src/FontAwesome6.Example.UWP/MainPage.xaml b/src/FontAwesome6.Example.UWP/MainPage.xaml index 9f1e481..be64cf5 100644 --- a/src/FontAwesome6.Example.UWP/MainPage.xaml +++ b/src/FontAwesome6.Example.UWP/MainPage.xaml @@ -9,8 +9,10 @@ xmlns:faf="using:FontAwesome6.Fonts" xmlns:fas="using:FontAwesome6.Svg" mc:Ignorable="d" - d:DataContext="{d:DesignInstance local:MainWindowViewModel}" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> + + + @@ -105,8 +107,9 @@ - - + + + diff --git a/src/FontAwesome6.Example.UWP/Properties/DesignTimeResources.xaml b/src/FontAwesome6.Example.UWP/Properties/DesignTimeResources.xaml new file mode 100644 index 0000000..183af89 --- /dev/null +++ b/src/FontAwesome6.Example.UWP/Properties/DesignTimeResources.xaml @@ -0,0 +1,6 @@ + + + diff --git a/src/FontAwesome6.Example.WPF.Shared/MainWindow.xaml b/src/FontAwesome6.Example.WPF.Shared/MainWindow.xaml index c42a5ff..98d8ca1 100644 --- a/src/FontAwesome6.Example.WPF.Shared/MainWindow.xaml +++ b/src/FontAwesome6.Example.WPF.Shared/MainWindow.xaml @@ -11,7 +11,6 @@ xmlns:fasap="http://schemas.fontawesome.com/icons/svg/properties" xmlns:viewModels="clr-namespace:FontAwesome6.Example.WPF" mc:Ignorable="d" - d:DataContext="{d:DesignInstance viewModels:MainWindowViewModel}" Title="FontAwesome6.Example.WPF" Height="675" Width="900"> @@ -40,7 +39,6 @@ - diff --git a/src/FontAwesome6.Example.WinUI/FontAwesome6.Example.WinUI.csproj b/src/FontAwesome6.Example.WinUI/FontAwesome6.Example.WinUI.csproj index c12000f..67891c4 100644 --- a/src/FontAwesome6.Example.WinUI/FontAwesome6.Example.WinUI.csproj +++ b/src/FontAwesome6.Example.WinUI/FontAwesome6.Example.WinUI.csproj @@ -12,6 +12,7 @@ true Debug;Release;DebugPro;ReleasePro None + True diff --git a/src/FontAwesome6.Example.WinUI/MainWindow.xaml b/src/FontAwesome6.Example.WinUI/MainWindow.xaml index 76f0456..8980391 100644 --- a/src/FontAwesome6.Example.WinUI/MainWindow.xaml +++ b/src/FontAwesome6.Example.WinUI/MainWindow.xaml @@ -10,6 +10,9 @@ xmlns:fas="using:FontAwesome6.Svg" mc:Ignorable="d"> + + + @@ -103,8 +106,9 @@ - - + + + diff --git a/src/FontAwesome6.sln b/src/FontAwesome6.sln index 75bb4b9..5cf3468 100644 --- a/src/FontAwesome6.sln +++ b/src/FontAwesome6.sln @@ -14,9 +14,13 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NuGet", "NuGet", "{908633A5-681A-48F4-B5CB-432ACD80B587}" ProjectSection(SolutionItems) = preProject NuGet\FontAwesome6.Fonts.nuspec = NuGet\FontAwesome6.Fonts.nuspec + NuGet\FontAwesome6.Fonts.WinUI.nuspec = NuGet\FontAwesome6.Fonts.WinUI.nuspec NuGet\FontAwesome6.Pro.Fonts.nuspec = NuGet\FontAwesome6.Pro.Fonts.nuspec + NuGet\FontAwesome6.Pro.Fonts.WinUI.nuspec = NuGet\FontAwesome6.Pro.Fonts.WinUI.nuspec NuGet\FontAwesome6.Pro.Svg.nuspec = NuGet\FontAwesome6.Pro.Svg.nuspec + NuGet\FontAwesome6.Pro.Svg.WinUI.nuspec = NuGet\FontAwesome6.Pro.Svg.WinUI.nuspec NuGet\FontAwesome6.Svg.nuspec = NuGet\FontAwesome6.Svg.nuspec + NuGet\FontAwesome6.Svg.WinUI.nuspec = NuGet\FontAwesome6.Svg.WinUI.nuspec EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{864C8755-8660-4C70-8D0E-E10D6C914343}" @@ -84,23 +88,6 @@ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FontAwesome6.Example.WinUI", "FontAwesome6.Example.WinUI\FontAwesome6.Example.WinUI.csproj", "{73A8AAB0-6FD2-4740-A5E4-7418B1D1F829}" EndProject Global - GlobalSection(SharedMSBuildProjectFiles) = preSolution - FontAwesome6.Example.WPF.Shared\FontAwesome6.Example.WPF.Shared.projitems*{01b24abc-b5d6-4ee7-a8e3-c9bd9d23cef6}*SharedItemsImports = 5 - FontAwesome6.Fonts.Shared\FontAwesome6.Fonts.Shared.projitems*{11b6c158-417b-418f-a0f2-ecb5b0ad13d8}*SharedItemsImports = 4 - FontAwesome6.Shared\FontAwesome6.Shared.projitems*{1ec20bf0-eb53-46d1-9fd0-209a6eea5634}*SharedItemsImports = 5 - FontAwesome6.Svg.Shared\FontAwesome6.Svg.Shared.projitems*{2f8530ca-7582-455f-96a4-c33839502ee4}*SharedItemsImports = 13 - FontAwesome6.Fonts.Shared\FontAwesome6.Fonts.Shared.projitems*{51152fa9-9588-4add-b693-ffaf5bbfbd65}*SharedItemsImports = 5 - FontAwesome6.Fonts.Shared\FontAwesome6.Fonts.Shared.projitems*{51fd009e-4cee-4605-af9d-ddd83afd6ab5}*SharedItemsImports = 13 - FontAwesome6.Svg.Shared\FontAwesome6.Svg.Shared.projitems*{6f049850-2655-4da6-bce0-14c61c9c9d48}*SharedItemsImports = 5 - FontAwesome6.Svg.Shared\FontAwesome6.Svg.Shared.projitems*{86cc346f-c01f-4052-b35f-5fe8fbf86b82}*SharedItemsImports = 4 - FontAwesome6.Shared\FontAwesome6.Shared.projitems*{88f88494-28f2-4340-8762-4c01d599bbf1}*SharedItemsImports = 5 - FontAwesome6.Shared\FontAwesome6.Shared.projitems*{b00644f3-59bc-4294-8e99-d1c79e0c70ac}*SharedItemsImports = 13 - FontAwesome6.Fonts.Shared\FontAwesome6.Fonts.Shared.projitems*{c0e60b32-bb48-46a2-a91f-d37a6b6f7664}*SharedItemsImports = 5 - FontAwesome6.Example.WPF.Shared\FontAwesome6.Example.WPF.Shared.projitems*{d25ea074-3ad4-49f1-844e-d0bd86596e0c}*SharedItemsImports = 13 - FontAwesome6.Svg.Shared\FontAwesome6.Svg.Shared.projitems*{dc8f0d88-4bb3-4877-b453-04fe6ab420c4}*SharedItemsImports = 5 - FontAwesome6.Shared\FontAwesome6.Shared.projitems*{e51f9e83-4305-42c3-8d72-73ae7bc141c2}*SharedItemsImports = 4 - FontAwesome6.Example.WPF.Shared\FontAwesome6.Example.WPF.Shared.projitems*{f371a551-7b55-491a-8c5a-8a2aa1c7bfc1}*SharedItemsImports = 4 - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|ARM = Debug|ARM @@ -866,4 +853,21 @@ Global GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {ED777760-5E59-4008-834B-7373DE008E3F} EndGlobalSection + GlobalSection(SharedMSBuildProjectFiles) = preSolution + FontAwesome6.Example.WPF.Shared\FontAwesome6.Example.WPF.Shared.projitems*{01b24abc-b5d6-4ee7-a8e3-c9bd9d23cef6}*SharedItemsImports = 5 + FontAwesome6.Fonts.Shared\FontAwesome6.Fonts.Shared.projitems*{11b6c158-417b-418f-a0f2-ecb5b0ad13d8}*SharedItemsImports = 4 + FontAwesome6.Shared\FontAwesome6.Shared.projitems*{1ec20bf0-eb53-46d1-9fd0-209a6eea5634}*SharedItemsImports = 5 + FontAwesome6.Svg.Shared\FontAwesome6.Svg.Shared.projitems*{2f8530ca-7582-455f-96a4-c33839502ee4}*SharedItemsImports = 13 + FontAwesome6.Fonts.Shared\FontAwesome6.Fonts.Shared.projitems*{51152fa9-9588-4add-b693-ffaf5bbfbd65}*SharedItemsImports = 5 + FontAwesome6.Fonts.Shared\FontAwesome6.Fonts.Shared.projitems*{51fd009e-4cee-4605-af9d-ddd83afd6ab5}*SharedItemsImports = 13 + FontAwesome6.Svg.Shared\FontAwesome6.Svg.Shared.projitems*{6f049850-2655-4da6-bce0-14c61c9c9d48}*SharedItemsImports = 5 + FontAwesome6.Svg.Shared\FontAwesome6.Svg.Shared.projitems*{86cc346f-c01f-4052-b35f-5fe8fbf86b82}*SharedItemsImports = 4 + FontAwesome6.Shared\FontAwesome6.Shared.projitems*{88f88494-28f2-4340-8762-4c01d599bbf1}*SharedItemsImports = 5 + FontAwesome6.Shared\FontAwesome6.Shared.projitems*{b00644f3-59bc-4294-8e99-d1c79e0c70ac}*SharedItemsImports = 13 + FontAwesome6.Fonts.Shared\FontAwesome6.Fonts.Shared.projitems*{c0e60b32-bb48-46a2-a91f-d37a6b6f7664}*SharedItemsImports = 5 + FontAwesome6.Example.WPF.Shared\FontAwesome6.Example.WPF.Shared.projitems*{d25ea074-3ad4-49f1-844e-d0bd86596e0c}*SharedItemsImports = 13 + FontAwesome6.Svg.Shared\FontAwesome6.Svg.Shared.projitems*{dc8f0d88-4bb3-4877-b453-04fe6ab420c4}*SharedItemsImports = 5 + FontAwesome6.Shared\FontAwesome6.Shared.projitems*{e51f9e83-4305-42c3-8d72-73ae7bc141c2}*SharedItemsImports = 4 + FontAwesome6.Example.WPF.Shared\FontAwesome6.Example.WPF.Shared.projitems*{f371a551-7b55-491a-8c5a-8a2aa1c7bfc1}*SharedItemsImports = 4 + EndGlobalSection EndGlobal diff --git a/src/NuGet/FontAwesome6.Fonts.WinUI.nuspec b/src/NuGet/FontAwesome6.Fonts.WinUI.nuspec new file mode 100644 index 0000000..e3a13d2 --- /dev/null +++ b/src/NuGet/FontAwesome6.Fonts.WinUI.nuspec @@ -0,0 +1,46 @@ + + + + FontAwesome6.Fonts.WinUI + $version$ + + WinUI controls for the web's most popular icon set and toolkit. + This package supports only fonts, if you need svg use FontAwesome6.Svg. + For examples https://github.com/MartinTopfstedt/FontAwesome6 + Font-Awesome Version: 6.1.1 + + Codinion + MIT + https://github.com/MartinTopfstedt/FontAwesome6 + icon.png + false + fontawesome fontawesome6 fonts + Copyright © 2021 Codinion + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/NuGet/FontAwesome6.Pro.Fonts.WinUI.nuspec b/src/NuGet/FontAwesome6.Pro.Fonts.WinUI.nuspec new file mode 100644 index 0000000..2cb71cc --- /dev/null +++ b/src/NuGet/FontAwesome6.Pro.Fonts.WinUI.nuspec @@ -0,0 +1,45 @@ + + + + FontAwesome6.Pro.Fonts.WinUI + $version$ + + WinUI controls for the web's most popular icon set and toolkit. + For examples https://github.com/MartinTopfstedt/FontAwesome6 + + Font-Awesome Version: 6.1.1 + + Codinion + MIT + https://github.com/MartinTopfstedt/FontAwesome6 + icon.png + false + fontawesome fontawesome6 fonts + Copyright © 2021 Codinion + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/NuGet/FontAwesome6.Pro.Svg.WinUI.nuspec b/src/NuGet/FontAwesome6.Pro.Svg.WinUI.nuspec new file mode 100644 index 0000000..88d74d8 --- /dev/null +++ b/src/NuGet/FontAwesome6.Pro.Svg.WinUI.nuspec @@ -0,0 +1,56 @@ + + + + FontAwesome6.Pro.Svg.WinUI + $version$ + + WinUI controls for the web's most popular icon set and toolkit. + For examples https://github.com/MartinTopfstedt/FontAwesome6 + + Font-Awesome Version: 6.1.1 + + Codinion + MIT + https://github.com/MartinTopfstedt/FontAwesome6 + icon.png + false + fontawesome fontawesome6 svg + Copyright © 2021 Codinion + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/NuGet/FontAwesome6.Svg.WinUI.nuspec b/src/NuGet/FontAwesome6.Svg.WinUI.nuspec new file mode 100644 index 0000000..ac739f7 --- /dev/null +++ b/src/NuGet/FontAwesome6.Svg.WinUI.nuspec @@ -0,0 +1,56 @@ + + + + FontAwesome6.Svg.WinUI + $version$ + + WinUI controls for the web's most popular icon set and toolkit. + This package contains only svg informations, if you need fonts use FontAwesome6.Fonts. + For examples https://github.com/MartinTopfstedt/FontAwesome6 + Font-Awesome Version: 6.1.1 + + Codinion + MIT + https://github.com/MartinTopfstedt/FontAwesome6 + icon.png + false + fontawesome fontawesome6 svg + Copyright © 2021 Codinion + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From fec04609f37548b2f9eac0e6d25290b452f212ac Mon Sep 17 00:00:00 2001 From: Martin Topfstedt Date: Fri, 3 Jun 2022 21:29:29 +0200 Subject: [PATCH 16/20] removed wunui from normal packages --- src/NuGet/FontAwesome6.Fonts.nuspec | 7 +------ src/NuGet/FontAwesome6.Pro.Fonts.nuspec | 6 +----- src/NuGet/FontAwesome6.Pro.Svg.nuspec | 9 +-------- src/NuGet/FontAwesome6.Svg.nuspec | 9 +-------- 4 files changed, 4 insertions(+), 27 deletions(-) diff --git a/src/NuGet/FontAwesome6.Fonts.nuspec b/src/NuGet/FontAwesome6.Fonts.nuspec index 2be8809..0603456 100644 --- a/src/NuGet/FontAwesome6.Fonts.nuspec +++ b/src/NuGet/FontAwesome6.Fonts.nuspec @@ -4,7 +4,7 @@ FontAwesome6.Fonts $version$ - WPF (.Net and .Net Core), UWP and WinUI controls for the web's most popular icon set and toolkit. + WPF (.Net and .Net Core) and UWP controls for the web's most popular icon set and toolkit. This package supports only fonts, if you need svg use FontAwesome6.Svg. For examples https://github.com/MartinTopfstedt/FontAwesome6 Font-Awesome Version: 6.1.1 @@ -28,7 +28,6 @@ - @@ -67,9 +66,5 @@ - - - - diff --git a/src/NuGet/FontAwesome6.Pro.Fonts.nuspec b/src/NuGet/FontAwesome6.Pro.Fonts.nuspec index 15a81a0..84f2d95 100644 --- a/src/NuGet/FontAwesome6.Pro.Fonts.nuspec +++ b/src/NuGet/FontAwesome6.Pro.Fonts.nuspec @@ -4,7 +4,7 @@ FontAwesome6.Pro.Fonts $version$ - WPF (.Net and .Net Core), UWP and WinUI controls for the web's most popular icon set and toolkit. + WPF (.Net and .Net Core) and UWP controls for the web's most popular icon set and toolkit. For examples https://github.com/MartinTopfstedt/FontAwesome6 Font-Awesome Version: 6.1.1 @@ -28,7 +28,6 @@ - @@ -66,8 +65,5 @@ - - - diff --git a/src/NuGet/FontAwesome6.Pro.Svg.nuspec b/src/NuGet/FontAwesome6.Pro.Svg.nuspec index 1e0bb87..05fe2dd 100644 --- a/src/NuGet/FontAwesome6.Pro.Svg.nuspec +++ b/src/NuGet/FontAwesome6.Pro.Svg.nuspec @@ -4,7 +4,7 @@ FontAwesome6.Pro.Svg $version$ - WPF (.Net and .Net Core), UWP and WinUI controls for the web's most popular icon set and toolkit. + WPF (.Net and .Net Core) and UWP controls for the web's most popular icon set and toolkit. For examples https://github.com/MartinTopfstedt/FontAwesome6 Font-Awesome Version: 6.1.1 @@ -50,9 +50,6 @@ - - - @@ -90,9 +87,5 @@ - - - - diff --git a/src/NuGet/FontAwesome6.Svg.nuspec b/src/NuGet/FontAwesome6.Svg.nuspec index 402ea8f..6cbb55d 100644 --- a/src/NuGet/FontAwesome6.Svg.nuspec +++ b/src/NuGet/FontAwesome6.Svg.nuspec @@ -4,7 +4,7 @@ FontAwesome6.Svg $version$ - WPF (.Net and .Net Core), UWP and WinUI controls for the web's most popular icon set and toolkit. + WPF (.Net and .Net Core) and UWP controls for the web's most popular icon set and toolkit. This package contains only svg informations, if you need fonts use FontAwesome6.Fonts. For examples https://github.com/MartinTopfstedt/FontAwesome6 Font-Awesome Version: 6.1.1 @@ -50,9 +50,6 @@ - - - @@ -90,9 +87,5 @@ - - - - From 3a2b4fbdc0c3b0dfc01435cc30d80961d0242ccf Mon Sep 17 00:00:00 2001 From: Martin Topfstedt Date: Fri, 10 Jun 2022 19:56:38 +0200 Subject: [PATCH 17/20] fixed dependencies --- src/NuGet/FontAwesome6.Fonts.WinUI.nuspec | 2 +- src/NuGet/FontAwesome6.Pro.Fonts.WinUI.nuspec | 2 +- src/NuGet/FontAwesome6.Pro.Svg.WinUI.nuspec | 2 +- src/NuGet/FontAwesome6.Svg.WinUI.nuspec | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/NuGet/FontAwesome6.Fonts.WinUI.nuspec b/src/NuGet/FontAwesome6.Fonts.WinUI.nuspec index e3a13d2..b0c05f4 100644 --- a/src/NuGet/FontAwesome6.Fonts.WinUI.nuspec +++ b/src/NuGet/FontAwesome6.Fonts.WinUI.nuspec @@ -21,7 +21,7 @@ - + diff --git a/src/NuGet/FontAwesome6.Pro.Fonts.WinUI.nuspec b/src/NuGet/FontAwesome6.Pro.Fonts.WinUI.nuspec index 2cb71cc..9d014da 100644 --- a/src/NuGet/FontAwesome6.Pro.Fonts.WinUI.nuspec +++ b/src/NuGet/FontAwesome6.Pro.Fonts.WinUI.nuspec @@ -21,7 +21,7 @@ - + diff --git a/src/NuGet/FontAwesome6.Pro.Svg.WinUI.nuspec b/src/NuGet/FontAwesome6.Pro.Svg.WinUI.nuspec index 88d74d8..3055919 100644 --- a/src/NuGet/FontAwesome6.Pro.Svg.WinUI.nuspec +++ b/src/NuGet/FontAwesome6.Pro.Svg.WinUI.nuspec @@ -29,7 +29,7 @@ - + diff --git a/src/NuGet/FontAwesome6.Svg.WinUI.nuspec b/src/NuGet/FontAwesome6.Svg.WinUI.nuspec index ac739f7..eca243d 100644 --- a/src/NuGet/FontAwesome6.Svg.WinUI.nuspec +++ b/src/NuGet/FontAwesome6.Svg.WinUI.nuspec @@ -29,7 +29,7 @@ - + From edae031ca170b08252268812eaf7fe4f3a1138e5 Mon Sep 17 00:00:00 2001 From: Martin Topfstedt Date: Sun, 3 Jul 2022 13:46:17 +0200 Subject: [PATCH 18/20] fixed win ui missing iocons --- .../FontAwesome6.Fonts.WinUI.csproj | 22 +++++----- .../FontAwesomeFonts.cs | 41 ++++++++++++++++++- src/NuGet/FontAwesome6.Fonts.WinUI.nuspec | 8 ++-- src/NuGet/FontAwesome6.Pro.Fonts.WinUI.nuspec | 7 +++- src/NuGet/FontAwesome6.Pro.Svg.WinUI.nuspec | 4 +- src/NuGet/FontAwesome6.Svg.WinUI.nuspec | 4 +- 6 files changed, 67 insertions(+), 19 deletions(-) diff --git a/src/FontAwesome6.Fonts.WinUI/FontAwesome6.Fonts.WinUI.csproj b/src/FontAwesome6.Fonts.WinUI/FontAwesome6.Fonts.WinUI.csproj index c476931..a674f22 100644 --- a/src/FontAwesome6.Fonts.WinUI/FontAwesome6.Fonts.WinUI.csproj +++ b/src/FontAwesome6.Fonts.WinUI/FontAwesome6.Fonts.WinUI.csproj @@ -3,10 +3,12 @@ net6.0-windows10.0.17763.0 10.0.17763.0 FontAwesome6.Fonts.WinUI - win10-x86;win10-x64;win10-arm64 + win10-x86;win10-x64;win10-arm64 true WINUI Debug;Release;DebugPro;ReleasePro + False + AnyCPU @@ -18,15 +20,15 @@ - - Always - - - Always - - - Always - + + Never + + + Never + + + Never + diff --git a/src/FontAwesome6.Fonts.WinUI/FontAwesomeFonts.cs b/src/FontAwesome6.Fonts.WinUI/FontAwesomeFonts.cs index 08928cf..380bac2 100644 --- a/src/FontAwesome6.Fonts.WinUI/FontAwesomeFonts.cs +++ b/src/FontAwesome6.Fonts.WinUI/FontAwesomeFonts.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; +using System.Reflection; using Microsoft.UI.Xaml.Media; +using Microsoft.Windows.ApplicationModel.Resources; namespace FontAwesome6.Fonts { @@ -27,7 +30,9 @@ static FontAwesomeFonts() _fonts.Add(EFontAwesomeStyle.Solid, Tuple.Create("fa-solid-900.ttf", "Font Awesome 6 Free Solid")); _fonts.Add(EFontAwesomeStyle.Regular, Tuple.Create("fa-regular-400.ttf", "Font Awesome 6 Free")); - LoadAllStyles("ms-appx:///FontAwesome6.Fonts.WinUI/Fonts/"); + var path = Directory.GetCurrentDirectory(); + SaveFontFilesToDirectory(Path.Combine(path, "Fonts")); + LoadAllStyles("ms-appx:///Fonts/"); #endif } @@ -75,7 +80,7 @@ public static void LoadStyles(string uri, params EFontAwesomeStyle[] styles) /// Loads all FontFamilies and Typefaces for all EFontAwesomeStyles. /// /// Uri to the location of all font files. - /// Load from resources: new Uri("pack://application:,,,/FontAwesome6.Net;component/Fonts/") + /// Load from resources: new Uri("ms-appx:///FontAwesome6.UWP/Fonts/") /// Load from a directory: new Uri("file:///C:/Temp/", UriKind.Absolute) /// public static void LoadAllStyles(Uri uri) @@ -91,5 +96,37 @@ public static void LoadAllStyles(string uri) { LoadAllStyles(new Uri(uri)); } + +#if !FontAwesomePro + private static void SaveFontFilesToDirectory(string path) + { + if (!Directory.Exists(path)) + { + Directory.CreateDirectory(path); + } + + var assembly = typeof(FontAwesomeFonts).Assembly; + WriteResourceToFile(assembly, $"FontAwesome6.Fonts.WinUI.Fonts.fa-solid-900.ttf", Path.Combine(path, "fa-solid-900.ttf")); + WriteResourceToFile(assembly, $"FontAwesome6.Fonts.WinUI.Fonts.fa-regular-400.ttf", Path.Combine(path, "fa-regular-400.ttf")); + WriteResourceToFile(assembly, $"FontAwesome6.Fonts.WinUI.Fonts.fa-brands-400.ttf", Path.Combine(path, "fa-brands-400.ttf")); + } + + private static void WriteResourceToFile(Assembly assembly, string resourceName, string fileName) + { + if (File.Exists(fileName)) + { + File.Delete(fileName); + } + + using (var res = assembly.GetManifestResourceStream(resourceName)) + { + using (var file = new FileStream(fileName, FileMode.Create, FileAccess.Write)) + { + res.CopyTo(file); + } + } + + } +#endif } } diff --git a/src/NuGet/FontAwesome6.Fonts.WinUI.nuspec b/src/NuGet/FontAwesome6.Fonts.WinUI.nuspec index b0c05f4..0cf3a95 100644 --- a/src/NuGet/FontAwesome6.Fonts.WinUI.nuspec +++ b/src/NuGet/FontAwesome6.Fonts.WinUI.nuspec @@ -21,7 +21,10 @@ - + + + + @@ -40,7 +43,6 @@ - - + diff --git a/src/NuGet/FontAwesome6.Pro.Fonts.WinUI.nuspec b/src/NuGet/FontAwesome6.Pro.Fonts.WinUI.nuspec index 9d014da..c4f3ac4 100644 --- a/src/NuGet/FontAwesome6.Pro.Fonts.WinUI.nuspec +++ b/src/NuGet/FontAwesome6.Pro.Fonts.WinUI.nuspec @@ -21,7 +21,10 @@ - + + + + @@ -40,6 +43,6 @@ - + diff --git a/src/NuGet/FontAwesome6.Pro.Svg.WinUI.nuspec b/src/NuGet/FontAwesome6.Pro.Svg.WinUI.nuspec index 3055919..2c00d62 100644 --- a/src/NuGet/FontAwesome6.Pro.Svg.WinUI.nuspec +++ b/src/NuGet/FontAwesome6.Pro.Svg.WinUI.nuspec @@ -30,6 +30,8 @@ + + @@ -50,7 +52,7 @@ - + diff --git a/src/NuGet/FontAwesome6.Svg.WinUI.nuspec b/src/NuGet/FontAwesome6.Svg.WinUI.nuspec index eca243d..5b8c0b4 100644 --- a/src/NuGet/FontAwesome6.Svg.WinUI.nuspec +++ b/src/NuGet/FontAwesome6.Svg.WinUI.nuspec @@ -30,6 +30,8 @@ + + @@ -50,7 +52,7 @@ - + From d11484b2991b31b1930ba13f32981dd66c9eabcc Mon Sep 17 00:00:00 2001 From: Martin Topfstedt Date: Sun, 3 Jul 2022 13:49:57 +0200 Subject: [PATCH 19/20] update fontAwesome Submodule --- Font-Awesome | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Font-Awesome b/Font-Awesome index b452a2c..2360bd5 160000 --- a/Font-Awesome +++ b/Font-Awesome @@ -1 +1 @@ -Subproject commit b452a2c086a5e3f319df61b1ce1db7d8e1ad2b7c +Subproject commit 2360bd54ca4abe8e013d424e6679a397e9b717c8 From fe55c18adc832acce5aaf59e036c1f4dd89cd4e3 Mon Sep 17 00:00:00 2001 From: Martin Topfstedt Date: Sun, 3 Jul 2022 14:00:02 +0200 Subject: [PATCH 20/20] updared README --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 60d30e9..72c263c 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,8 @@ The Package is now separated into two packages for SVG and Fonts. Therefore the #### Installation Install the FontAwesome6.Svg package: `Install-Package FontAwesome6.Svg` +Or +Install the FontAwesome6.Svg.WinUI package: `Install-Package FontAwesome6.Svg.WinUI` #### Usage @@ -83,6 +85,8 @@ See example projects for advanced usage. #### Installation Install the FontAwesome6.Fonts package: `Install-Package FontAwesome6.Fonts` +Or +Install the FontAwesome6.Fonts.WinUI package: `Install-Package FontAwesome6.Fonts.WinUI` #### Usage @@ -152,6 +156,8 @@ See example projects for advanced usage. #### Installation 1. Install the FontAwesome6.Pro.Svg package: `Install-Package FontAwesome6.Pro.Svg` + Or + Install the FontAwesome6.Pro.Svg.WinUI package: `Install-Package FontAwesome6.Pro.Svg.WinUI` 2. Download the Desktop Version of FontAwesome6 from the website: https://fontawesome.com/download @@ -180,6 +186,8 @@ See example projects for advanced usage. #### Installation 1. Install the FontAwesome6.Pro.Fonts package: `Install-Package FontAwesome6.Pro.Fonts` + Or + Install the FontAwesome6.Pro.Fonts.WInUI package: `Install-Package FontAwesome6.Pro.Fonts.WinUI` 2. Download the Web Version of FontAwesome6 from the website: https://fontawesome.com/download