Replace the "delete" button with "apply" during the game in the custom configuration.

This commit is contained in:
Vova 2025-02-10 21:02:26 +10:00
parent 1d68546aa0
commit 0399af0ff9
3 changed files with 19 additions and 40 deletions

View File

@ -74,42 +74,12 @@ namespace Ryujinx.Ava.UI.ViewModels
private Bitmap _gameIcon; private Bitmap _gameIcon;
private string _gameTitle; private string _gameTitle;
private string _gameId; private string _gameId;
public Bitmap GameIcon private readonly bool _isGameRunning;
{
get => _gameIcon;
set
{
if (_gameIcon != value)
{
_gameIcon = value;
}
}
}
public string GameTitle
{
get => _gameTitle;
set
{
if (_gameTitle != value)
{
_gameTitle = value;
}
}
}
public string GameId
{
get => _gameId;
set
{
if (_gameId != value)
{
_gameId = value;
}
}
}
public bool IsGameRunning => _isGameRunning;
public Bitmap GameIcon => _gameIcon;
public string GameTitle => _gameTitle;
public string GameId => _gameId;
public int ResolutionScale public int ResolutionScale
{ {
@ -385,8 +355,10 @@ namespace Ryujinx.Ava.UI.ViewModels
} }
} }
public SettingsViewModel(VirtualFileSystem virtualFileSystem, public SettingsViewModel(
VirtualFileSystem virtualFileSystem,
ContentManager contentManager, ContentManager contentManager,
bool gameRunning,
string gamePath, string gamePath,
string gameName, string gameName,
string gameId, string gameId,
@ -400,12 +372,13 @@ namespace Ryujinx.Ava.UI.ViewModels
{ {
using (var ms = new MemoryStream(gameIconData)) using (var ms = new MemoryStream(gameIconData))
{ {
GameIcon = new Bitmap(ms); _gameIcon = new Bitmap(ms);
} }
} }
GameTitle = gameName; _isGameRunning = gameRunning;
GameId = gameId; _gameTitle = gameName;
_gameId = gameId;
if (enableToLoadCustomConfig) // During the game. If there is no user config, then load the global config window if (enableToLoadCustomConfig) // During the game. If there is no user config, then load the global config window
{ {

View File

@ -136,6 +136,11 @@
Content="{ext:Locale SettingsButtonClose}" Content="{ext:Locale SettingsButtonClose}"
Command="{Binding CancelButton}" /> Command="{Binding CancelButton}" />
<Button <Button
IsVisible="{Binding IsGameRunning}"
Content="{ext:Locale SettingsButtonApply}"
Command="{Binding ApplyButton}" />
<Button
IsVisible="{Binding !IsGameRunning}"
Content="{ext:Locale UserProfilesDelete}" Content="{ext:Locale UserProfilesDelete}"
Command="{Binding DeleteConfigGame}" Command="{Binding DeleteConfigGame}"
Classes="red"/> Classes="red"/>

View File

@ -35,6 +35,7 @@ namespace Ryujinx.Ava.UI.Windows
DataContext = ViewModel = new SettingsViewModel( DataContext = ViewModel = new SettingsViewModel(
viewModel.VirtualFileSystem, viewModel.VirtualFileSystem,
viewModel.ContentManager, viewModel.ContentManager,
viewModel.IsGameRunning,
viewModel.SelectedApplication.Path, viewModel.SelectedApplication.Path,
viewModel.SelectedApplication.Name, viewModel.SelectedApplication.Name,
viewModel.SelectedApplication.IdString, viewModel.SelectedApplication.IdString,