Files
GeekDesk/ViewModel/AppConfig.cs

174 lines
4.2 KiB
C#
Raw Normal View History

2021-04-13 15:26:19 +08:00

2021-04-12 13:46:05 +08:00
using GeekDesk.Constant;
2021-05-20 17:33:49 +08:00
using GeekDesk.Util;
2021-04-13 15:26:19 +08:00
using System;
using System.ComponentModel;
2021-05-19 17:31:28 +08:00
using System.Windows;
2021-04-12 13:46:05 +08:00
2021-05-19 17:31:28 +08:00
/// <summary>
/// 程序设置
/// </summary>
2021-04-12 13:46:05 +08:00
namespace GeekDesk.ViewModel
{
2021-04-13 15:26:19 +08:00
2021-04-12 13:46:05 +08:00
[Serializable]
2021-05-14 16:48:26 +08:00
public class AppConfig : INotifyPropertyChanged
2021-04-12 13:46:05 +08:00
{
2021-05-19 17:31:28 +08:00
private SortType menuSortType = SortType.CUSTOM; //菜单排序类型
private SortType iconSortType = SortType.CUSTOM; //图表排序类型
2021-04-12 13:46:05 +08:00
private double windowWidth = (double)DefaultConstant.WINDOW_WIDTH; //窗口宽度
private double windowHeight = (double)DefaultConstant.WINDOW_HEIGHT; //窗口高度
private double menuCardWidth = (double)DefaultConstant.MENU_CARD_WIDHT;//菜单栏宽度
2021-05-12 10:00:12 +08:00
private int selectedMenuIndex = 0; //上次选中菜单索引
2021-05-19 17:31:28 +08:00
private bool followMouse = true; //面板跟随鼠标 默认是
private Visibility configIconVisible = Visibility.Visible; // 设置按钮是否显示
private AppHideType appHideType = AppHideType.START_EXE; //面板关闭方式 (默认启动程序后)
2021-05-20 17:33:49 +08:00
private bool startedShowPanel = true; //启动时是否显示主面板 默认显示
2021-04-12 13:46:05 +08:00
2021-04-13 15:26:19 +08:00
2021-04-12 13:46:05 +08:00
#region GetSet
2021-05-19 17:31:28 +08:00
2021-05-20 17:33:49 +08:00
public bool StartedShowPanel
2021-05-19 17:31:28 +08:00
{
get
{
return startedShowPanel;
}
set
{
startedShowPanel = value;
OnPropertyChanged("StartedShowPanel");
}
}
public AppHideType AppHideType
{
get
{
return appHideType;
}
set
{
appHideType = value;
OnPropertyChanged("AppHideType");
}
}
public Visibility ConfigIconVisible
{
get
{
return configIconVisible;
}
set
{
configIconVisible = value;
OnPropertyChanged("ConfigIconVisible");
}
}
public bool FollowMouse
{
get
{
return followMouse;
}
set
{
followMouse = value;
OnPropertyChanged("FollowMouse");
}
}
2021-05-12 10:00:12 +08:00
public int SelectedMenuIndex
{
get
{
return selectedMenuIndex;
}
set
{
selectedMenuIndex = value;
OnPropertyChanged("SelectedMenuIndex");
}
}
2021-05-19 17:31:28 +08:00
public SortType MenuSortType
2021-04-13 15:26:19 +08:00
{
2021-04-12 13:46:05 +08:00
get
{
return menuSortType;
}
set
{
menuSortType = value;
2021-04-13 15:26:19 +08:00
OnPropertyChanged("MenuSortType");
2021-04-12 13:46:05 +08:00
}
}
2021-05-19 17:31:28 +08:00
public SortType IconSortType
2021-04-12 13:46:05 +08:00
{
get
{
return iconSortType;
}
set
{
iconSortType = value;
2021-04-13 15:26:19 +08:00
OnPropertyChanged("IconSortType");
2021-04-12 13:46:05 +08:00
}
}
public double WindowWidth
{
get
{
return windowWidth;
}
set
{
windowWidth = value;
2021-04-13 15:26:19 +08:00
OnPropertyChanged("WindowWidth");
2021-04-12 13:46:05 +08:00
}
}
public double WindowHeight
{
get
{
return windowHeight;
}
set
{
windowHeight = value;
2021-04-13 15:26:19 +08:00
OnPropertyChanged("WindowHeight");
2021-04-12 13:46:05 +08:00
}
}
public double MenuCardWidth
{
get
{
return menuCardWidth;
}
set
{
menuCardWidth = value;
2021-04-13 15:26:19 +08:00
OnPropertyChanged("MenuCardWidth");
2021-04-12 13:46:05 +08:00
}
}
2021-04-13 15:26:19 +08:00
[field: NonSerializedAttribute()]
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
2021-05-20 17:33:49 +08:00
CommonCode.SaveAppData(MainWindow.appData);
2021-04-13 15:26:19 +08:00
}
2021-04-12 13:46:05 +08:00
#endregion
}
}