Menu.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. public object Model { get; set; }
  62. public AppMenu LastSelectedSubMenu { get; set; }
  63. public AppMenu() { }
  64. public AppMenu(string p_strMenuID, string p_strMenuViewModel, string p_strResKey, List<AppMenu> p_menuItems)
  65. {
  66. this.m_strMenuID = p_strMenuID;
  67. this.m_strViewModel = p_strMenuViewModel;
  68. this.m_strResKey = p_strResKey;
  69. this.menuItems = p_menuItems;
  70. }
  71. public object Clone(AppMenu parent)
  72. {
  73. AppMenu item = new AppMenu();
  74. item.MenuID = this.MenuID;
  75. item.ResKey = this.ResKey;
  76. item.ViewModel = this.ViewModel;
  77. item.Permission = this.Permission;
  78. item.Selected = this.Selected;
  79. item.System = this.System;
  80. item.Parent = parent;
  81. if (this.MenuItems != null)
  82. {
  83. item.MenuItems = new List<AppMenu>();
  84. foreach (var item1 in this.MenuItems)
  85. {
  86. item.MenuItems.Add((AppMenu)item1.Clone(item));
  87. }
  88. }
  89. return item;
  90. }
  91. #region INotifyPropertyChanged Members
  92. public event PropertyChangedEventHandler PropertyChanged;
  93. protected virtual void OnPropertyChanged(string propertyName)
  94. {
  95. PropertyChangedEventHandler handler = this.PropertyChanged;
  96. if (handler != null)
  97. handler(this, new PropertyChangedEventArgs(propertyName));
  98. }
  99. #endregion
  100. }
  101. }