Menu.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. public string MenuID
  19. {
  20. get { return m_strMenuID; }
  21. set { m_strMenuID = value; }
  22. }
  23. public string ResKey
  24. {
  25. get { return this.m_strResKey; }
  26. set { m_strResKey = value; }
  27. }
  28. public List<AppMenu> MenuItems
  29. {
  30. get { return menuItems; }
  31. set { menuItems = value; }
  32. }
  33. public string ViewModel
  34. {
  35. get { return this.m_strViewModel; }
  36. set { this.m_strViewModel = value; }
  37. }
  38. public int Permission
  39. {
  40. get { return this.permission; }
  41. set { this.permission = value; }
  42. }
  43. public string System
  44. {
  45. get { return this._System; }
  46. set { this._System = value; }
  47. }
  48. public string ParentKey
  49. {
  50. get { return this._ParentKey; }
  51. set { this._ParentKey = value; }
  52. }
  53. public AppMenu Parent
  54. {
  55. get { return this.parent; }
  56. set { this.parent = value; }
  57. }
  58. public bool Selected
  59. {
  60. get { return this.selected; }
  61. set
  62. {
  63. this.selected = value;
  64. this.OnPropertyChanged("Selected");
  65. }
  66. }
  67. private bool _isAlarm;
  68. public bool IsAlarm
  69. {
  70. get { return this._isAlarm; }
  71. set
  72. {
  73. this._isAlarm = value;
  74. this.OnPropertyChanged("IsAlarm");
  75. }
  76. }
  77. private string _alarmModule;
  78. public string AlarmModule
  79. {
  80. get { return this._alarmModule; }
  81. set { this._alarmModule = value; }
  82. }
  83. private string _type;
  84. public string Type
  85. {
  86. get { return this._type; }
  87. set { this._type = value; }
  88. }
  89. public object Model { get; set; }
  90. public AppMenu LastSelectedSubMenu { get; set; }
  91. public AppMenu() { }
  92. public AppMenu(string p_strMenuID, string p_strMenuViewModel, string p_strResKey, List<AppMenu> p_menuItems)
  93. {
  94. this.m_strMenuID = p_strMenuID;
  95. this.m_strViewModel = p_strMenuViewModel;
  96. this.m_strResKey = p_strResKey;
  97. this.menuItems = p_menuItems;
  98. }
  99. public object Clone(AppMenu parent)
  100. {
  101. AppMenu item = new AppMenu();
  102. item.MenuID = this.MenuID;
  103. item.ResKey = this.ResKey;
  104. item.ViewModel = this.ViewModel;
  105. item.Permission = this.Permission;
  106. item.Selected = this.Selected;
  107. item.System = this.System;
  108. item.ParentKey = this.ParentKey;
  109. item.Parent = parent;
  110. item.IsAlarm = this.IsAlarm;
  111. item.AlarmModule = this.AlarmModule;
  112. item.Type = this.Type;
  113. if (this.MenuItems != null)
  114. {
  115. item.MenuItems = new List<AppMenu>();
  116. foreach (var item1 in this.MenuItems)
  117. {
  118. item.MenuItems.Add((AppMenu)item1.Clone(item));
  119. }
  120. }
  121. return item;
  122. }
  123. #region INotifyPropertyChanged Members
  124. public event PropertyChangedEventHandler PropertyChanged;
  125. protected virtual void OnPropertyChanged(string propertyName)
  126. {
  127. PropertyChangedEventHandler handler = this.PropertyChanged;
  128. if (handler != null)
  129. handler(this, new PropertyChangedEventArgs(propertyName));
  130. }
  131. #endregion
  132. }
  133. }