Remove InputViewModel.IsModified
Format
This commit is contained in:
parent
9167833f0a
commit
1ad9b27ed6
5 changed files with 18 additions and 13 deletions
|
@ -82,9 +82,10 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||
public bool EnableKeyboard { get; set; }
|
||||
public bool EnableMouse { get; set; }
|
||||
|
||||
public bool IsModified { get; set; }
|
||||
public event Action NotifyChangesEvent;
|
||||
|
||||
public SettingsViewModel SettingsViewModel;
|
||||
|
||||
public object ConfigViewModel
|
||||
{
|
||||
get => _configViewModel;
|
||||
|
@ -101,12 +102,12 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||
get => _playerId;
|
||||
set
|
||||
{
|
||||
if (IsModified)
|
||||
if (SettingsViewModel.IsModified)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IsModified = false;
|
||||
SettingsViewModel.IsModified = false;
|
||||
_playerId = value;
|
||||
|
||||
if (!Enum.IsDefined(typeof(PlayerIndex), _playerId))
|
||||
|
@ -243,8 +244,10 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||
|
||||
public InputConfig Config { get; set; }
|
||||
|
||||
public InputViewModel(UserControl owner) : this()
|
||||
public InputViewModel(UserControl owner, SettingsViewModel settingsViewModel) : this()
|
||||
{
|
||||
SettingsViewModel = settingsViewModel;
|
||||
|
||||
if (Program.PreviewerDetached)
|
||||
{
|
||||
_mainWindow =
|
||||
|
@ -819,8 +822,6 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||
|
||||
public void Save()
|
||||
{
|
||||
IsModified = false;
|
||||
|
||||
List<InputConfig> newConfig = new();
|
||||
|
||||
newConfig.AddRange(ConfigurationState.Instance.Hid.InputConfig.Value);
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace Ryujinx.Ava.UI.Views.Input
|
|||
if (e.ButtonValue.HasValue)
|
||||
{
|
||||
var buttonValue = e.ButtonValue.Value;
|
||||
viewModel.ParentModel.IsModified = true;
|
||||
viewModel.ParentModel.SettingsViewModel.IsModified = true;
|
||||
|
||||
switch (button.Name)
|
||||
{
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace Ryujinx.Ava.UI.Views.Input
|
|||
if (e.ButtonValue.HasValue)
|
||||
{
|
||||
var buttonValue = e.ButtonValue.Value;
|
||||
viewModel.ParentModel.IsModified = true;
|
||||
viewModel.ParentModel.SettingsViewModel.IsModified = true;
|
||||
|
||||
switch (button.Name)
|
||||
{
|
||||
|
|
|
@ -4,7 +4,6 @@ using Ryujinx.Ava.UI.Helpers;
|
|||
using Ryujinx.Ava.UI.Models;
|
||||
using Ryujinx.Ava.UI.ViewModels;
|
||||
using Ryujinx.Ava.UI.ViewModels.Input;
|
||||
using Ryujinx.Ava.UI.Views.Input;
|
||||
|
||||
namespace Ryujinx.Ava.UI.Views.Settings
|
||||
{
|
||||
|
@ -19,7 +18,7 @@ namespace Ryujinx.Ava.UI.Views.Settings
|
|||
{
|
||||
SettingsViewModel = viewModel;
|
||||
|
||||
DataContext = ViewModel = new InputViewModel(this);
|
||||
DataContext = ViewModel = new InputViewModel(this, viewModel);
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
@ -31,7 +30,7 @@ namespace Ryujinx.Ava.UI.Views.Settings
|
|||
|
||||
private async void PlayerIndexBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (ViewModel.IsModified && !_dialogOpen)
|
||||
if (SettingsViewModel.IsModified && !_dialogOpen)
|
||||
{
|
||||
_dialogOpen = true;
|
||||
|
||||
|
@ -49,7 +48,7 @@ namespace Ryujinx.Ava.UI.Views.Settings
|
|||
|
||||
_dialogOpen = false;
|
||||
|
||||
ViewModel.IsModified = false;
|
||||
SettingsViewModel.IsModified = false;
|
||||
|
||||
if (e.AddedItems.Count > 0)
|
||||
{
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
public readonly SettingsGraphicsView GraphicsPage;
|
||||
public readonly SettingsAudioView AudioPage;
|
||||
public readonly SettingsNetworkView NetworkPage;
|
||||
public readonly SettingsLoggingView LoggingPage;
|
||||
public readonly SettingsLoggingView LoggingPage;
|
||||
|
||||
public SettingsWindow(VirtualFileSystem virtualFileSystem, ContentManager contentManager)
|
||||
{
|
||||
|
@ -60,6 +60,11 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
|
||||
public void UpdateDirtyTitle(bool isDirty)
|
||||
{
|
||||
if (!IsInitialized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (isDirty)
|
||||
{
|
||||
Title = $"{LocaleManager.Instance[LocaleKeys.Settings]} - {LocaleManager.Instance[LocaleKeys.SettingsDirty]}";
|
||||
|
|
Loading…
Reference in a new issue