GradientBGParam.cs 1.6 KB

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