using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Collections.ObjectModel; using Microsoft.Toolkit.Mvvm.ComponentModel; using BPASmartClient.CustomResource.Pages.Enums; using System.Windows; namespace BPASmartClient.CustomResource.Pages.Model { /// /// 在启动界面之前设置菜单项 /// public class MenuManage : ObservableObject { private volatile static MenuManage _Instance; public static MenuManage GetInstance => _Instance ?? (_Instance = new MenuManage()); private MenuManage() { } public ObservableCollection menuModels { get; set; } = new ObservableCollection(); } public class MenuModel : ObservableObject { private Permission[] pers { get { List permissionList = new List(); foreach (var item in subMenumodels) { foreach (var p in item.SubMenuPermission) { if (!permissionList.Contains(p)) permissionList.Add(p); } } return permissionList.ToArray(); } } ///// ///// 主菜单权限 ///// //public Permission[] MainMenuPermission { get { return _mMainMenuPermission; } set { _mMainMenuPermission = value; OnPropertyChanged(); } } //private Permission[] _mMainMenuPermission; /// /// 主菜单权限 /// public Permission[] MainMenuPermission { get { return pers; } set { _mMainMenuPermission = value; OnPropertyChanged(); } } private Permission[] _mMainMenuPermission; /// /// 主菜单图标 /// public string MainMenuIcon { get { return _mMainMenuIcon; } set { _mMainMenuIcon = value; OnPropertyChanged(); } } private string _mMainMenuIcon = string.Empty; /// /// 主菜单名称 /// public string MainMenuName { get { return _mMainMenuName; } set { _mMainMenuName = value; OnPropertyChanged(); } } private string _mMainMenuName = string.Empty; /// /// 别名(英文名) /// public string Alias { get { return _mAlias; } set { _mAlias = value; OnPropertyChanged(); } } private string _mAlias = string.Empty; /// /// 主菜单的显示隐藏设置 /// public Visibility MainMenuVisibility { get { return _mMainMenuVisibility; } set { _mMainMenuVisibility = value; OnPropertyChanged(); } } private Visibility _mMainMenuVisibility; /// /// 子菜单集合 /// public ObservableCollection subMenumodels { get; set; } = new ObservableCollection(); } public class SubMenumodel : ObservableObject { /// /// 子菜单名称 /// public string SubMenuName { get { return _mSubMenuName; } set { _mSubMenuName = value; OnPropertyChanged(); } } private string _mSubMenuName = string.Empty; /// /// 子菜单权限管理 /// public Permission[] SubMenuPermission { get { return _mSubMenuPermission; } set { _mSubMenuPermission = value; OnPropertyChanged(); } } private Permission[] _mSubMenuPermission; /// /// 切换界面路径 /// public string ToggleWindowPath { get { return _mToggleWindowPath; } set { _mToggleWindowPath = value; OnPropertyChanged(); } } private string _mToggleWindowPath = string.Empty; /// /// 程序集名称 /// public string AssemblyName { get { return _mAssemblyName; } set { _mAssemblyName = value; OnPropertyChanged(); } } private string _mAssemblyName = string.Empty; /// /// 子菜单的显示隐藏设置 /// public Visibility SubMenuVisibility { get { return _mSubMenuVisibility; } set { _mSubMenuVisibility = value; OnPropertyChanged(); } } private Visibility _mSubMenuVisibility = Visibility.Collapsed; } }