diff options
| author | Mary Guillemard <mary@mary.zone> | 2024-03-02 12:51:05 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-02 12:51:05 +0100 |
| commit | ec6cb0abb4b7669895b6e96fd7581c93b5abd691 (patch) | |
| tree | 128c862ff5faea0b219467656d4023bee7faefb5 /src/Ryujinx.Ava/UI/Views/User/UserEditorView.axaml.cs | |
| parent | 53b5985da6b9d7b281d9fc25b93bfd1d1918a107 (diff) | |
infra: Make Avalonia the default UI (#6375)
* 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>
Diffstat (limited to 'src/Ryujinx.Ava/UI/Views/User/UserEditorView.axaml.cs')
| -rw-r--r-- | src/Ryujinx.Ava/UI/Views/User/UserEditorView.axaml.cs | 165 |
1 files changed, 0 insertions, 165 deletions
diff --git a/src/Ryujinx.Ava/UI/Views/User/UserEditorView.axaml.cs b/src/Ryujinx.Ava/UI/Views/User/UserEditorView.axaml.cs deleted file mode 100644 index 588fa471..00000000 --- a/src/Ryujinx.Ava/UI/Views/User/UserEditorView.axaml.cs +++ /dev/null @@ -1,165 +0,0 @@ -using Avalonia.Controls; -using Avalonia.Data; -using Avalonia.Interactivity; -using FluentAvalonia.UI.Controls; -using FluentAvalonia.UI.Navigation; -using Ryujinx.Ava.Common.Locale; -using Ryujinx.Ava.UI.Controls; -using Ryujinx.Ava.UI.Helpers; -using Ryujinx.Ava.UI.Models; -using Ryujinx.HLE.HOS.Services.Account.Acc; -using System; -using UserProfile = Ryujinx.Ava.UI.Models.UserProfile; - -namespace Ryujinx.Ava.UI.Views.User -{ - public partial class UserEditorView : UserControl - { - private NavigationDialogHost _parent; - private UserProfile _profile; - private bool _isNewUser; - - public TempProfile TempProfile { get; set; } - public static uint MaxProfileNameLength => 0x20; - public bool IsDeletable => _profile.UserId != AccountManager.DefaultUserId; - - public UserEditorView() - { - InitializeComponent(); - AddHandler(Frame.NavigatedToEvent, (s, e) => - { - NavigatedTo(e); - }, RoutingStrategies.Direct); - } - - private void NavigatedTo(NavigationEventArgs arg) - { - if (Program.PreviewerDetached) - { - switch (arg.NavigationMode) - { - case NavigationMode.New: - var (parent, profile, isNewUser) = ((NavigationDialogHost parent, UserProfile profile, bool isNewUser))arg.Parameter; - _isNewUser = isNewUser; - _profile = profile; - TempProfile = new TempProfile(_profile); - - _parent = parent; - break; - } - - ((ContentDialog)_parent.Parent).Title = $"{LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle]} - " + - $"{(_isNewUser ? LocaleManager.Instance[LocaleKeys.UserEditorTitleCreate] : LocaleManager.Instance[LocaleKeys.UserEditorTitle])}"; - - DataContext = TempProfile; - - AddPictureButton.IsVisible = _isNewUser; - ChangePictureButton.IsVisible = !_isNewUser; - IdLabel.IsVisible = _profile != null; - IdText.IsVisible = _profile != null; - if (!_isNewUser && IsDeletable) - { - DeleteButton.IsVisible = true; - } - else - { - DeleteButton.IsVisible = false; - } - } - } - - private async void BackButton_Click(object sender, RoutedEventArgs e) - { - if (_isNewUser) - { - if (TempProfile.Name != String.Empty || TempProfile.Image != null) - { - if (await ContentDialogHelper.CreateChoiceDialog( - LocaleManager.Instance[LocaleKeys.DialogUserProfileUnsavedChangesTitle], - LocaleManager.Instance[LocaleKeys.DialogUserProfileUnsavedChangesMessage], - LocaleManager.Instance[LocaleKeys.DialogUserProfileUnsavedChangesSubMessage])) - { - _parent?.GoBack(); - } - } - else - { - _parent?.GoBack(); - } - } - else - { - if (_profile.Name != TempProfile.Name || _profile.Image != TempProfile.Image) - { - if (await ContentDialogHelper.CreateChoiceDialog( - LocaleManager.Instance[LocaleKeys.DialogUserProfileUnsavedChangesTitle], - LocaleManager.Instance[LocaleKeys.DialogUserProfileUnsavedChangesMessage], - LocaleManager.Instance[LocaleKeys.DialogUserProfileUnsavedChangesSubMessage])) - { - _parent?.GoBack(); - } - } - else - { - _parent?.GoBack(); - } - } - } - - private void DeleteButton_Click(object sender, RoutedEventArgs e) - { - _parent.DeleteUser(_profile); - } - - private void SaveButton_Click(object sender, RoutedEventArgs e) - { - DataValidationErrors.ClearErrors(NameBox); - - if (string.IsNullOrWhiteSpace(TempProfile.Name)) - { - DataValidationErrors.SetError(NameBox, new DataValidationException(LocaleManager.Instance[LocaleKeys.UserProfileEmptyNameError])); - - return; - } - - if (TempProfile.Image == null) - { - _parent.Navigate(typeof(UserProfileImageSelectorView), (_parent, TempProfile)); - - return; - } - - if (_profile != null && !_isNewUser) - { - _profile.Name = TempProfile.Name; - _profile.Image = TempProfile.Image; - _profile.UpdateState(); - _parent.AccountManager.SetUserName(_profile.UserId, _profile.Name); - _parent.AccountManager.SetUserImage(_profile.UserId, _profile.Image); - } - else if (_isNewUser) - { - _parent.AccountManager.AddUser(TempProfile.Name, TempProfile.Image, TempProfile.UserId); - } - else - { - return; - } - - _parent?.GoBack(); - } - - public void SelectProfileImage() - { - _parent.Navigate(typeof(UserProfileImageSelectorView), (_parent, TempProfile)); - } - - private void ChangePictureButton_Click(object sender, RoutedEventArgs e) - { - if (_profile != null || _isNewUser) - { - SelectProfileImage(); - } - } - } -} |
