UserProfile.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using Ryujinx.Ava.Ui.Controls;
  2. using Ryujinx.Ava.Ui.ViewModels;
  3. using Ryujinx.HLE.HOS.Services.Account.Acc;
  4. using Profile = Ryujinx.HLE.HOS.Services.Account.Acc.UserProfile;
  5. namespace Ryujinx.Ava.Ui.Models
  6. {
  7. public class UserProfile : BaseModel
  8. {
  9. private readonly Profile _profile;
  10. private readonly NavigationDialogHost _owner;
  11. private byte[] _image;
  12. private string _name;
  13. private UserId _userId;
  14. public byte[] Image
  15. {
  16. get => _image;
  17. set
  18. {
  19. _image = value;
  20. OnPropertyChanged();
  21. }
  22. }
  23. public UserId UserId
  24. {
  25. get => _userId;
  26. set
  27. {
  28. _userId = value;
  29. OnPropertyChanged();
  30. }
  31. }
  32. public string Name
  33. {
  34. get => _name;
  35. set
  36. {
  37. _name = value;
  38. OnPropertyChanged();
  39. }
  40. }
  41. public UserProfile(Profile profile, NavigationDialogHost owner)
  42. {
  43. _profile = profile;
  44. _owner = owner;
  45. Image = profile.Image;
  46. Name = profile.Name;
  47. UserId = profile.UserId;
  48. }
  49. public bool IsOpened => _profile.AccountState == AccountState.Open;
  50. public void UpdateState()
  51. {
  52. OnPropertyChanged(nameof(IsOpened));
  53. OnPropertyChanged(nameof(Name));
  54. }
  55. public void Recover(UserProfile userProfile)
  56. {
  57. _owner.Navigate(typeof(UserEditor), (_owner, userProfile, true));
  58. }
  59. }
  60. }