mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2025-08-30 07:25:05 +00:00
* misc: Move Ryujinx project to Ryujinx.Gtk3 This breaks release CI for now but that's fine. Signed-off-by: Mary Guillemard <mary@mary.zone> * misc: Move Ryujinx.Ava project to Ryujinx This breaks CI for now, but it's fine. Signed-off-by: Mary Guillemard <mary@mary.zone> * infra: Make Avalonia the default UI Should fix CI after the previous changes. GTK3 isn't build by the release job anymore, only by PR CI. This also ensure that the test-ava update package is still generated to allow update from the old testing channel. Signed-off-by: Mary Guillemard <mary@mary.zone> * Fix missing copy in create_app_bundle.sh Signed-off-by: Mary Guillemard <mary@mary.zone> * Fix syntax error Signed-off-by: Mary Guillemard <mary@mary.zone> --------- Signed-off-by: Mary Guillemard <mary@mary.zone>
65 lines
1.9 KiB
C#
65 lines
1.9 KiB
C#
using Avalonia.Controls;
|
|
using Avalonia.Interactivity;
|
|
using Avalonia.Platform.Storage;
|
|
using Avalonia.VisualTree;
|
|
using Ryujinx.Ava.Common.Locale;
|
|
using Ryujinx.Ava.UI.ViewModels;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
|
|
namespace Ryujinx.Ava.UI.Views.Settings
|
|
{
|
|
public partial class SettingsUiView : UserControl
|
|
{
|
|
public SettingsViewModel ViewModel;
|
|
|
|
public SettingsUiView()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private async void AddButton_OnClick(object sender, RoutedEventArgs e)
|
|
{
|
|
string path = PathBox.Text;
|
|
|
|
if (!string.IsNullOrWhiteSpace(path) && Directory.Exists(path) && !ViewModel.GameDirectories.Contains(path))
|
|
{
|
|
ViewModel.GameDirectories.Add(path);
|
|
ViewModel.DirectoryChanged = true;
|
|
}
|
|
else
|
|
{
|
|
if (this.GetVisualRoot() is Window window)
|
|
{
|
|
var result = await window.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
|
|
{
|
|
AllowMultiple = false,
|
|
});
|
|
|
|
if (result.Count > 0)
|
|
{
|
|
ViewModel.GameDirectories.Add(result[0].Path.LocalPath);
|
|
ViewModel.DirectoryChanged = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void RemoveButton_OnClick(object sender, RoutedEventArgs e)
|
|
{
|
|
int oldIndex = GameList.SelectedIndex;
|
|
|
|
foreach (string path in new List<string>(GameList.SelectedItems.Cast<string>()))
|
|
{
|
|
ViewModel.GameDirectories.Remove(path);
|
|
ViewModel.DirectoryChanged = true;
|
|
}
|
|
|
|
if (GameList.ItemCount > 0)
|
|
{
|
|
GameList.SelectedIndex = oldIndex < GameList.ItemCount ? oldIndex : 0;
|
|
}
|
|
}
|
|
}
|
|
}
|