mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-02-25 10:11:08 +00:00
When switching between players' gamepads while saving settings, then returning to the previous player, the settings show the default settings instead of the actual settings applied
88 lines
2.5 KiB
C#
88 lines
2.5 KiB
C#
using Avalonia.Controls;
|
|
using Ryujinx.Ava.Common.Locale;
|
|
using Ryujinx.Ava.UI.Helpers;
|
|
using Ryujinx.Ava.UI.Models;
|
|
using Ryujinx.Ava.UI.ViewModels.Input;
|
|
|
|
namespace Ryujinx.Ava.UI.Views.Input
|
|
{
|
|
public partial class InputView : UserControl
|
|
{
|
|
private bool _dialogOpen;
|
|
private InputViewModel ViewModel { get; set; }
|
|
|
|
public InputView()
|
|
{
|
|
DataContext = ViewModel = new InputViewModel(this);
|
|
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SaveCurrentProfile()
|
|
{
|
|
ViewModel.Save();
|
|
}
|
|
|
|
private async void PlayerIndexBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
{
|
|
if (PlayerIndexBox != null)
|
|
{
|
|
if (PlayerIndexBox.SelectedIndex != (int)ViewModel.PlayerId)
|
|
{
|
|
PlayerIndexBox.SelectedIndex = (int)ViewModel.PlayerId;
|
|
}
|
|
}
|
|
|
|
if (ViewModel.IsModified && !_dialogOpen)
|
|
{
|
|
_dialogOpen = true;
|
|
|
|
var result = await ContentDialogHelper.CreateConfirmationDialogExtended(
|
|
LocaleManager.Instance[LocaleKeys.DialogControllerSettingsModifiedConfirmMessage],
|
|
LocaleManager.Instance[LocaleKeys.DialogControllerSettingsModifiedConfirmSubMessage],
|
|
LocaleManager.Instance[LocaleKeys.InputDialogYes],
|
|
LocaleManager.Instance[LocaleKeys.InputDialogNo],
|
|
LocaleManager.Instance[LocaleKeys.Cancel],
|
|
LocaleManager.Instance[LocaleKeys.RyujinxConfirm]);
|
|
|
|
|
|
if (result == UserResult.Yes)
|
|
{
|
|
ViewModel.Save();
|
|
}
|
|
|
|
_dialogOpen = false;
|
|
|
|
if (result == UserResult.Cancel)
|
|
{
|
|
|
|
return;
|
|
}
|
|
|
|
ViewModel.IsModified = false;
|
|
|
|
if (result != UserResult.Cancel)
|
|
{
|
|
ViewModel.PlayerId = ViewModel.PlayerIdChoose;
|
|
}
|
|
|
|
if (result == UserResult.Cancel)
|
|
{
|
|
if (e.AddedItems.Count > 0)
|
|
{
|
|
ViewModel.IsModified = true;
|
|
var player = (PlayerModel)e.AddedItems[0];
|
|
ViewModel.PlayerId = player.Id;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
ViewModel.Dispose();
|
|
}
|
|
}
|
|
}
|