Menu.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. public object Model { get; set; }
  78. public AppMenu LastSelectedSubMenu { get; set; }
  79. public AppMenu() { }
  80. public AppMenu(string p_strMenuID, string p_strMenuViewModel, string p_strResKey, List<AppMenu> p_menuItems)
  81. {
  82. this.m_strMenuID = p_strMenuID;
  83. this.m_strViewModel = p_strMenuViewModel;
  84. this.m_strResKey = p_strResKey;
  85. this.menuItems = p_menuItems;
  86. }
  87. public object Clone(AppMenu parent)
  88. {
  89. AppMenu item = new AppMenu();
  90. item.MenuID = this.MenuID;
  91. item.ResKey = this.ResKey;
  92. item.ViewModel = this.ViewModel;
  93. item.Permission = this.Permission;
  94. item.Selected = this.Selected;
  95. item.System = this.System;
  96. item.Parent = parent;
  97. item.IsAlarm = this.IsAlarm;
  98. item.AlarmModule = this.AlarmModule;
  99. if (this.MenuItems != null)
  100. {
  101. item.MenuItems = new List<AppMenu>();
  102. foreach (var item1 in this.MenuItems)
  103. {
  104. item.MenuItems.Add((AppMenu)item1.Clone(item));
  105. }
  106. }
  107. return item;
  108. }
  109. #region INotifyPropertyChanged Members
  110. public event PropertyChangedEventHandler PropertyChanged;
  111. protected virtual void OnPropertyChanged(string propertyName)
  112. {
  113. PropertyChangedEventHandler handler = this.PropertyChanged;
  114. if (handler != null)
  115. handler(this, new PropertyChangedEventArgs(propertyName));
  116. }
  117. #endregion
  118. }
  119. }