using System.Windows.Input;
using GalaSoft.MvvmLight;
using Muchinfo.MTPClient.Data.Enums;
using System.Collections.Generic;
using Muchinfo.MTPClient.Data.Model;
using System;
using System.Linq;
namespace Muchinfo.MTPClient.Data
{
///
/// 菜单项类
///
public class SysMenuItem : ViewModelBase
{
#region Constructors
public SysMenuItem()
{
Children = new List();
}
///
/// 无执行命令菜单
///
/// The title.
public SysMenuItem(string title)
: this(title, MenuCommandType.None)
{
//菜单项默认不能checkable,实例化后按需设置成true
IsCheckable = false;
}
///
/// 有执行命令菜单
///
/// The title.
/// Type of the command.
public SysMenuItem(string title, MenuCommandType commandType)
{
this.Title = title;
this.SysCommandType = commandType;
IsEnabled = true;
SysMenuType = SysMenuType.Enum;
FuncMenuCode = commandType.ToString();
}
///
/// 有执行命令菜单
///
/// The title.
/// Type of the command.
public SysMenuItem( MenuCommandType commandType)
{
this.SysCommandType = commandType;
IsEnabled = true;
SysMenuType = SysMenuType.Enum;
this.ResourceCode = eSystemMenuValue.CreateInstance().menu.Where(x => x.Key == commandType).Select(x => x.Value).FirstOrDefault();
}
public SysMenuItem(string title, string code)
{
this.Title = title;
this.Code = code;
IsEnabled = true;
SysMenuType = SysMenuType.News;
}
#endregion Constructors
#region Properties
#region Public Properties
///
/// 子菜单
///
public List Children
{
get;
set;
}
///
/// 父菜单
///
public SysMenuItem ParentItem { get; set; }
///
/// 菜单快捷键显示文本
///
public string InputGestureText
{
get;
set;
}
///
/// 是否能check
///
public bool IsCheckable
{
get;
set;
}
private bool _isChecked;
///
/// 是否check
///
public bool IsChecked
{
get { return _isChecked; }
set { Set(() => IsChecked, ref _isChecked, value); }
}
private bool _isVisible ;
///
/// 是否显示菜单
///
public bool IsVisible
{
get { return _isVisible; }
set { Set(() => IsVisible, ref _isVisible, value); }
}
private bool _isEnabled;
///
/// Gets or sets a value indicating whether this instance is enabled.
///
public bool IsEnabled
{
get { return _isEnabled; }
set { Set(() => IsEnabled, ref _isEnabled, value); }
}
private bool _isSelected;
///
/// 是否选中
///
public bool IsSelected
{
get { return _isSelected; }
set { Set(() => IsSelected, ref _isSelected, value); }
}
private bool _isExpanded = false;
///
/// 菜单是否展开
///
public bool IsExpanded
{
get { return _isExpanded; }
set { Set(() => IsExpanded, ref _isExpanded, value); }
}
///
/// 菜单项命令类型
///
public MenuCommandType SysCommandType
{
get;
set;
}
///
/// 是否是枚举类型命令
///
public SysMenuType SysMenuType { get; set; }
///
/// 菜单项命令代码
///
public string Code
{
get;
set;
}
private string _title;
///
/// 菜单项标题
///
public string Title
{
get { return _title; }
set { Set(() => Title, ref _title, value); }
}
///
/// CommandType = CustomQuote时,存储交易所所代码,市场代码
///
public string QuoteParameters
{
get;
set;
}
///
/// 父菜单标题
///
public string ParentTitle
{
get;
set;
}
private string _resourceCode;
public string ResourceCode
{
get { return _resourceCode; }
set { _resourceCode = value; }
}
///
/// 是否为显示对话框
///
public bool IsDialog { get; set; }
///
/// 显示在查询框的查询对象
///
public object View { get; set; }
#endregion Public Properties
#endregion Properties
#region 服务端配置的转换对象
///
/// 功能菜单id
///
public int FuncMenuId { get; set; }
///
/// 功能菜单代码
///
public string FuncMenuCode { get; set; }
///
/// 父级菜单代码
///
public string ParentFuncMenuCode { get; set; }
///
/// 操作功能,标识菜单具有哪些复选框
///
public int OperateFunc { get; set; }
///
/// 操作功能值,标识哪些复选框被选中
///
public int OperateFuncVal { get; set; }
///
/// 客户端类型 0:交易客户端 1:管理客户端s
///
public int RoleType { get; set; }
///
/// 序号用于排序菜单的位置
///
public int FuncNo { get; set; }
#endregion Other
#region 菜单使用
///
/// 对话框 对象
///
public Type ViewType { get; set; }
///
/// 参数
///
public List