Ryujinx/Ryujinx.Ava/UI/Windows/DownloadableContentManagerWindow.axaml.cs

75 lines
2.4 KiB
C#
Raw Normal View History

using Avalonia.Controls;
2023-01-15 21:17:50 +00:00
using Avalonia.Interactivity;
2023-01-15 20:49:09 +00:00
using Avalonia.Styling;
using FluentAvalonia.UI.Controls;
using Ryujinx.Ava.Common.Locale;
Ava GUI: Restructure `Ryujinx.Ava` (#4165) * Restructure `Ryujinx.Ava` * Stylistic consistency * Update Ryujinx.Ava/UI/Controls/UserEditor.axaml.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Controls/UserEditor.axaml.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Controls/UserSelector.axaml.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Controls/SaveManager.axaml.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Controls/SaveManager.axaml.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Windows/SettingsWindow.axaml.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Helpers/EmbeddedWindow.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Helpers/EmbeddedWindow.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Helpers/EmbeddedWindow.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Helpers/EmbeddedWindow.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Windows/SettingsWindow.axaml.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/ViewModels/UserProfileViewModel.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/ViewModels/UserProfileViewModel.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Helpers/EmbeddedWindow.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Fix redundancies * Remove redunancies * Add back elses Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com>
2022-12-29 14:24:05 +00:00
using Ryujinx.Ava.UI.Helpers;
2023-01-15 20:49:09 +00:00
using Ryujinx.Ava.UI.ViewModels;
using Ryujinx.HLE.FileSystem;
using System.Threading.Tasks;
Ava GUI: Restructure `Ryujinx.Ava` (#4165) * Restructure `Ryujinx.Ava` * Stylistic consistency * Update Ryujinx.Ava/UI/Controls/UserEditor.axaml.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Controls/UserEditor.axaml.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Controls/UserSelector.axaml.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Controls/SaveManager.axaml.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Controls/SaveManager.axaml.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Windows/SettingsWindow.axaml.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Helpers/EmbeddedWindow.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Helpers/EmbeddedWindow.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Helpers/EmbeddedWindow.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Helpers/EmbeddedWindow.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Windows/SettingsWindow.axaml.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/ViewModels/UserProfileViewModel.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/ViewModels/UserProfileViewModel.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Helpers/EmbeddedWindow.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Fix redundancies * Remove redunancies * Add back elses Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com>
2022-12-29 14:24:05 +00:00
namespace Ryujinx.Ava.UI.Windows
{
2023-01-15 20:49:09 +00:00
public partial class DownloadableContentManagerWindow : UserControl
{
2023-01-15 20:49:09 +00:00
public DownloadableContentManagerViewModel ViewModel;
public DownloadableContentManagerWindow()
{
DataContext = this;
InitializeComponent();
}
public DownloadableContentManagerWindow(VirtualFileSystem virtualFileSystem, ulong titleId, string titleName)
{
2023-01-15 20:49:09 +00:00
DataContext = ViewModel = new DownloadableContentManagerViewModel(virtualFileSystem, titleId, titleName);
InitializeComponent();
RemoveButton.IsEnabled = false;
2023-01-15 21:17:50 +00:00
// DlcDataGrid.SelectionChanged += DlcDataGrid_SelectionChanged;
}
2023-01-15 20:49:09 +00:00
public static async Task Show(VirtualFileSystem virtualFileSystem, ulong titleId, string titleName)
{
2023-01-15 20:49:09 +00:00
ContentDialog contentDialog = new()
{
2023-01-15 20:49:09 +00:00
PrimaryButtonText = "",
SecondaryButtonText = "",
CloseButtonText = "",
2023-01-15 21:17:50 +00:00
Content = new DownloadableContentManagerWindow(virtualFileSystem, titleId, titleName),
2023-01-15 20:49:09 +00:00
Title = string.Format(LocaleManager.Instance[LocaleKeys.DlcWindowTitle], titleName, titleId.ToString("X16"))
};
2023-01-15 20:49:09 +00:00
Style bottomBorder = new(x => x.OfType<Grid>().Name("DialogSpace").Child().OfType<Border>());
bottomBorder.Setters.Add(new Setter(IsVisibleProperty, false));
2023-01-15 20:49:09 +00:00
contentDialog.Styles.Add(bottomBorder);
2023-01-15 20:49:09 +00:00
await ContentDialogHelper.ShowAsync(contentDialog);
}
2023-01-15 20:49:09 +00:00
private void DlcDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
2023-01-15 21:17:50 +00:00
// RemoveButton.IsEnabled = (DlcDataGrid.SelectedItems.Count > 0);
}
public void SaveAndClose()
{
2023-01-15 20:49:09 +00:00
ViewModel.Save();
((ContentDialog)Parent).Hide();
}
2023-01-15 21:17:50 +00:00
private void RemoveDLC(object sender, RoutedEventArgs e)
{
throw new System.NotImplementedException();
}
private void OpenLocation(object sender, RoutedEventArgs e)
{
throw new System.NotImplementedException();
}
}
}