MenuInfo.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. using System;
  2. using System.Collections.ObjectModel;
  3. using System.ComponentModel;
  4. using System.Windows;
  5. namespace GeekDesk.ViewModel
  6. {
  7. [Serializable]
  8. public class MenuInfo : INotifyPropertyChanged
  9. {
  10. private string menuName;
  11. private string menuId;
  12. private Visibility menuEdit = Visibility.Collapsed;
  13. private Visibility notMenuEdit = Visibility.Visible;
  14. private ObservableCollection<IconInfo> iconList = new ObservableCollection<IconInfo>();
  15. public string MenuName
  16. {
  17. get
  18. {
  19. return menuName;
  20. }
  21. set
  22. {
  23. menuName = value;
  24. OnPropertyChanged("MenuName");
  25. }
  26. }
  27. public string MenuId
  28. {
  29. get
  30. {
  31. return menuId;
  32. }
  33. set
  34. {
  35. menuId = value;
  36. OnPropertyChanged("MenuId");
  37. }
  38. }
  39. public Visibility MenuEdit
  40. {
  41. get
  42. {
  43. return menuEdit;
  44. }
  45. set
  46. {
  47. menuEdit = value;
  48. if (menuEdit == Visibility.Visible)
  49. {
  50. NotMenuEdit = Visibility.Collapsed;
  51. } else
  52. {
  53. NotMenuEdit = Visibility.Visible;
  54. }
  55. OnPropertyChanged("MenuEdit");
  56. }
  57. }
  58. public Visibility NotMenuEdit
  59. {
  60. get
  61. {
  62. return notMenuEdit;
  63. }
  64. set
  65. {
  66. notMenuEdit = value;
  67. OnPropertyChanged("NotMenuEdit");
  68. }
  69. }
  70. public ObservableCollection<IconInfo> IconList
  71. {
  72. get
  73. {
  74. return iconList;
  75. }
  76. set
  77. {
  78. iconList = value;
  79. OnPropertyChanged("IconList");
  80. }
  81. }
  82. [field: NonSerializedAttribute()]
  83. public event PropertyChangedEventHandler PropertyChanged;
  84. private void OnPropertyChanged(string propertyName)
  85. {
  86. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  87. }
  88. }
  89. }