增加系统预设渐变背景
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel.Temp;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
@@ -75,8 +76,42 @@ namespace GeekDesk.ViewModel
|
||||
|
||||
private bool hoverMenu = false; //悬停切换菜单 默认关闭
|
||||
|
||||
private BGStyle bgStyle = BGStyle.ImgBac; //背景风格
|
||||
|
||||
private GradientBGParam gradientBGParam = null; //渐变背景参数
|
||||
|
||||
#region GetSet
|
||||
|
||||
public GradientBGParam GradientBGParam
|
||||
{
|
||||
get
|
||||
{
|
||||
if (gradientBGParam == null)
|
||||
{
|
||||
gradientBGParam = GradientBGParamList.GradientBGParams[0];
|
||||
}
|
||||
return gradientBGParam;
|
||||
}
|
||||
set
|
||||
{
|
||||
gradientBGParam = value;
|
||||
OnPropertyChanged("GradientBGParam");
|
||||
}
|
||||
}
|
||||
|
||||
public BGStyle BGStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
return bgStyle;
|
||||
}
|
||||
set
|
||||
{
|
||||
bgStyle = value;
|
||||
OnPropertyChanged("BGStyle");
|
||||
}
|
||||
}
|
||||
|
||||
public bool HoverMenu
|
||||
{
|
||||
get
|
||||
|
||||
79
ViewModel/GradientBGParam.cs
Normal file
79
ViewModel/GradientBGParam.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using GeekDesk.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GeekDesk.ViewModel
|
||||
{
|
||||
[Serializable]
|
||||
public class GradientBGParam : INotifyPropertyChanged
|
||||
{
|
||||
private string color1;
|
||||
|
||||
private string color2;
|
||||
|
||||
private string name;
|
||||
|
||||
public GradientBGParam() { }
|
||||
|
||||
public GradientBGParam(string name, string color1, string color2) {
|
||||
this.name = name;
|
||||
this.color1 = color1;
|
||||
this.color2 = color2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string Color1
|
||||
{
|
||||
get
|
||||
{
|
||||
return color1;
|
||||
}
|
||||
set
|
||||
{
|
||||
color1 = value;
|
||||
OnPropertyChanged("Color1");
|
||||
}
|
||||
}
|
||||
|
||||
public string Color2
|
||||
{
|
||||
get
|
||||
{
|
||||
return color2;
|
||||
}
|
||||
set
|
||||
{
|
||||
color2 = value;
|
||||
OnPropertyChanged("Color2");
|
||||
}
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return name;
|
||||
}
|
||||
set
|
||||
{
|
||||
name = value;
|
||||
OnPropertyChanged("Name");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[field: NonSerializedAttribute()]
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
private void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
CommonCode.SaveAppData(MainWindow.appData);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
42
ViewModel/Temp/GradientBGParamList.cs
Normal file
42
ViewModel/Temp/GradientBGParamList.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GeekDesk.ViewModel.Temp
|
||||
{
|
||||
public class GradientBGParamList
|
||||
{
|
||||
|
||||
|
||||
private static ObservableCollection<GradientBGParam> gradientBGParams;
|
||||
|
||||
static GradientBGParamList()
|
||||
{
|
||||
//gradientBGParams = (ObservableCollection<GradientBGParam>)ConfigurationManager.GetSection("SystemBGs")
|
||||
gradientBGParams = new ObservableCollection<GradientBGParam>
|
||||
{
|
||||
new GradientBGParam("诸神黄昏", "#FCCF31", "#F55555"),
|
||||
new GradientBGParam ("森林之友", "#EBF7E3", "#A8E4C0"),
|
||||
new GradientBGParam("魅惑妖术", "#FFDDE1", "#EE9CA7"),
|
||||
new GradientBGParam("魅惑妖术", "#D2F6FF", "#91B0E4")
|
||||
};
|
||||
}
|
||||
|
||||
public static ObservableCollection<GradientBGParam> GradientBGParams
|
||||
{
|
||||
get
|
||||
{
|
||||
return gradientBGParams;
|
||||
}
|
||||
set
|
||||
{
|
||||
gradientBGParams = value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user