UI: Add program icon to windows other than the main

This commit is contained in:
Evan Husted 2024-10-25 08:36:04 -05:00
parent 570c7cfaa2
commit 7d88dfa00d
4 changed files with 12 additions and 33 deletions

View file

@ -17,13 +17,7 @@
<UserControl.Resources>
<helpers:DownloadableContentLabelConverter x:Key="DownloadableContentLabel" />
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid RowDefinitions="Auto,Auto,*,Auto">
<StackPanel
Grid.Row="0"
Margin="0 0 0 10"
@ -44,12 +38,7 @@
<Panel
Margin="0 0 0 10"
Grid.Row="1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid ColumnDefinitions="Auto,Auto,*">
<TextBlock
Grid.Column="0"
Text="{Binding UpdateCount}" />
@ -101,17 +90,9 @@
<DataTemplate
DataType="models:DownloadableContentModel">
<Panel Margin="10">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid ColumnDefinitions="*,Auto">
<Grid
Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
Grid.Column="0" ColumnDefinitions="*,Auto">
<TextBlock
Grid.Column="0"
HorizontalAlignment="Left"

View file

@ -21,7 +21,6 @@
x:DataType="viewModels:MainWindowViewModel"
mc:Ignorable="d"
WindowStartupLocation="Manual"
Icon="resm:Ryujinx.UI.Common.Resources.Logo_Ryujinx.png?assembly=Ryujinx.UI.Common"
Focusable="True">
<Window.Styles>
<Style Selector="TitleBar:fullscreen">

View file

@ -84,7 +84,6 @@ namespace Ryujinx.Ava.UI.Windows
TitleBar.ExtendsContentIntoTitleBar = true;
TitleBar.TitleBarHitTestType = TitleBarHitTestType.Complex;
// NOTE: Height of MenuBar and StatusBar is not usable here, since it would still be 0 at this point.
StatusBarHeight = StatusBarView.StatusBar.MinHeight;
MenuBarHeight = MenuBar.MinHeight;
@ -98,7 +97,7 @@ namespace Ryujinx.Ava.UI.Windows
{
InputManager = new InputManager(new AvaloniaKeyboardDriver(this), new SDL2GamepadDriver());
this.GetObservable(IsActiveProperty).Subscribe(IsActiveChanged);
_ = this.GetObservable(IsActiveProperty).Subscribe(it => ViewModel.IsActive = it);
this.ScalingChanged += OnScalingChanged;
}
}
@ -106,7 +105,7 @@ namespace Ryujinx.Ava.UI.Windows
/// <summary>
/// Event handler for detecting OS theme change when using "Follow OS theme" option
/// </summary>
private void OnPlatformColorValuesChanged(object sender, PlatformColorValues e)
private static void OnPlatformColorValuesChanged(object sender, PlatformColorValues e)
{
if (Application.Current is App app)
app.ApplyConfiguredTheme();
@ -128,11 +127,6 @@ namespace Ryujinx.Ava.UI.Windows
NotificationHelper.SetNotificationManager(this);
}
private void IsActiveChanged(bool obj)
{
ViewModel.IsActive = obj;
}
private void OnScalingChanged(object sender, EventArgs e)
{
Program.DesktopScaleFactor = this.RenderScaling;
@ -355,7 +349,7 @@ namespace Ryujinx.Ava.UI.Windows
await Dispatcher.UIThread.InvokeAsync(async () => await UserErrorDialog.ShowUserErrorDialog(UserError.NoKeys));
}
if (ConfigurationState.Instance.CheckUpdatesOnStart.Value && Updater.CanUpdate(false))
if (ConfigurationState.Instance.CheckUpdatesOnStart && Updater.CanUpdate(false))
{
await Updater.BeginParse(this, false).ContinueWith(task =>
{

View file

@ -4,6 +4,7 @@ using Avalonia.Media;
using Avalonia.Platform;
using FluentAvalonia.UI.Windowing;
using Ryujinx.Ava.Common.Locale;
using Ryujinx.Ava.UI.ViewModels;
namespace Ryujinx.Ava.UI.Windows
{
@ -16,6 +17,8 @@ namespace Ryujinx.Ava.UI.Windows
LocaleManager.Instance.LocaleChanged += LocaleChanged;
LocaleChanged();
Icon = MainWindowViewModel.IconBitmap;
}
private void LocaleChanged()
@ -40,6 +43,8 @@ namespace Ryujinx.Ava.UI.Windows
LocaleManager.Instance.LocaleChanged += LocaleChanged;
LocaleChanged();
Icon = new WindowIcon(MainWindowViewModel.IconBitmap);
}
private void LocaleChanged()