Files
GeekDesk/ViewModel/MenuInfo.cs

100 lines
2.3 KiB
C#
Raw Normal View History

2021-05-08 17:27:41 +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-12 10:00:12 +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;
2021-05-12 10:00:12 +08:00
private ObservableCollection<IconInfo> iconList = new ObservableCollection<IconInfo>();
2021-05-08 17:27:41 +08:00
public string MenuName
{
get
{
return menuName;
}
set
{
menuName = value;
OnPropertyChanged("MenuName");
}
}
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;
2021-05-08 17:27:41 +08:00
} else
{
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));
}
2021-05-08 17:27:41 +08:00
}
}