|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- 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
- {
- /// <summary>
- /// 在启动界面之前设置菜单项
- /// </summary>
- public class MenuManage : ObservableObject
- {
- private volatile static MenuManage _Instance;
- public static MenuManage GetInstance => _Instance ?? (_Instance = new MenuManage());
- private MenuManage() { }
-
- public ObservableCollection<MenuModel> menuModels { get; set; } = new ObservableCollection<MenuModel>();
- }
-
- public class MenuModel : ObservableObject
- {
-
- private Permission[] pers
- {
- get
- {
- List<Permission> permissionList = new List<Permission>();
- foreach (var item in subMenumodels)
- {
- foreach (var p in item.SubMenuPermission)
- {
- if (!permissionList.Contains(p)) permissionList.Add(p);
- }
- }
- return permissionList.ToArray();
- }
- }
-
- ///// <summary>
- ///// 主菜单权限
- ///// </summary>
- //public Permission[] MainMenuPermission { get { return _mMainMenuPermission; } set { _mMainMenuPermission = value; OnPropertyChanged(); } }
- //private Permission[] _mMainMenuPermission;
-
- /// <summary>
- /// 主菜单权限
- /// </summary>
- public Permission[] MainMenuPermission { get { return pers; } set { _mMainMenuPermission = value; OnPropertyChanged(); } }
- private Permission[] _mMainMenuPermission;
-
- /// <summary>
- /// 主菜单图标
- /// </summary>
- public string MainMenuIcon { get { return _mMainMenuIcon; } set { _mMainMenuIcon = value; OnPropertyChanged(); } }
- private string _mMainMenuIcon = string.Empty;
-
- /// <summary>
- /// 主菜单名称
- /// </summary>
- public string MainMenuName { get { return _mMainMenuName; } set { _mMainMenuName = value; OnPropertyChanged(); } }
- private string _mMainMenuName = string.Empty;
-
- /// <summary>
- /// 别名(英文名)
- /// </summary>
- public string Alias { get { return _mAlias; } set { _mAlias = value; OnPropertyChanged(); } }
- private string _mAlias = string.Empty;
-
- /// <summary>
- /// 主菜单的显示隐藏设置
- /// </summary>
- public Visibility MainMenuVisibility { get { return _mMainMenuVisibility; } set { _mMainMenuVisibility = value; OnPropertyChanged(); } }
- private Visibility _mMainMenuVisibility;
-
- /// <summary>
- /// 子菜单集合
- /// </summary>
- public ObservableCollection<SubMenumodel> subMenumodels { get; set; } = new ObservableCollection<SubMenumodel>();
-
- }
-
- public class SubMenumodel : ObservableObject
- {
- /// <summary>
- /// 子菜单名称
- /// </summary>
- public string SubMenuName { get { return _mSubMenuName; } set { _mSubMenuName = value; OnPropertyChanged(); } }
- private string _mSubMenuName = string.Empty;
-
- /// <summary>
- /// 子菜单权限管理
- /// </summary>
- public Permission[] SubMenuPermission { get { return _mSubMenuPermission; } set { _mSubMenuPermission = value; OnPropertyChanged(); } }
- private Permission[] _mSubMenuPermission;
-
- /// <summary>
- /// 切换界面路径
- /// </summary>
- public string ToggleWindowPath { get { return _mToggleWindowPath; } set { _mToggleWindowPath = value; OnPropertyChanged(); } }
- private string _mToggleWindowPath = string.Empty;
-
- /// <summary>
- /// 程序集名称
- /// </summary>
- public string AssemblyName { get { return _mAssemblyName; } set { _mAssemblyName = value; OnPropertyChanged(); } }
- private string _mAssemblyName = string.Empty;
-
- /// <summary>
- /// 子菜单的显示隐藏设置
- /// </summary>
- public Visibility SubMenuVisibility { get { return _mSubMenuVisibility; } set { _mSubMenuVisibility = value; OnPropertyChanged(); } }
- private Visibility _mSubMenuVisibility = Visibility.Collapsed;
-
- }
-
- }
|