MenuInfo.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. using GeekDesk.Util;
  2. using System;
  3. using System.Collections.ObjectModel;
  4. using System.ComponentModel;
  5. using System.Windows;
  6. namespace GeekDesk.ViewModel
  7. {
  8. [Serializable]
  9. public class MenuInfo : INotifyPropertyChanged
  10. {
  11. private string menuName;
  12. private string menuId;
  13. private Visibility menuEdit = Visibility.Collapsed;
  14. private Visibility notMenuEdit = Visibility.Visible;
  15. private string menuGeometry; //菜单几何图标
  16. private string geometryColor; //几何图标颜色
  17. private ObservableCollection<IconInfo> iconList = new ObservableCollection<IconInfo>();
  18. public string MenuGeometry
  19. {
  20. get
  21. {
  22. return menuGeometry;
  23. }
  24. set
  25. {
  26. menuGeometry = value;
  27. OnPropertyChanged("MenuGeometry");
  28. }
  29. }
  30. public string GeometryColor
  31. {
  32. get
  33. {
  34. return geometryColor;
  35. }
  36. set
  37. {
  38. geometryColor = value;
  39. OnPropertyChanged("GeometryColor");
  40. }
  41. }
  42. public string MenuName
  43. {
  44. get
  45. {
  46. return menuName;
  47. }
  48. set
  49. {
  50. menuName = value;
  51. OnPropertyChanged("MenuName");
  52. }
  53. }
  54. public string MenuId
  55. {
  56. get
  57. {
  58. return menuId;
  59. }
  60. set
  61. {
  62. menuId = value;
  63. OnPropertyChanged("MenuId");
  64. }
  65. }
  66. public Visibility MenuEdit
  67. {
  68. get
  69. {
  70. return menuEdit;
  71. }
  72. set
  73. {
  74. menuEdit = value;
  75. if (menuEdit == Visibility.Visible)
  76. {
  77. NotMenuEdit = Visibility.Collapsed;
  78. } else
  79. {
  80. NotMenuEdit = Visibility.Visible;
  81. }
  82. OnPropertyChanged("MenuEdit");
  83. }
  84. }
  85. public Visibility NotMenuEdit
  86. {
  87. get
  88. {
  89. return notMenuEdit;
  90. }
  91. set
  92. {
  93. notMenuEdit = value;
  94. OnPropertyChanged("NotMenuEdit");
  95. }
  96. }
  97. public ObservableCollection<IconInfo> IconList
  98. {
  99. get
  100. {
  101. return iconList;
  102. }
  103. set
  104. {
  105. iconList = value;
  106. OnPropertyChanged("IconList");
  107. }
  108. }
  109. [field: NonSerializedAttribute()]
  110. public event PropertyChangedEventHandler PropertyChanged;
  111. private void OnPropertyChanged(string propertyName)
  112. {
  113. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  114. CommonCode.SaveAppData(MainWindow.appData);
  115. }
  116. }
  117. }