2023-04-13 11:51:03 +08:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
|
|
|
namespace MECF.Framework.Common.Account.Extends
|
|
|
|
{
|
2023-06-22 09:07:10 +08:00
|
|
|
/// <summary>
|
|
|
|
///
|
|
|
|
/// </summary>
|
2023-04-13 11:51:03 +08:00
|
|
|
[Serializable]
|
|
|
|
public class AppMenu : INotifyPropertyChanged
|
|
|
|
{
|
2023-06-22 09:07:10 +08:00
|
|
|
#region Variables
|
2023-04-13 11:51:03 +08:00
|
|
|
|
2023-06-22 09:07:10 +08:00
|
|
|
private string _mStrMenuId;
|
|
|
|
private string _mStrViewModel;
|
|
|
|
private string _mStrResKey;
|
|
|
|
private string _system;
|
|
|
|
private int _permission;
|
|
|
|
private AppMenu _parent;
|
|
|
|
private List<AppMenu> _menuItems;
|
|
|
|
private bool _selected;
|
|
|
|
private bool _isAlarm;
|
|
|
|
private string _alarmModule;
|
2023-04-13 11:51:03 +08:00
|
|
|
|
2023-06-22 09:07:10 +08:00
|
|
|
#endregion
|
2023-04-13 11:51:03 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
2023-06-22 09:07:10 +08:00
|
|
|
public string MenuID
|
2023-04-13 11:51:03 +08:00
|
|
|
{
|
2023-06-22 09:07:10 +08:00
|
|
|
get => _mStrMenuId;
|
|
|
|
set => _mStrMenuId = value;
|
|
|
|
}
|
2023-04-13 11:51:03 +08:00
|
|
|
|
|
|
|
public string ResKey
|
|
|
|
{
|
2023-06-22 09:07:10 +08:00
|
|
|
get => _mStrResKey;
|
|
|
|
set => _mStrResKey = value;
|
|
|
|
}
|
2023-04-13 11:51:03 +08:00
|
|
|
|
|
|
|
public List<AppMenu> MenuItems
|
|
|
|
{
|
2023-06-22 09:07:10 +08:00
|
|
|
get => _menuItems;
|
|
|
|
set => _menuItems = value;
|
|
|
|
}
|
2023-04-13 11:51:03 +08:00
|
|
|
|
|
|
|
public string ViewModel
|
|
|
|
{
|
2023-06-22 09:07:10 +08:00
|
|
|
get => _mStrViewModel;
|
|
|
|
set => _mStrViewModel = value;
|
|
|
|
}
|
2023-04-13 11:51:03 +08:00
|
|
|
|
|
|
|
public int Permission
|
|
|
|
{
|
2023-06-22 09:07:10 +08:00
|
|
|
get => _permission;
|
|
|
|
set => _permission = value;
|
|
|
|
}
|
2023-04-13 11:51:03 +08:00
|
|
|
|
|
|
|
public string System
|
|
|
|
{
|
2023-06-22 09:07:10 +08:00
|
|
|
get => _system;
|
|
|
|
set => _system = value;
|
|
|
|
}
|
2023-04-13 11:51:03 +08:00
|
|
|
|
|
|
|
public AppMenu Parent
|
|
|
|
{
|
2023-06-22 09:07:10 +08:00
|
|
|
get => _parent;
|
|
|
|
set => _parent = value;
|
|
|
|
}
|
2023-04-13 11:51:03 +08:00
|
|
|
|
|
|
|
public bool Selected
|
|
|
|
{
|
2023-06-22 09:07:10 +08:00
|
|
|
get => _selected;
|
|
|
|
set
|
2023-04-13 11:51:03 +08:00
|
|
|
{
|
2023-06-22 09:07:10 +08:00
|
|
|
_selected = value;
|
2023-04-13 11:51:03 +08:00
|
|
|
OnPropertyChanged("Selected");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool IsAlarm
|
|
|
|
{
|
2023-06-22 09:07:10 +08:00
|
|
|
get => _isAlarm;
|
|
|
|
set
|
2023-04-13 11:51:03 +08:00
|
|
|
{
|
|
|
|
_isAlarm = value;
|
|
|
|
OnPropertyChanged("IsAlarm");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public string AlarmModule
|
|
|
|
{
|
2023-06-22 09:07:10 +08:00
|
|
|
get => _alarmModule;
|
|
|
|
set => _alarmModule = value;
|
|
|
|
}
|
2023-04-13 11:51:03 +08:00
|
|
|
|
|
|
|
public object Model { get; set; }
|
|
|
|
|
|
|
|
public AppMenu LastSelectedSubMenu { get; set; }
|
|
|
|
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
|
|
|
|
|
|
public AppMenu()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public AppMenu(string p_strMenuID, string p_strMenuViewModel, string p_strResKey, List<AppMenu> p_menuItems)
|
|
|
|
{
|
2023-06-22 09:07:10 +08:00
|
|
|
_mStrMenuId = p_strMenuID;
|
|
|
|
_mStrViewModel = p_strMenuViewModel;
|
|
|
|
_mStrResKey = p_strResKey;
|
|
|
|
_menuItems = p_menuItems;
|
2023-04-13 11:51:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public object Clone(AppMenu parent)
|
|
|
|
{
|
|
|
|
AppMenu appMenu = new AppMenu();
|
|
|
|
appMenu.MenuID = MenuID;
|
|
|
|
appMenu.ResKey = ResKey;
|
|
|
|
appMenu.ViewModel = ViewModel;
|
|
|
|
appMenu.Permission = Permission;
|
|
|
|
appMenu.Selected = Selected;
|
|
|
|
appMenu.System = System;
|
|
|
|
appMenu.Parent = parent;
|
|
|
|
appMenu.IsAlarm = IsAlarm;
|
|
|
|
appMenu.AlarmModule = AlarmModule;
|
|
|
|
if (MenuItems != null)
|
|
|
|
{
|
|
|
|
appMenu.MenuItems = new List<AppMenu>();
|
|
|
|
foreach (AppMenu menuItem in MenuItems)
|
|
|
|
{
|
|
|
|
appMenu.MenuItems.Add((AppMenu)menuItem.Clone(appMenu));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return appMenu;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected virtual void OnPropertyChanged(string propertyName)
|
|
|
|
{
|
|
|
|
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|