Menu.cs 3.9 KB

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