mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-06-28 11:06:24 +02:00
misc: Created generic type RyujinxControl to allow for more unified control view model definitions
This commit is contained in:
parent
69d79322bb
commit
da3f4e1d3a
25 changed files with 136 additions and 155 deletions
|
@ -1,16 +1,15 @@
|
|||
using Avalonia.Controls;
|
||||
using FluentAvalonia.UI.Controls;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
using Ryujinx.Ava.UI.Controls;
|
||||
using Ryujinx.Ava.UI.Models.Input;
|
||||
using Ryujinx.Ava.UI.ViewModels.Input;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ryujinx.Ava.UI.Views.Input
|
||||
{
|
||||
public partial class MotionInputView : UserControl
|
||||
public partial class MotionInputView : RyujinxControl<MotionInputViewModel>
|
||||
{
|
||||
private readonly MotionInputViewModel _viewModel;
|
||||
|
||||
public MotionInputView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
@ -20,7 +19,7 @@ namespace Ryujinx.Ava.UI.Views.Input
|
|||
{
|
||||
GamepadInputConfig config = viewModel.Config;
|
||||
|
||||
_viewModel = new MotionInputViewModel
|
||||
ViewModel = new MotionInputViewModel
|
||||
{
|
||||
Slot = config.Slot,
|
||||
AltSlot = config.AltSlot,
|
||||
|
@ -33,7 +32,6 @@ namespace Ryujinx.Ava.UI.Views.Input
|
|||
};
|
||||
|
||||
InitializeComponent();
|
||||
DataContext = _viewModel;
|
||||
}
|
||||
|
||||
public static async Task Show(ControllerInputViewModel viewModel)
|
||||
|
@ -48,17 +46,17 @@ namespace Ryujinx.Ava.UI.Views.Input
|
|||
CloseButtonText = LocaleManager.Instance[LocaleKeys.ControllerSettingsClose],
|
||||
Content = content,
|
||||
};
|
||||
contentDialog.PrimaryButtonClick += (sender, args) =>
|
||||
contentDialog.PrimaryButtonClick += (_, _) =>
|
||||
{
|
||||
GamepadInputConfig config = viewModel.Config;
|
||||
config.Slot = content._viewModel.Slot;
|
||||
config.Sensitivity = content._viewModel.Sensitivity;
|
||||
config.GyroDeadzone = content._viewModel.GyroDeadzone;
|
||||
config.AltSlot = content._viewModel.AltSlot;
|
||||
config.DsuServerHost = content._viewModel.DsuServerHost;
|
||||
config.DsuServerPort = content._viewModel.DsuServerPort;
|
||||
config.EnableCemuHookMotion = content._viewModel.EnableCemuHookMotion;
|
||||
config.MirrorInput = content._viewModel.MirrorInput;
|
||||
config.Slot = content.ViewModel.Slot;
|
||||
config.Sensitivity = content.ViewModel.Sensitivity;
|
||||
config.GyroDeadzone = content.ViewModel.GyroDeadzone;
|
||||
config.AltSlot = content.ViewModel.AltSlot;
|
||||
config.DsuServerHost = content.ViewModel.DsuServerHost;
|
||||
config.DsuServerPort = content.ViewModel.DsuServerPort;
|
||||
config.EnableCemuHookMotion = content.ViewModel.EnableCemuHookMotion;
|
||||
config.MirrorInput = content.ViewModel.MirrorInput;
|
||||
};
|
||||
|
||||
await contentDialog.ShowAsync();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue