Compare commits

...

3 Commits

5 changed files with 14 additions and 13 deletions

View File

@@ -57,7 +57,7 @@ namespace Ryujinx.Ava.Common.Locale
SetDynamicValues(LocaleKeys.RyujinxUpdater, RyujinxApp.FullAppName); SetDynamicValues(LocaleKeys.RyujinxUpdater, RyujinxApp.FullAppName);
SetDynamicValues(LocaleKeys.RyujinxRebooter, RyujinxApp.FullAppName); SetDynamicValues(LocaleKeys.RyujinxRebooter, RyujinxApp.FullAppName);
SetDynamicValues(LocaleKeys.CompatibilityListSearchBoxWatermarkWithCount, CompatibilityCsv.Entries.Length); SetDynamicValues(LocaleKeys.CompatibilityListSearchBoxWatermarkWithCount, CompatibilityCsv.Entries.Length);
SetDynamicValues(LocaleKeys.CompatibilityListTitle, CompatibilityCsv.Entries.Length);
} }
public string this[LocaleKeys key] public string this[LocaleKeys key]

View File

@@ -49,16 +49,13 @@ namespace Ryujinx.Ava.UI.Views.Misc
private async void IdString_OnClick(object sender, RoutedEventArgs e) private async void IdString_OnClick(object sender, RoutedEventArgs e)
{ {
if (DataContext is not MainWindowViewModel mwvm)
return;
if (sender is not Button { Content: TextBlock idText }) if (sender is not Button { Content: TextBlock idText })
return; return;
if (!RyujinxApp.IsClipboardAvailable(out IClipboard clipboard)) if (!RyujinxApp.IsClipboardAvailable(out IClipboard clipboard))
return; return;
ApplicationData appData = mwvm.Applications.FirstOrDefault(it => it.IdString == idText.Text); ApplicationData appData = RyujinxApp.MainWindow.ViewModel.Applications.FirstOrDefault(it => it.IdString == idText.Text);
if (appData is null) if (appData is null)
return; return;

View File

@@ -21,12 +21,10 @@ namespace Ryujinx.Ava.UI.Windows
SearchBoxNormal = { Text = titleId ?? string.Empty } SearchBoxNormal = { Text = titleId ?? string.Empty }
}); });
public CompatibilityListWindow() public CompatibilityListWindow() : base(useCustomTitleBar: true)
{ {
Title = RyujinxApp.FormatTitle(LocaleKeys.CompatibilityListTitle); Title = RyujinxApp.FormatTitle(LocaleKeys.CompatibilityListTitle);
TitleBar.ExtendsContentIntoTitleBar = !ConfigurationState.Instance.ShowTitleBar;
TitleBar.TitleBarHitTestType = ConfigurationState.Instance.ShowTitleBar ? TitleBarHitTestType.Simple : TitleBarHitTestType.Complex;
TitleBar.Height = 37; TitleBar.Height = 37;
InitializeComponent(); InitializeComponent();
@@ -36,6 +34,8 @@ namespace Ryujinx.Ava.UI.Windows
NormalControls.IsVisible = ConfigurationState.Instance.ShowTitleBar; NormalControls.IsVisible = ConfigurationState.Instance.ShowTitleBar;
} }
// ReSharper disable once UnusedMember.Local
// its referenced in the axaml but rider keeps yelling at me that its unused so
private void TextBox_OnTextChanged(object sender, TextChangedEventArgs e) private void TextBox_OnTextChanged(object sender, TextChangedEventArgs e)
{ {
if (DataContext is not CompatibilityViewModel cvm) if (DataContext is not CompatibilityViewModel cvm)

View File

@@ -76,7 +76,7 @@ namespace Ryujinx.Ava.UI.Windows
public readonly double StatusBarHeight; public readonly double StatusBarHeight;
public readonly double MenuBarHeight; public readonly double MenuBarHeight;
public MainWindow() public MainWindow() : base(useCustomTitleBar: true)
{ {
DataContext = ViewModel = new MainWindowViewModel DataContext = ViewModel = new MainWindowViewModel
{ {
@@ -90,9 +90,6 @@ namespace Ryujinx.Ava.UI.Windows
ViewModel.Title = RyujinxApp.FormatTitle(); ViewModel.Title = RyujinxApp.FormatTitle();
TitleBar.ExtendsContentIntoTitleBar = !ConfigurationState.Instance.ShowTitleBar;
TitleBar.TitleBarHitTestType = (ConfigurationState.Instance.ShowTitleBar) ? TitleBarHitTestType.Simple : TitleBarHitTestType.Complex;
// NOTE: Height of MenuBar and StatusBar is not usable here, since it would still be 0 at this point. // NOTE: Height of MenuBar and StatusBar is not usable here, since it would still be 0 at this point.
StatusBarHeight = StatusBarView.StatusBar.MinHeight; StatusBarHeight = StatusBarView.StatusBar.MinHeight;
MenuBarHeight = MenuBar.MinHeight; MenuBarHeight = MenuBar.MinHeight;

View File

@@ -6,6 +6,7 @@ using Avalonia.Media;
using Avalonia.Platform; using Avalonia.Platform;
using FluentAvalonia.UI.Windowing; using FluentAvalonia.UI.Windowing;
using Ryujinx.Ava.Common.Locale; using Ryujinx.Ava.Common.Locale;
using Ryujinx.Ava.Systems.Configuration;
using Ryujinx.Ava.UI.ViewModels; using Ryujinx.Ava.UI.ViewModels;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -21,7 +22,7 @@ namespace Ryujinx.Ava.UI.Windows
await appWindow.ShowDialog(owner ?? RyujinxApp.MainWindow); await appWindow.ShowDialog(owner ?? RyujinxApp.MainWindow);
} }
protected StyleableAppWindow() protected StyleableAppWindow(bool useCustomTitleBar = false)
{ {
WindowStartupLocation = WindowStartupLocation.CenterOwner; WindowStartupLocation = WindowStartupLocation.CenterOwner;
TransparencyLevelHint = [WindowTransparencyLevel.None]; TransparencyLevelHint = [WindowTransparencyLevel.None];
@@ -29,6 +30,12 @@ namespace Ryujinx.Ava.UI.Windows
LocaleManager.Instance.LocaleChanged += LocaleChanged; LocaleManager.Instance.LocaleChanged += LocaleChanged;
LocaleChanged(); LocaleChanged();
if (useCustomTitleBar)
{
TitleBar.ExtendsContentIntoTitleBar = !ConfigurationState.Instance.ShowTitleBar;
TitleBar.TitleBarHitTestType = ConfigurationState.Instance.ShowTitleBar ? TitleBarHitTestType.Simple : TitleBarHitTestType.Complex;
}
Icon = MainWindowViewModel.IconBitmap; Icon = MainWindowViewModel.IconBitmap;
} }