GradientBGParam.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 color1;
  11. private string color2;
  12. private string name;
  13. public GradientBGParam() { }
  14. public GradientBGParam(string name, string color1, string color2)
  15. {
  16. this.name = name;
  17. this.color1 = color1;
  18. this.color2 = color2;
  19. }
  20. public string Color1
  21. {
  22. get
  23. {
  24. return color1;
  25. }
  26. set
  27. {
  28. color1 = value;
  29. OnPropertyChanged("Color1");
  30. }
  31. }
  32. public string Color2
  33. {
  34. get
  35. {
  36. return color2;
  37. }
  38. set
  39. {
  40. color2 = value;
  41. OnPropertyChanged("Color2");
  42. }
  43. }
  44. public string Name
  45. {
  46. get
  47. {
  48. return name;
  49. }
  50. set
  51. {
  52. name = value;
  53. OnPropertyChanged("Name");
  54. }
  55. }
  56. [field: NonSerializedAttribute()]
  57. public event PropertyChangedEventHandler PropertyChanged;
  58. private void OnPropertyChanged(string propertyName)
  59. {
  60. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  61. CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
  62. }
  63. }
  64. }