This commit is contained in:
Isaac Marovitz 2023-05-18 14:36:01 -04:00 committed by Isaac Marovitz
parent d224996c15
commit d738da55a7
3 changed files with 26 additions and 6 deletions

View file

@ -50,6 +50,8 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
} }
} }
public InputViewModel parentModel;
public async void ShowMotionConfig() public async void ShowMotionConfig()
{ {
await MotionInputView.Show(this); await MotionInputView.Show(this);
@ -62,10 +64,17 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
public ControllerInputViewModel(InputViewModel model, ControllerInputConfig config) public ControllerInputViewModel(InputViewModel model, ControllerInputConfig config)
{ {
IsLeft = model.IsLeft; parentModel = model;
IsRight = model.IsRight; model.NotifyChangesEvent += UpdateParentModelValues;
Image = model.Image; UpdateParentModelValues();
Config = config; Config = config;
} }
public void UpdateParentModelValues()
{
IsLeft = parentModel.IsLeft;
IsRight = parentModel.IsRight;
Image = parentModel.Image;
}
} }
} }

View file

@ -71,6 +71,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
public bool IsLeft { get; set; } public bool IsLeft { get; set; }
public bool IsModified { get; set; } public bool IsModified { get; set; }
public event Action NotifyChangesEvent;
public object ConfigViewModel public object ConfigViewModel
{ {
@ -873,6 +874,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
OnPropertyChanged(nameof(IsKeyboard)); OnPropertyChanged(nameof(IsKeyboard));
OnPropertyChanged(nameof(IsRight)); OnPropertyChanged(nameof(IsRight));
OnPropertyChanged(nameof(IsLeft)); OnPropertyChanged(nameof(IsLeft));
NotifyChangesEvent?.Invoke();
} }
public void Dispose() public void Dispose()

View file

@ -49,12 +49,21 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
} }
} }
public InputViewModel parentModel;
public KeyboardInputViewModel(InputViewModel model, KeyboardInputConfig config) public KeyboardInputViewModel(InputViewModel model, KeyboardInputConfig config)
{ {
IsLeft = model.IsLeft; parentModel = model;
IsRight = model.IsRight; model.NotifyChangesEvent += UpdateParentModelValues;
Image = model.Image; UpdateParentModelValues();
Config = config; Config = config;
} }
public void UpdateParentModelValues()
{
IsLeft = parentModel.IsLeft;
IsRight = parentModel.IsRight;
Image = parentModel.Image;
}
} }
} }