mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-05-08 22:35:46 +00:00
refactor: completely overhaul app icon management for cleaner workflow
This commit is contained in:
@@ -3,11 +3,13 @@ using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.Platform;
|
||||
using FluentAvalonia.UI.Windowing;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
using Ryujinx.Ava.Systems.Configuration;
|
||||
using Ryujinx.Ava.UI.Controls;
|
||||
using Ryujinx.Common;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ryujinx.Ava.UI.Windows
|
||||
@@ -39,7 +41,8 @@ namespace Ryujinx.Ava.UI.Windows
|
||||
TitleBar.Height = titleBarHeight.Value;
|
||||
}
|
||||
|
||||
Icon = RyujinxLogo.Bitmap;
|
||||
Icon = RyujinxLogo.CurrentLogoBitmap.Value;
|
||||
RyujinxLogo.CurrentLogoBitmap.Event += WindowIconChanged_Event;
|
||||
}
|
||||
|
||||
private void LocaleChanged()
|
||||
@@ -53,6 +56,12 @@ namespace Ryujinx.Ava.UI.Windows
|
||||
|
||||
ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.SystemChrome | ExtendClientAreaChromeHints.OSXThickTitleBar;
|
||||
}
|
||||
|
||||
private void WindowIconChanged_Event(object _, ReactiveEventArgs<Bitmap> rArgs) => UpdateIcon(rArgs.NewValue);
|
||||
private void UpdateIcon(Bitmap newIcon)
|
||||
{
|
||||
Icon = newIcon;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class StyleableWindow : Window
|
||||
@@ -73,7 +82,8 @@ namespace Ryujinx.Ava.UI.Windows
|
||||
LocaleManager.Instance.LocaleChanged += LocaleChanged;
|
||||
LocaleChanged();
|
||||
|
||||
Icon = new WindowIcon(RyujinxLogo.Bitmap);
|
||||
Icon = new WindowIcon(RyujinxLogo.CurrentLogoBitmap.Value);
|
||||
RyujinxLogo.CurrentLogoBitmap.Event += WindowIconChanged_Event;
|
||||
}
|
||||
|
||||
private void LocaleChanged()
|
||||
@@ -87,5 +97,11 @@ namespace Ryujinx.Ava.UI.Windows
|
||||
|
||||
ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.SystemChrome | ExtendClientAreaChromeHints.OSXThickTitleBar;
|
||||
}
|
||||
|
||||
private void WindowIconChanged_Event(object _, ReactiveEventArgs<Bitmap> rArgs) => UpdateIcon(rArgs.NewValue);
|
||||
private void UpdateIcon(Bitmap newIcon)
|
||||
{
|
||||
Icon = new WindowIcon(newIcon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user