- paired devices have notifications that they are configured and require connection - paired devices load the configuration when connected - A notification appears when changing control configuration settings. - Now control settings will be saved only when they are changed - Added a button to roll back changes to the previously saved state - Fixed a bug: when switching the "player", if the "input device" and "controller type" settings were changed, the save dialog box did not appear. - "Motion", "Rumble" and "Led" also have events notifying about changes
80 lines
2.4 KiB
C#
80 lines
2.4 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;
|
|
|
|
UserResult result = await ContentDialogHelper.CreateDeniableConfirmationDialog(
|
|
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)
|
|
{
|
|
if (e.AddedItems.Count > 0)
|
|
{
|
|
ViewModel.IsModified = true;
|
|
ViewModel.PlayerId = ((PlayerModel)e.AddedItems[0])!.Id;
|
|
}
|
|
return;
|
|
}
|
|
|
|
ViewModel.IsModified = false;
|
|
ViewModel.PlayerId = ViewModel.PlayerIdChoose;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
public void Dispose()
|
|
{
|
|
ViewModel.Dispose();
|
|
}
|
|
}
|
|
}
|