Skip to content

feat: add coder icon to all forms #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions App/Utils/TitleBarIcon.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using Microsoft.UI;
using Microsoft.UI.Windowing;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls.Primitives;
using WinRT.Interop;

namespace Coder.Desktop.App.Utils
{
public static class TitleBarIcon
{
public static void SetTitlebarIcon(Window window)
{
var hwnd = WindowNative.GetWindowHandle(window);
var windowId = Win32Interop.GetWindowIdFromWindow(hwnd);
AppWindow.GetFromWindowId(windowId).SetIcon("coder.ico");
}
}
}
3 changes: 3 additions & 0 deletions App/Views/DirectoryPickerWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Microsoft.UI.Xaml.Media;
using WinRT.Interop;
using WinUIEx;
using Coder.Desktop.App.Utils;

namespace Coder.Desktop.App.Views;

Expand All @@ -16,6 +17,8 @@ public sealed partial class DirectoryPickerWindow : WindowEx
public DirectoryPickerWindow(DirectoryPickerViewModel viewModel)
{
InitializeComponent();
TitleBarIcon.SetTitlebarIcon(this);

SystemBackdrop = new DesktopAcrylicBackdrop();

viewModel.Initialize(this, DispatcherQueue);
Expand Down
4 changes: 4 additions & 0 deletions App/Views/FileSyncListWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Coder.Desktop.App.Views.Pages;
using Microsoft.UI.Xaml.Media;
using WinUIEx;
using Coder.Desktop.App.Utils;

namespace Coder.Desktop.App.Views;

Expand All @@ -13,11 +14,14 @@ public FileSyncListWindow(FileSyncListViewModel viewModel)
{
ViewModel = viewModel;
InitializeComponent();
TitleBarIcon.SetTitlebarIcon(this);

SystemBackdrop = new DesktopAcrylicBackdrop();

ViewModel.Initialize(this, DispatcherQueue);
RootFrame.Content = new FileSyncListMainPage(ViewModel);

this.CenterOnScreen();
}

}
2 changes: 2 additions & 0 deletions App/Views/SignInWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Microsoft.UI.Windowing;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Media;
using Coder.Desktop.App.Utils;

namespace Coder.Desktop.App.Views;

Expand All @@ -22,6 +23,7 @@ public sealed partial class SignInWindow : Window
public SignInWindow(SignInViewModel viewModel)
{
InitializeComponent();
TitleBarIcon.SetTitlebarIcon(this);
SystemBackdrop = new DesktopAcrylicBackdrop();
RootFrame.SizeChanged += RootFrame_SizeChanged;

Expand Down
Loading