From a0e157a8af6c3396cd158e678e844e12a685468a Mon Sep 17 00:00:00 2001 From: Ray Berezowski <6616212+rberezowski@users.noreply.github.com> Date: Tue, 2 Jun 2026 20:19:47 -0400 Subject: [PATCH] Embed branding assets in app assembly --- AboutWindow.xaml | 2 +- Services/LauncherController.cs | 18 ++++++++++++++++-- TaskbarLauncher.csproj | 4 ++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/AboutWindow.xaml b/AboutWindow.xaml index 5e263a5..ed04a18 100644 --- a/AboutWindow.xaml +++ b/AboutWindow.xaml @@ -28,7 +28,7 @@ Background="{DynamicResource AppSurfaceBrush}" HorizontalAlignment="Left" VerticalAlignment="Top"> - diff --git a/Services/LauncherController.cs b/Services/LauncherController.cs index a79a9fc..1c5931a 100644 --- a/Services/LauncherController.cs +++ b/Services/LauncherController.cs @@ -106,8 +106,22 @@ public sealed class LauncherController : IDisposable private static Icon LoadTrayIcon() { - string iconPath = Path.Combine(AppContext.BaseDirectory, "Assets", "TrayIcon.ico"); - return File.Exists(iconPath) ? new Icon(iconPath) : SystemIcons.Application; + try + { + Uri iconUri = new("pack://application:,,,/Assets/TrayIcon.ico", UriKind.Absolute); + System.Windows.Resources.StreamResourceInfo? resource = System.Windows.Application.GetResourceStream(iconUri); + if (resource?.Stream is null) + { + return SystemIcons.Application; + } + + using Icon icon = new(resource.Stream); + return (Icon)icon.Clone(); + } + catch + { + return SystemIcons.Application; + } } private void LaunchItem(LauncherItem item) diff --git a/TaskbarLauncher.csproj b/TaskbarLauncher.csproj index 673501b..b07477c 100644 --- a/TaskbarLauncher.csproj +++ b/TaskbarLauncher.csproj @@ -18,8 +18,8 @@ - - + +