2022-07-05 11:06:31 -07:00
|
|
|
using Avalonia.Controls;
|
|
|
|
using FluentAvalonia.UI.Controls;
|
|
|
|
using Ryujinx.Ava.Common.Locale;
|
2022-12-29 06:24:05 -08:00
|
|
|
using Ryujinx.Ava.UI.Models;
|
|
|
|
using Ryujinx.Ava.UI.ViewModels;
|
2022-07-05 11:06:31 -07:00
|
|
|
using Ryujinx.Common.Configuration.Hid.Controller;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
2022-12-29 06:24:05 -08:00
|
|
|
namespace Ryujinx.Ava.UI.Windows
|
2022-07-05 11:06:31 -07:00
|
|
|
{
|
2022-07-24 10:38:38 -07:00
|
|
|
public partial class RumbleSettingsWindow : UserControl
|
2022-07-05 11:06:31 -07:00
|
|
|
{
|
|
|
|
private readonly InputConfiguration<GamepadInputId, StickInputId> _viewmodel;
|
|
|
|
|
|
|
|
public RumbleSettingsWindow()
|
|
|
|
{
|
|
|
|
InitializeComponent();
|
2022-07-24 10:38:38 -07:00
|
|
|
DataContext = _viewmodel;
|
2022-07-05 11:06:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public RumbleSettingsWindow(ControllerSettingsViewModel viewmodel)
|
|
|
|
{
|
|
|
|
var config = viewmodel.Configuration as InputConfiguration<GamepadInputId, StickInputId>;
|
|
|
|
|
|
|
|
_viewmodel = new InputConfiguration<GamepadInputId, StickInputId>()
|
|
|
|
{
|
2022-07-24 10:38:38 -07:00
|
|
|
StrongRumble = config.StrongRumble, WeakRumble = config.WeakRumble
|
2022-07-05 11:06:31 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
DataContext = _viewmodel;
|
|
|
|
}
|
|
|
|
|
2022-07-24 10:38:38 -07:00
|
|
|
public static async Task Show(ControllerSettingsViewModel viewmodel)
|
2022-07-05 11:06:31 -07:00
|
|
|
{
|
|
|
|
RumbleSettingsWindow content = new RumbleSettingsWindow(viewmodel);
|
|
|
|
|
2022-07-24 10:38:38 -07:00
|
|
|
ContentDialog contentDialog = new ContentDialog
|
2022-07-05 11:06:31 -07:00
|
|
|
{
|
2022-07-24 10:38:38 -07:00
|
|
|
Title = LocaleManager.Instance["ControllerRumbleTitle"],
|
|
|
|
PrimaryButtonText = LocaleManager.Instance["ControllerSettingsSave"],
|
|
|
|
SecondaryButtonText = "",
|
|
|
|
CloseButtonText = LocaleManager.Instance["ControllerSettingsClose"],
|
|
|
|
Content = content,
|
|
|
|
};
|
|
|
|
|
|
|
|
contentDialog.PrimaryButtonClick += (sender, args) =>
|
|
|
|
{
|
|
|
|
var config = viewmodel.Configuration as InputConfiguration<GamepadInputId, StickInputId>;
|
|
|
|
config.StrongRumble = content._viewmodel.StrongRumble;
|
|
|
|
config.WeakRumble = content._viewmodel.WeakRumble;
|
|
|
|
};
|
|
|
|
|
|
|
|
await contentDialog.ShowAsync();
|
2022-07-05 11:06:31 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|