MenuInfo.cs 2.4 KB

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