User.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using Newtonsoft.Json.Converters;
  2. using Newtonsoft.Json;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Linq;
  7. using System.Runtime.Serialization;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using CyberX8_Core;
  11. namespace CyberX8_MainPages.Roles
  12. {
  13. [DataContract]
  14. public class User : INotifyPropertyChanged
  15. {
  16. public User(string name, string password, Role role)
  17. {
  18. Name = name;
  19. Password = password;
  20. Role = role;
  21. }
  22. private string m_Name;
  23. [DataMember]
  24. public string Name
  25. {
  26. get { return m_Name; }
  27. set
  28. {
  29. m_Name = value;
  30. OnPropertyChanged("Name");
  31. }
  32. }
  33. public string m_Password;
  34. [DataMember]
  35. public string Password
  36. {
  37. get { return m_Password; }
  38. set
  39. {
  40. m_Password = value;
  41. OnPropertyChanged("Password");
  42. }
  43. }
  44. public Role m_Role;
  45. [DataMember]
  46. [JsonConverter(typeof(StringEnumConverter))]
  47. public Role Role
  48. {
  49. get { return m_Role; }
  50. set
  51. {
  52. m_Role = value;
  53. OnPropertyChanged("Role");
  54. }
  55. }
  56. #region INotifyPropertyChanged
  57. public event PropertyChangedEventHandler PropertyChanged;
  58. private void OnPropertyChanged(string propertyName)
  59. {
  60. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  61. }
  62. #endregion INotifyPropertyChanged
  63. }
  64. }