diff --git a/apps/windows/Cascade/Assets/app.ico b/apps/windows/Cascade/Assets/app.ico new file mode 100644 index 0000000..94a75f8 Binary files /dev/null and b/apps/windows/Cascade/Assets/app.ico differ diff --git a/apps/windows/Cascade/Cascade.csproj b/apps/windows/Cascade/Cascade.csproj index ea722e9..a35bc28 100644 --- a/apps/windows/Cascade/Cascade.csproj +++ b/apps/windows/Cascade/Cascade.csproj @@ -5,6 +5,8 @@ 10.0.19041.0 Cascade app.manifest + + Assets\app.ico x64;arm64 win-x64;win-arm64 true @@ -54,6 +56,10 @@ scripts/build-asset.ps1; replace with proper Square*Logo / Wide310x150 assets before shipping a real MSIX. --> + + + PreserveNewest + diff --git a/apps/windows/Cascade/MainWindow.xaml.cs b/apps/windows/Cascade/MainWindow.xaml.cs index e3503a0..679085e 100644 --- a/apps/windows/Cascade/MainWindow.xaml.cs +++ b/apps/windows/Cascade/MainWindow.xaml.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using Cascade.Services; using Cascade.ViewModels; using Microsoft.UI.Dispatching; @@ -15,10 +16,25 @@ public sealed partial class MainWindow : Window public MainWindow() { InitializeComponent(); + SetWindowIcon(); ViewModel = new AppViewModel(DispatcherQueue.GetForCurrentThread()); Closed += (_, _) => ViewModel.Dispose(); } + /// + /// Set the title-bar / taskbar icon for this unpackaged window. The .exe + /// already embeds the icon via <ApplicationIcon> (Explorer/Alt-Tab), + /// but the live window needs it set explicitly through AppWindow. + /// + private void SetWindowIcon() + { + var iconPath = Path.Combine(AppContext.BaseDirectory, "Assets", "app.ico"); + if (!File.Exists(iconPath)) return; + var hwnd = WinRT.Interop.WindowNative.GetWindowHandle(this); + var windowId = Microsoft.UI.Win32Interop.GetWindowIdFromWindow(hwnd); + Microsoft.UI.Windowing.AppWindow.GetFromWindowId(windowId).SetIcon(iconPath); + } + /// /// Slider raises ValueChanged on every motion frame; ignore the initial /// load callback (where IntermediateValue == OldValue) so we don't