File tree Expand file tree Collapse file tree 4 files changed +28
-0
lines changed Expand file tree Collapse file tree 4 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ using System ;
2+ using Microsoft . UI ;
3+ using Microsoft . UI . Windowing ;
4+ using Microsoft . UI . Xaml ;
5+ using Microsoft . UI . Xaml . Controls . Primitives ;
6+ using WinRT . Interop ;
7+
8+ namespace Coder . Desktop . App . Utils
9+ {
10+ public static class TitleBarIcon
11+ {
12+ public static void SetTitlebarIcon ( Window window )
13+ {
14+ var hwnd = WindowNative . GetWindowHandle ( window ) ;
15+ var windowId = Win32Interop . GetWindowIdFromWindow ( hwnd ) ;
16+ AppWindow . GetFromWindowId ( windowId ) . SetIcon ( "coder.ico" ) ;
17+ }
18+ }
19+ }
Original file line number Diff line number Diff line change 88using Microsoft . UI . Xaml . Media ;
99using WinRT . Interop ;
1010using WinUIEx ;
11+ using Coder . Desktop . App . Utils ;
1112
1213namespace Coder . Desktop . App . Views ;
1314
@@ -16,6 +17,8 @@ public sealed partial class DirectoryPickerWindow : WindowEx
1617 public DirectoryPickerWindow ( DirectoryPickerViewModel viewModel )
1718 {
1819 InitializeComponent ( ) ;
20+ TitleBarIcon . SetTitlebarIcon ( this ) ;
21+
1922 SystemBackdrop = new DesktopAcrylicBackdrop ( ) ;
2023
2124 viewModel . Initialize ( this , DispatcherQueue ) ;
Original file line number Diff line number Diff line change 22using Coder . Desktop . App . Views . Pages ;
33using Microsoft . UI . Xaml . Media ;
44using WinUIEx ;
5+ using Coder . Desktop . App . Utils ;
56
67namespace Coder . Desktop . App . Views ;
78
@@ -13,11 +14,14 @@ public FileSyncListWindow(FileSyncListViewModel viewModel)
1314 {
1415 ViewModel = viewModel ;
1516 InitializeComponent ( ) ;
17+ TitleBarIcon . SetTitlebarIcon ( this ) ;
18+
1619 SystemBackdrop = new DesktopAcrylicBackdrop ( ) ;
1720
1821 ViewModel . Initialize ( this , DispatcherQueue ) ;
1922 RootFrame . Content = new FileSyncListMainPage ( ViewModel ) ;
2023
2124 this . CenterOnScreen ( ) ;
2225 }
26+
2327}
Original file line number Diff line number Diff line change 66using Microsoft . UI . Windowing ;
77using Microsoft . UI . Xaml ;
88using Microsoft . UI . Xaml . Media ;
9+ using Coder . Desktop . App . Utils ;
910
1011namespace Coder . Desktop . App . Views ;
1112
@@ -22,6 +23,7 @@ public sealed partial class SignInWindow : Window
2223 public SignInWindow ( SignInViewModel viewModel )
2324 {
2425 InitializeComponent ( ) ;
26+ TitleBarIcon . SetTitlebarIcon ( this ) ;
2527 SystemBackdrop = new DesktopAcrylicBackdrop ( ) ;
2628 RootFrame . SizeChanged += RootFrame_SizeChanged ;
2729
You can’t perform that action at this time.
0 commit comments