Menu.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. namespace MECF.Framework.Common.Account.Extends
  5. {
  6. [Serializable]
  7. public class AppMenu : INotifyPropertyChanged
  8. {
  9. private string m_strMenuID;
  10. private string m_strViewModel;
  11. private string m_strResKey;
  12. private string _System;
  13. private string _ParentKey;
  14. private int permission;
  15. private AppMenu parent;
  16. private List<AppMenu> menuItems;
  17. private bool selected;
  18. private bool isHide;
  19. public string MenuID
  20. {
  21. get { return m_strMenuID; }
  22. set { m_strMenuID = value; }
  23. }
  24. public string ResKey
  25. {
  26. get { return this.m_strResKey; }
  27. set { m_strResKey = value; }
  28. }
  29. public List<AppMenu> MenuItems
  30. {
  31. get { return menuItems; }
  32. set { menuItems = value; }
  33. }
  34. public string ViewModel
  35. {
  36. get { return this.m_strViewModel; }
  37. set { this.m_strViewModel = value; }
  38. }
  39. public int Permission
  40. {
  41. get { return this.permission; }
  42. set { this.permission = value; }
  43. }
  44. public string System
  45. {
  46. get { return this._System; }
  47. set { this._System = value; }
  48. }
  49. public string ParentKey
  50. {
  51. get { return this._ParentKey; }
  52. set { this._ParentKey = value; }
  53. }
  54. public AppMenu Parent
  55. {
  56. get { return this.parent; }
  57. set { this.parent = value; }
  58. }
  59. public bool IsHide
  60. {
  61. get { return this.isHide; }
  62. set
  63. {
  64. this.isHide = value;
  65. this.OnPropertyChanged("IsHide");
  66. }
  67. }
  68. public bool Selected
  69. {
  70. get { return this.selected; }
  71. set
  72. {
  73. this.selected = value;
  74. this.OnPropertyChanged("Selected");
  75. }
  76. }
  77. private bool _isAlarm;
  78. public bool IsAlarm
  79. {
  80. get { return this._isAlarm; }
  81. set
  82. {
  83. this._isAlarm = value;
  84. this.OnPropertyChanged("IsAlarm");
  85. }
  86. }
  87. private string _alarmModule;
  88. public string AlarmModule
  89. {
  90. get { return this._alarmModule; }
  91. set { this._alarmModule = value; }
  92. }
  93. private string _type;
  94. public string Type
  95. {
  96. get { return this._type; }
  97. set { this._type = value; }
  98. }
  99. public object Model { get; set; }
  100. public AppMenu LastSelectedSubMenu { get; set; }
  101. public AppMenu() { }
  102. public AppMenu(string p_strMenuID, string p_strMenuViewModel, string p_strResKey, List<AppMenu> p_menuItems)
  103. {
  104. this.m_strMenuID = p_strMenuID;
  105. this.m_strViewModel = p_strMenuViewModel;
  106. this.m_strResKey = p_strResKey;
  107. this.menuItems = p_menuItems;
  108. }
  109. public object Clone(AppMenu parent)
  110. {
  111. AppMenu item = new AppMenu();
  112. item.MenuID = this.MenuID;
  113. item.ResKey = this.ResKey;
  114. item.ViewModel = this.ViewModel;
  115. item.Permission = this.Permission;
  116. item.Selected = this.Selected;
  117. item.System = this.System;
  118. item.ParentKey = this.ParentKey;
  119. item.Parent = parent;
  120. item.IsAlarm = this.IsAlarm;
  121. item.AlarmModule = this.AlarmModule;
  122. item.Type = this.Type;
  123. item.IsHide = this.IsHide;
  124. if (this.MenuItems != null)
  125. {
  126. item.MenuItems = new List<AppMenu>();
  127. foreach (var item1 in this.MenuItems)
  128. {
  129. item.MenuItems.Add((AppMenu)item1.Clone(item));
  130. }
  131. }
  132. return item;
  133. }
  134. #region INotifyPropertyChanged Members
  135. public event PropertyChangedEventHandler PropertyChanged;
  136. protected virtual void OnPropertyChanged(string propertyName)
  137. {
  138. PropertyChangedEventHandler handler = this.PropertyChanged;
  139. if (handler != null)
  140. handler(this, new PropertyChangedEventArgs(propertyName));
  141. }
  142. #endregion
  143. }
  144. }