From 8aff17a93c27dea7339c20f9cf73535e110ffb72 Mon Sep 17 00:00:00 2001 From: Ac_K Date: Thu, 23 Jun 2022 20:59:02 +0200 Subject: [PATCH] UI: Some Avalonia cleanup (#3358) --- Ryujinx.Ava/App.axaml | 6 +- Ryujinx.Ava/App.axaml.cs | 5 +- Ryujinx.Ava/AppHost.cs | 23 +- Ryujinx.Ava/Assets/Styles/BaseDark.xaml | 14 +- Ryujinx.Ava/Assets/Styles/BaseLight.xaml | 14 +- Ryujinx.Ava/Assets/Styles/Styles.xaml | 34 +- Ryujinx.Ava/Ui/Applet/ErrorAppletWindow.axaml | 61 +- Ryujinx.Ava/Ui/Applet/SwkbdAppletDialog.axaml | 70 +- Ryujinx.Ava/Ui/Controls/GameGridView.axaml | 307 ++++---- Ryujinx.Ava/Ui/Controls/GameListView.axaml | 188 +++-- Ryujinx.Ava/Ui/Controls/InputDialog.axaml | 33 +- .../Ui/Controls/UpdateWaitWindow.axaml | 48 +- Ryujinx.Ava/Ui/Windows/AboutWindow.axaml | 285 +++++--- Ryujinx.Ava/Ui/Windows/MainWindow.axaml | 668 ++++++++++-------- Ryujinx.Ava/Ui/Windows/UpdaterWindow.axaml | 79 ++- 15 files changed, 1119 insertions(+), 716 deletions(-) diff --git a/Ryujinx.Ava/App.axaml b/Ryujinx.Ava/App.axaml index 0db01629..eb9ffd86 100644 --- a/Ryujinx.Ava/App.axaml +++ b/Ryujinx.Ava/App.axaml @@ -1,9 +1,9 @@ + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:sty="using:FluentAvalonia.Styling"> - + \ No newline at end of file diff --git a/Ryujinx.Ava/App.axaml.cs b/Ryujinx.Ava/App.axaml.cs index a76de8b3..6ecf0198 100644 --- a/Ryujinx.Ava/App.axaml.cs +++ b/Ryujinx.Ava/App.axaml.cs @@ -2,7 +2,6 @@ using Avalonia; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Markup.Xaml; using Avalonia.Styling; -using Avalonia.Threading; using FluentAvalonia.Styling; using Ryujinx.Ava.Ui.Windows; using Ryujinx.Common; @@ -13,7 +12,7 @@ using System.IO; namespace Ryujinx.Ava { - public class App : Avalonia.Application + public class App : Application { public override void Initialize() { @@ -46,7 +45,7 @@ namespace Ryujinx.Ava private void ShowRestartDialog() { - // TODO. Implement Restart Dialog when SettingsWindow is implemented. + // TODO: Implement Restart Dialog when SettingsWindow is implemented. } private void ThemeChanged_Event(object sender, ReactiveEventArgs e) diff --git a/Ryujinx.Ava/AppHost.cs b/Ryujinx.Ava/AppHost.cs index 09163bd6..1a6ba024 100644 --- a/Ryujinx.Ava/AppHost.cs +++ b/Ryujinx.Ava/AppHost.cs @@ -57,7 +57,7 @@ namespace Ryujinx.Ava private static readonly Cursor InvisibleCursor = new Cursor(StandardCursorType.None); private readonly AccountManager _accountManager; - private UserChannelPersistence _userChannelPersistence; + private readonly UserChannelPersistence _userChannelPersistence; private readonly InputManager _inputManager; @@ -82,7 +82,6 @@ namespace Ryujinx.Ava private bool _dialogShown; private WindowsMultimediaTimerResolution _windowsMultimediaTimerResolution; - private KeyboardStateSnapshot _lastKeyboardSnapshot; private readonly CancellationTokenSource _gpuCancellationTokenSource; @@ -126,7 +125,6 @@ namespace Ryujinx.Ava _glLogLevel = ConfigurationState.Instance.Logger.GraphicsDebugLevel; _inputManager.SetMouseDriver(new AvaloniaMouseDriver(renderer)); _keyboardInterface = (IKeyboard)_inputManager.KeyboardDriver.GetGamepad("0"); - _lastKeyboardSnapshot = _keyboardInterface.GetKeyboardStateSnapshot(); NpadManager = _inputManager.CreateNpadManager(); TouchScreenManager = _inputManager.CreateTouchScreenManager(); @@ -722,9 +720,7 @@ namespace Ryujinx.Ava } } - var memoryConfiguration = ConfigurationState.Instance.System.ExpandRam.Value - ? HLE.MemoryConfiguration.MemoryConfiguration6GB - : HLE.MemoryConfiguration.MemoryConfiguration4GB; + var memoryConfiguration = ConfigurationState.Instance.System.ExpandRam.Value ? HLE.MemoryConfiguration.MemoryConfiguration6GB : HLE.MemoryConfiguration.MemoryConfiguration4GB; IntegrityCheckLevel fsIntegrityCheckLevel = ConfigurationState.Instance.System.EnableFsIntegrityChecks ? IntegrityCheckLevel.ErrorOnInvalid : IntegrityCheckLevel.None; @@ -898,7 +894,7 @@ namespace Ryujinx.Ava } } - private void HandleScreenState(KeyboardStateSnapshot keyboard, KeyboardStateSnapshot lastKeyboard) + private void HandleScreenState() { if (ConfigurationState.Instance.Hid.EnableMouse) { @@ -935,19 +931,12 @@ namespace Ryujinx.Ava { Dispatcher.UIThread.Post(() => { - KeyboardStateSnapshot keyboard = _keyboardInterface.GetKeyboardStateSnapshot(); + HandleScreenState(); - HandleScreenState(keyboard, _lastKeyboardSnapshot); - - if (keyboard.IsPressed(Key.Delete)) + if (_keyboardInterface.GetKeyboardStateSnapshot().IsPressed(Key.Delete) && _parent.WindowState != WindowState.FullScreen) { - if (_parent.WindowState != WindowState.FullScreen) - { - Ptc.Continue(); - } + Ptc.Continue(); } - - _lastKeyboardSnapshot = keyboard; }); } diff --git a/Ryujinx.Ava/Assets/Styles/BaseDark.xaml b/Ryujinx.Ava/Assets/Styles/BaseDark.xaml index b80cb11f..e32c3d08 100644 --- a/Ryujinx.Ava/Assets/Styles/BaseDark.xaml +++ b/Ryujinx.Ava/Assets/Styles/BaseDark.xaml @@ -1,9 +1,7 @@ - + - + @@ -27,8 +25,12 @@ Name="btnRem" HorizontalAlignment="Right" Content="Add" /> - + Test Check diff --git a/Ryujinx.Ava/Assets/Styles/BaseLight.xaml b/Ryujinx.Ava/Assets/Styles/BaseLight.xaml index c2739895..1d1e4fae 100644 --- a/Ryujinx.Ava/Assets/Styles/BaseLight.xaml +++ b/Ryujinx.Ava/Assets/Styles/BaseLight.xaml @@ -1,9 +1,7 @@ - + - + @@ -27,8 +25,12 @@ Name="btnRem" HorizontalAlignment="Right" Content="Add" /> - + Test Check diff --git a/Ryujinx.Ava/Assets/Styles/Styles.xaml b/Ryujinx.Ava/Assets/Styles/Styles.xaml index 422e6fa4..5ab0a861 100644 --- a/Ryujinx.Ava/Assets/Styles/Styles.xaml +++ b/Ryujinx.Ava/Assets/Styles/Styles.xaml @@ -1,10 +1,10 @@  + xmlns:sys="clr-namespace:System;assembly=netstandard" + xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"> - + @@ -22,15 +22,19 @@ - - - - - - - - - - - - - + - + @@ -136,27 +224,58 @@ - - - - - - - - + + + diff --git a/Ryujinx.Ava/Ui/Windows/MainWindow.axaml b/Ryujinx.Ava/Ui/Windows/MainWindow.axaml index 642f241c..532be219 100644 --- a/Ryujinx.Ava/Ui/Windows/MainWindow.axaml +++ b/Ryujinx.Ava/Ui/Windows/MainWindow.axaml @@ -1,25 +1,25 @@