From cee712105850ac3385cd0091a923438167433f9f Mon Sep 17 00:00:00 2001 From: TSR Berry <20988865+TSRBerry@users.noreply.github.com> Date: Sat, 8 Apr 2023 01:22:00 +0200 Subject: Move solution and projects to src --- Ryujinx.Ava/UI/Controls/GameGridView.axaml | 177 ---------------- Ryujinx.Ava/UI/Controls/GameGridView.axaml.cs | 57 ----- Ryujinx.Ava/UI/Controls/GameListView.axaml | 233 --------------------- Ryujinx.Ava/UI/Controls/GameListView.axaml.cs | 57 ----- Ryujinx.Ava/UI/Controls/NavigationDialogHost.axaml | 17 -- .../UI/Controls/NavigationDialogHost.axaml.cs | 218 ------------------- Ryujinx.Ava/UI/Controls/UpdateWaitWindow.axaml | 42 ---- Ryujinx.Ava/UI/Controls/UpdateWaitWindow.axaml.cs | 31 --- 8 files changed, 832 deletions(-) delete mode 100644 Ryujinx.Ava/UI/Controls/GameGridView.axaml delete mode 100644 Ryujinx.Ava/UI/Controls/GameGridView.axaml.cs delete mode 100644 Ryujinx.Ava/UI/Controls/GameListView.axaml delete mode 100644 Ryujinx.Ava/UI/Controls/GameListView.axaml.cs delete mode 100644 Ryujinx.Ava/UI/Controls/NavigationDialogHost.axaml delete mode 100644 Ryujinx.Ava/UI/Controls/NavigationDialogHost.axaml.cs delete mode 100644 Ryujinx.Ava/UI/Controls/UpdateWaitWindow.axaml delete mode 100644 Ryujinx.Ava/UI/Controls/UpdateWaitWindow.axaml.cs (limited to 'Ryujinx.Ava/UI/Controls') diff --git a/Ryujinx.Ava/UI/Controls/GameGridView.axaml b/Ryujinx.Ava/UI/Controls/GameGridView.axaml deleted file mode 100644 index 32cabfaa..00000000 --- a/Ryujinx.Ava/UI/Controls/GameGridView.axaml +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Ryujinx.Ava/UI/Controls/GameGridView.axaml.cs b/Ryujinx.Ava/UI/Controls/GameGridView.axaml.cs deleted file mode 100644 index aa76b7c9..00000000 --- a/Ryujinx.Ava/UI/Controls/GameGridView.axaml.cs +++ /dev/null @@ -1,57 +0,0 @@ -using Avalonia.Controls; -using Avalonia.Input; -using Avalonia.Interactivity; -using Avalonia.Markup.Xaml; -using Ryujinx.Ava.UI.Helpers; -using Ryujinx.Ava.UI.ViewModels; -using Ryujinx.Ui.App.Common; -using System; - -namespace Ryujinx.Ava.UI.Controls -{ - public partial class GameGridView : UserControl - { - public static readonly RoutedEvent ApplicationOpenedEvent = - RoutedEvent.Register(nameof(ApplicationOpened), RoutingStrategies.Bubble); - - public event EventHandler ApplicationOpened - { - add { AddHandler(ApplicationOpenedEvent, value); } - remove { RemoveHandler(ApplicationOpenedEvent, value); } - } - - public GameGridView() - { - InitializeComponent(); - } - - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } - - public void GameList_DoubleTapped(object sender, RoutedEventArgs args) - { - if (sender is ListBox listBox) - { - if (listBox.SelectedItem is ApplicationData selected) - { - RaiseEvent(new ApplicationOpenedEventArgs(selected, ApplicationOpenedEvent)); - } - } - } - - public void GameList_SelectionChanged(object sender, SelectionChangedEventArgs args) - { - if (sender is ListBox listBox) - { - (DataContext as MainWindowViewModel).GridSelectedApplication = listBox.SelectedItem as ApplicationData; - } - } - - private void SearchBox_OnKeyUp(object sender, KeyEventArgs e) - { - (DataContext as MainWindowViewModel).SearchText = (sender as TextBox).Text; - } - } -} diff --git a/Ryujinx.Ava/UI/Controls/GameListView.axaml b/Ryujinx.Ava/UI/Controls/GameListView.axaml deleted file mode 100644 index c13eaae8..00000000 --- a/Ryujinx.Ava/UI/Controls/GameListView.axaml +++ /dev/null @@ -1,233 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Ryujinx.Ava/UI/Controls/GameListView.axaml.cs b/Ryujinx.Ava/UI/Controls/GameListView.axaml.cs deleted file mode 100644 index a6449709..00000000 --- a/Ryujinx.Ava/UI/Controls/GameListView.axaml.cs +++ /dev/null @@ -1,57 +0,0 @@ -using Avalonia.Controls; -using Avalonia.Input; -using Avalonia.Interactivity; -using Avalonia.Markup.Xaml; -using Ryujinx.Ava.UI.Helpers; -using Ryujinx.Ava.UI.ViewModels; -using Ryujinx.Ui.App.Common; -using System; - -namespace Ryujinx.Ava.UI.Controls -{ - public partial class GameListView : UserControl - { - public static readonly RoutedEvent ApplicationOpenedEvent = - RoutedEvent.Register(nameof(ApplicationOpened), RoutingStrategies.Bubble); - - public event EventHandler ApplicationOpened - { - add { AddHandler(ApplicationOpenedEvent, value); } - remove { RemoveHandler(ApplicationOpenedEvent, value); } - } - - public GameListView() - { - InitializeComponent(); - } - - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } - - public void GameList_DoubleTapped(object sender, RoutedEventArgs args) - { - if (sender is ListBox listBox) - { - if (listBox.SelectedItem is ApplicationData selected) - { - RaiseEvent(new ApplicationOpenedEventArgs(selected, ApplicationOpenedEvent)); - } - } - } - - public void GameList_SelectionChanged(object sender, SelectionChangedEventArgs args) - { - if (sender is ListBox listBox) - { - (DataContext as MainWindowViewModel).ListSelectedApplication = listBox.SelectedItem as ApplicationData; - } - } - - private void SearchBox_OnKeyUp(object sender, KeyEventArgs e) - { - (DataContext as MainWindowViewModel).SearchText = (sender as TextBox).Text; - } - } -} diff --git a/Ryujinx.Ava/UI/Controls/NavigationDialogHost.axaml b/Ryujinx.Ava/UI/Controls/NavigationDialogHost.axaml deleted file mode 100644 index bf34b303..00000000 --- a/Ryujinx.Ava/UI/Controls/NavigationDialogHost.axaml +++ /dev/null @@ -1,17 +0,0 @@ - - - - \ No newline at end of file diff --git a/Ryujinx.Ava/UI/Controls/NavigationDialogHost.axaml.cs b/Ryujinx.Ava/UI/Controls/NavigationDialogHost.axaml.cs deleted file mode 100644 index 1b857fae..00000000 --- a/Ryujinx.Ava/UI/Controls/NavigationDialogHost.axaml.cs +++ /dev/null @@ -1,218 +0,0 @@ -using Avalonia; -using Avalonia.Controls; -using Avalonia.Styling; -using Avalonia.Threading; -using FluentAvalonia.Core; -using FluentAvalonia.UI.Controls; -using LibHac; -using LibHac.Common; -using LibHac.Fs; -using LibHac.Fs.Shim; -using Ryujinx.Ava.Common.Locale; -using Ryujinx.Ava.UI.Helpers; -using Ryujinx.Ava.UI.Models; -using Ryujinx.Ava.UI.ViewModels; -using Ryujinx.Ava.UI.Views.User; -using Ryujinx.HLE.FileSystem; -using Ryujinx.HLE.HOS.Services.Account.Acc; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using UserProfile = Ryujinx.Ava.UI.Models.UserProfile; - -namespace Ryujinx.Ava.UI.Controls -{ - public partial class NavigationDialogHost : UserControl - { - public AccountManager AccountManager { get; } - public ContentManager ContentManager { get; } - public VirtualFileSystem VirtualFileSystem { get; } - public HorizonClient HorizonClient { get; } - public UserProfileViewModel ViewModel { get; set; } - - public NavigationDialogHost() - { - InitializeComponent(); - } - - public NavigationDialogHost(AccountManager accountManager, ContentManager contentManager, - VirtualFileSystem virtualFileSystem, HorizonClient horizonClient) - { - AccountManager = accountManager; - ContentManager = contentManager; - VirtualFileSystem = virtualFileSystem; - HorizonClient = horizonClient; - ViewModel = new UserProfileViewModel(); - LoadProfiles(); - - if (contentManager.GetCurrentFirmwareVersion() != null) - { - Task.Run(() => - { - UserFirmwareAvatarSelectorViewModel.PreloadAvatars(contentManager, virtualFileSystem); - }); - } - InitializeComponent(); - } - - public void GoBack(object parameter = null) - { - if (ContentFrame.BackStack.Count > 0) - { - ContentFrame.GoBack(); - } - - LoadProfiles(); - } - - public void Navigate(Type sourcePageType, object parameter) - { - ContentFrame.Navigate(sourcePageType, parameter); - } - - public static async Task Show(AccountManager ownerAccountManager, ContentManager ownerContentManager, - VirtualFileSystem ownerVirtualFileSystem, HorizonClient ownerHorizonClient) - { - var content = new NavigationDialogHost(ownerAccountManager, ownerContentManager, ownerVirtualFileSystem, ownerHorizonClient); - ContentDialog contentDialog = new ContentDialog - { - Title = LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle], - PrimaryButtonText = "", - SecondaryButtonText = "", - CloseButtonText = "", - Content = content, - Padding = new Thickness(0) - }; - - contentDialog.Closed += (sender, args) => - { - content.ViewModel.Dispose(); - }; - - Style footer = new(x => x.Name("DialogSpace").Child().OfType()); - footer.Setters.Add(new Setter(IsVisibleProperty, false)); - - contentDialog.Styles.Add(footer); - - await contentDialog.ShowAsync(); - } - - protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) - { - base.OnAttachedToVisualTree(e); - - Navigate(typeof(UserSelectorViews), this); - } - - public void LoadProfiles() - { - ViewModel.Profiles.Clear(); - ViewModel.LostProfiles.Clear(); - - var profiles = AccountManager.GetAllUsers().OrderBy(x => x.Name); - - foreach (var profile in profiles) - { - ViewModel.Profiles.Add(new UserProfile(profile, this)); - } - - var saveDataFilter = SaveDataFilter.Make(programId: default, saveType: SaveDataType.Account, default, saveDataId: default, index: default); - - using var saveDataIterator = new UniqueRef(); - - HorizonClient.Fs.OpenSaveDataIterator(ref saveDataIterator.Ref, SaveDataSpaceId.User, in saveDataFilter).ThrowIfFailure(); - - Span saveDataInfo = stackalloc SaveDataInfo[10]; - - HashSet lostAccounts = new(); - - while (true) - { - saveDataIterator.Get.ReadSaveDataInfo(out long readCount, saveDataInfo).ThrowIfFailure(); - - if (readCount == 0) - { - break; - } - - for (int i = 0; i < readCount; i++) - { - var save = saveDataInfo[i]; - var id = new HLE.HOS.Services.Account.Acc.UserId((long)save.UserId.Id.Low, (long)save.UserId.Id.High); - if (ViewModel.Profiles.Cast().FirstOrDefault( x=> x.UserId == id) == null) - { - lostAccounts.Add(id); - } - } - } - - foreach(var account in lostAccounts) - { - ViewModel.LostProfiles.Add(new UserProfile(new HLE.HOS.Services.Account.Acc.UserProfile(account, "", null), this)); - } - - ViewModel.Profiles.Add(new BaseModel()); - } - - public async void DeleteUser(UserProfile userProfile) - { - var lastUserId = AccountManager.LastOpenedUser.UserId; - - if (userProfile.UserId == lastUserId) - { - // If we are deleting the currently open profile, then we must open something else before deleting. - var profile = ViewModel.Profiles.Cast().FirstOrDefault(x => x.UserId != lastUserId); - - if (profile == null) - { - async void Action() - { - await ContentDialogHelper.CreateErrorDialog(LocaleManager.Instance[LocaleKeys.DialogUserProfileDeletionWarningMessage]); - } - - Dispatcher.UIThread.Post(Action); - - return; - } - - AccountManager.OpenUser(profile.UserId); - } - - var result = await ContentDialogHelper.CreateConfirmationDialog( - LocaleManager.Instance[LocaleKeys.DialogUserProfileDeletionConfirmMessage], - "", - LocaleManager.Instance[LocaleKeys.InputDialogYes], - LocaleManager.Instance[LocaleKeys.InputDialogNo], - ""); - - if (result == UserResult.Yes) - { - GoBack(); - AccountManager.DeleteUser(userProfile.UserId); - } - - LoadProfiles(); - } - - public void AddUser() - { - Navigate(typeof(UserEditorView), (this, (UserProfile)null, true)); - } - - public void EditUser(UserProfile userProfile) - { - Navigate(typeof(UserEditorView), (this, userProfile, false)); - } - - public void RecoverLostAccounts() - { - Navigate(typeof(UserRecovererView), this); - } - - public void ManageSaves() - { - Navigate(typeof(UserSaveManagerView), (this, AccountManager, HorizonClient, VirtualFileSystem)); - } - } -} \ No newline at end of file diff --git a/Ryujinx.Ava/UI/Controls/UpdateWaitWindow.axaml b/Ryujinx.Ava/UI/Controls/UpdateWaitWindow.axaml deleted file mode 100644 index c5041230..00000000 --- a/Ryujinx.Ava/UI/Controls/UpdateWaitWindow.axaml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Ryujinx.Ava/UI/Controls/UpdateWaitWindow.axaml.cs b/Ryujinx.Ava/UI/Controls/UpdateWaitWindow.axaml.cs deleted file mode 100644 index 80a437e3..00000000 --- a/Ryujinx.Ava/UI/Controls/UpdateWaitWindow.axaml.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Avalonia.Controls; -using Ryujinx.Ava.UI.Windows; -using System.Threading; - -namespace Ryujinx.Ava.UI.Controls -{ - public partial class UpdateWaitWindow : StyleableWindow - { - public UpdateWaitWindow(string primaryText, string secondaryText, CancellationTokenSource cancellationToken) : this(primaryText, secondaryText) - { - SystemDecorations = SystemDecorations.Full; - ShowInTaskbar = true; - - Closing += (_, _) => cancellationToken.Cancel(); - } - - public UpdateWaitWindow(string primaryText, string secondaryText) : this() - { - PrimaryText.Text = primaryText; - SecondaryText.Text = secondaryText; - WindowStartupLocation = WindowStartupLocation.CenterOwner; - SystemDecorations = SystemDecorations.BorderOnly; - ShowInTaskbar = false; - } - - public UpdateWaitWindow() - { - InitializeComponent(); - } - } -} \ No newline at end of file -- cgit v1.2.3