GradientBGParam.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. using GeekDesk.Constant;
  2. using GeekDesk.Util;
  3. using System;
  4. using System.ComponentModel;
  5. namespace GeekDesk.ViewModel
  6. {
  7. [Serializable]
  8. public class GradientBGParam : INotifyPropertyChanged
  9. {
  10. private string id;
  11. private string color1;
  12. private string color2;
  13. private string name;
  14. public GradientBGParam() { }
  15. public GradientBGParam(string id, string name, string color1, string color2)
  16. {
  17. this.id = id;
  18. this.name = name;
  19. this.color1 = color1;
  20. this.color2 = color2;
  21. }
  22. public string Id
  23. {
  24. get
  25. {
  26. return id;
  27. }
  28. set
  29. {
  30. id = value;
  31. OnPropertyChanged("Id");
  32. }
  33. }
  34. public string Color1
  35. {
  36. get
  37. {
  38. return color1;
  39. }
  40. set
  41. {
  42. color1 = value;
  43. OnPropertyChanged("Color1");
  44. }
  45. }
  46. public string Color2
  47. {
  48. get
  49. {
  50. return color2;
  51. }
  52. set
  53. {
  54. color2 = value;
  55. OnPropertyChanged("Color2");
  56. }
  57. }
  58. public string Name
  59. {
  60. get
  61. {
  62. return name;
  63. }
  64. set
  65. {
  66. name = value;
  67. OnPropertyChanged("Name");
  68. }
  69. }
  70. [field: NonSerializedAttribute()]
  71. public event PropertyChangedEventHandler PropertyChanged;
  72. private void OnPropertyChanged(string propertyName)
  73. {
  74. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  75. CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
  76. }
  77. }
  78. }