Files
GeekDesk/ViewModel/MenuInfo.cs

183 lines
4.2 KiB
C#
Raw Normal View History

2021-07-13 17:29:33 +08:00
using GeekDesk.Constant;
using GeekDesk.Util;
2021-05-20 17:33:49 +08:00
using System;
2021-05-12 10:00:12 +08:00
using System.Collections.ObjectModel;
2021-05-08 17:27:41 +08:00
using System.ComponentModel;
using System.Windows;
namespace GeekDesk.ViewModel
{
[Serializable]
2021-05-14 16:48:26 +08:00
public class MenuInfo : INotifyPropertyChanged
2021-05-08 17:27:41 +08:00
{
2021-05-08 17:27:41 +08:00
private string menuName;
private string menuId;
2021-05-19 17:31:28 +08:00
private Visibility menuEdit = Visibility.Collapsed;
private Visibility notMenuEdit = Visibility.Visible;
private string menuGeometry; //菜单几何图标
private string geometryColor; //几何图标颜色
2021-05-12 10:00:12 +08:00
private ObservableCollection<IconInfo> iconList = new ObservableCollection<IconInfo>();
private bool isEncrypt; //是否加密
private MenuType menuType; //菜单类型 普通, 关联
private string linkPath; //关联路径
2021-05-08 17:27:41 +08:00
public string LinkPath
{
get
{
return linkPath;
}
set
{
linkPath = value;
OnPropertyChanged("LinkPath");
}
}
public MenuType MenuType
{
get
{
return menuType;
}
set
{
menuType = value;
OnPropertyChanged("MenuType");
}
}
public bool IsEncrypt
{
get
{
return isEncrypt;
}
set
{
isEncrypt = value;
OnPropertyChanged("IsEncrypt");
}
}
public string MenuGeometry
{
get
{
2021-07-13 17:29:33 +08:00
if (menuGeometry == null)
{
return Constants.DEFAULT_MENU_GEOMETRY;
}
return menuGeometry;
}
set
{
menuGeometry = value;
OnPropertyChanged("MenuGeometry");
}
}
public string GeometryColor
{
get
{
2021-07-13 17:29:33 +08:00
if (geometryColor == null)
{
return Constants.DEFAULT_MENU_GEOMETRY_COLOR;
}
return geometryColor;
}
set
{
geometryColor = value;
OnPropertyChanged("GeometryColor");
}
}
2021-05-08 17:27:41 +08:00
public string MenuName
{
get
{
return menuName;
}
set
{
menuName = value;
OnPropertyChanged("MenuName");
2021-05-08 17:27:41 +08:00
}
}
public string MenuId
{
get
{
return menuId;
}
set
{
menuId = value;
OnPropertyChanged("MenuId");
}
}
2021-05-19 17:31:28 +08:00
public Visibility MenuEdit
2021-05-08 17:27:41 +08:00
{
get
{
return menuEdit;
}
set
{
menuEdit = value;
2021-05-19 17:31:28 +08:00
if (menuEdit == Visibility.Visible)
2021-05-08 17:27:41 +08:00
{
2021-05-19 17:31:28 +08:00
NotMenuEdit = Visibility.Collapsed;
}
else
2021-05-08 17:27:41 +08:00
{
2021-05-19 17:31:28 +08:00
NotMenuEdit = Visibility.Visible;
2021-05-08 17:27:41 +08:00
}
OnPropertyChanged("MenuEdit");
}
}
2021-05-19 17:31:28 +08:00
public Visibility NotMenuEdit
2021-05-08 17:27:41 +08:00
{
get
{
return notMenuEdit;
}
set
{
notMenuEdit = value;
OnPropertyChanged("NotMenuEdit");
}
}
2021-05-12 10:00:12 +08:00
public ObservableCollection<IconInfo> IconList
{
get
{
return iconList;
}
set
{
iconList = value;
OnPropertyChanged("IconList");
}
}
[field: NonSerializedAttribute()]
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
2021-05-12 10:00:12 +08:00
}
2021-05-08 17:27:41 +08:00
}
}