MenuInfo.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 ObservableCollection<IconInfo> iconList = new ObservableCollection<IconInfo>();
  16. public string MenuName
  17. {
  18. get
  19. {
  20. return menuName;
  21. }
  22. set
  23. {
  24. menuName = value;
  25. OnPropertyChanged("MenuName");
  26. }
  27. }
  28. public string MenuId
  29. {
  30. get
  31. {
  32. return menuId;
  33. }
  34. set
  35. {
  36. menuId = value;
  37. OnPropertyChanged("MenuId");
  38. }
  39. }
  40. public Visibility MenuEdit
  41. {
  42. get
  43. {
  44. return menuEdit;
  45. }
  46. set
  47. {
  48. menuEdit = value;
  49. if (menuEdit == Visibility.Visible)
  50. {
  51. NotMenuEdit = Visibility.Collapsed;
  52. } else
  53. {
  54. NotMenuEdit = Visibility.Visible;
  55. }
  56. OnPropertyChanged("MenuEdit");
  57. }
  58. }
  59. public Visibility NotMenuEdit
  60. {
  61. get
  62. {
  63. return notMenuEdit;
  64. }
  65. set
  66. {
  67. notMenuEdit = value;
  68. OnPropertyChanged("NotMenuEdit");
  69. }
  70. }
  71. public ObservableCollection<IconInfo> IconList
  72. {
  73. get
  74. {
  75. return iconList;
  76. }
  77. set
  78. {
  79. iconList = value;
  80. OnPropertyChanged("IconList");
  81. }
  82. }
  83. [field: NonSerializedAttribute()]
  84. public event PropertyChangedEventHandler PropertyChanged;
  85. private void OnPropertyChanged(string propertyName)
  86. {
  87. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  88. CommonCode.SaveAppData(MainWindow.appData);
  89. }
  90. }
  91. }