From 486a352de2cfbeb9c74acbdf8f95f27306921b3f Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Tue, 16 Jul 2024 12:18:20 +0100 Subject: [PATCH] Move dialogues --- .../UI/ViewModels/SettingsViewModel.cs | 11 -------- src/Ryujinx/UI/Views/Input/InputView.axaml.cs | 3 ++- .../Views/Settings/SettingsGraphicsView.axaml | 1 + .../Settings/SettingsGraphicsView.axaml.cs | 26 +++++++++++++++++++ 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs index 70e5fa5c7..c2d23b03b 100644 --- a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs @@ -74,17 +74,6 @@ namespace Ryujinx.Ava.UI.ViewModels { _graphicsBackendMultithreadingIndex = value; - if (_graphicsBackendMultithreadingIndex != (int)ConfigurationState.Instance.Graphics.BackendThreading.Value) - { - Dispatcher.UIThread.InvokeAsync(() => - ContentDialogHelper.CreateInfoDialog(LocaleManager.Instance[LocaleKeys.DialogSettingsBackendThreadingWarningMessage], - "", - "", - LocaleManager.Instance[LocaleKeys.InputDialogOk], - LocaleManager.Instance[LocaleKeys.DialogSettingsBackendThreadingWarningTitle]) - ); - } - OnPropertyChanged(); } } diff --git a/src/Ryujinx/UI/Views/Input/InputView.axaml.cs b/src/Ryujinx/UI/Views/Input/InputView.axaml.cs index 356381a8a..dd5f436ca 100644 --- a/src/Ryujinx/UI/Views/Input/InputView.axaml.cs +++ b/src/Ryujinx/UI/Views/Input/InputView.axaml.cs @@ -34,7 +34,8 @@ namespace Ryujinx.Ava.UI.Views.Input LocaleManager.Instance[LocaleKeys.DialogControllerSettingsModifiedConfirmSubMessage], LocaleManager.Instance[LocaleKeys.InputDialogYes], LocaleManager.Instance[LocaleKeys.InputDialogNo], - LocaleManager.Instance[LocaleKeys.RyujinxConfirm]); + LocaleManager.Instance[LocaleKeys.RyujinxConfirm], + parent: (Window)this.VisualRoot); if (result == UserResult.Yes) { diff --git a/src/Ryujinx/UI/Views/Settings/SettingsGraphicsView.axaml b/src/Ryujinx/UI/Views/Settings/SettingsGraphicsView.axaml index 5cffc6848..8c9fd8823 100644 --- a/src/Ryujinx/UI/Views/Settings/SettingsGraphicsView.axaml +++ b/src/Ryujinx/UI/Views/Settings/SettingsGraphicsView.axaml @@ -265,6 +265,7 @@ diff --git a/src/Ryujinx/UI/Views/Settings/SettingsGraphicsView.axaml.cs b/src/Ryujinx/UI/Views/Settings/SettingsGraphicsView.axaml.cs index 673413309..514a40c58 100644 --- a/src/Ryujinx/UI/Views/Settings/SettingsGraphicsView.axaml.cs +++ b/src/Ryujinx/UI/Views/Settings/SettingsGraphicsView.axaml.cs @@ -1,4 +1,10 @@ using Avalonia.Controls; +using Avalonia.Threading; +using Ryujinx.Ava.Common.Locale; +using Ryujinx.Ava.UI.Helpers; +using Ryujinx.Common.Logging; +using Ryujinx.UI.Common.Configuration; +using Logger = Ryujinx.Common.Logging.Logger; namespace Ryujinx.Ava.UI.Views.Settings { @@ -8,5 +14,25 @@ namespace Ryujinx.Ava.UI.Views.Settings { InitializeComponent(); } + + private void GraphicsBackendMultithreadingIndex_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (e.Source is not ComboBox comboBox) + { + return; + } + + if (comboBox.SelectedIndex != (int)ConfigurationState.Instance.Graphics.BackendThreading.Value && comboBox.SelectedIndex >= 0) + { + Dispatcher.UIThread.InvokeAsync(() => + ContentDialogHelper.CreateInfoDialog(LocaleManager.Instance[LocaleKeys.DialogSettingsBackendThreadingWarningMessage], + "", + "", + LocaleManager.Instance[LocaleKeys.InputDialogOk], + LocaleManager.Instance[LocaleKeys.DialogSettingsBackendThreadingWarningTitle], + parent: this.VisualRoot as Window) + ); + } + } } }