:fire:增加自定义背景保存

This commit is contained in:
BookerLiu
2025-03-07 10:59:39 +08:00
parent e74b6d75c4
commit 32e91d6d23
24 changed files with 461 additions and 47 deletions

View File

@@ -58,7 +58,7 @@ namespace GeekDesk.ViewModel
private string customIconUrl; //自定义图标url
private string customIconJsonUrl; //自定义图标json信息url
private bool blurEffect = false; //毛玻璃效果 默认
private bool blurEffect = true; //毛玻璃效果 默认
private double blurValue;
private UpdateType updateType = UpdateType.Gitee; //更新源 默认gitee源
@@ -74,7 +74,7 @@ namespace GeekDesk.ViewModel
private int imageWidth = (int)CommonEnum.IMAGE_WIDTH; //图片宽度
private int imageHeight = (int)CommonEnum.IMAGE_HEIGHT; //图片高度
private bool mouseMiddleShow = false; //鼠标中键呼出 默认启用
private bool mouseMiddleShow = true; //鼠标中键呼出 默认启用
private bool showBarIcon = true; //显示托盘图标 默认显示
@@ -111,12 +111,46 @@ namespace GeekDesk.ViewModel
private bool? showIconTitle = true; //是否显示iconTitle
private bool iconBatch = false; //批量操作图标状态
private ObservableCollection<GradientBGParam> customBGParams; //自定义纯色背景
public ObservableCollection<GradientBGParam> CustomBGParams
{
get
{
if (customBGParams == null)
{
customBGParams = new ObservableCollection<GradientBGParam>();
}
return customBGParams;
}
set
{
customBGParams = value;
OnPropertyChanged("CustomBGParams");
}
}
public bool IconBatch_NoWrite
{
get
{
return iconBatch;
}
set
{
iconBatch = value;
OnPropertyChanged("IconBatch_NoWrite");
}
}
public bool? ShowIconTitle
{
get
{
if (showIconTitle == null) showIconTitle = false;
if (showIconTitle == null) showIconTitle = true;
return showIconTitle;
}
set
@@ -306,7 +340,7 @@ namespace GeekDesk.ViewModel
{
if (gradientBGParam == null)
{
gradientBGParam = GradientBGParamList.GradientBGParams[0];
gradientBGParam = DeepCopyUtil.DeepCopy(GradientBGParamList.GradientBGParams[0]);
}
return gradientBGParam;
}
@@ -690,6 +724,14 @@ namespace GeekDesk.ViewModel
{
get
{
if (blurEffect)
{
BlurValue = 100;
}
else
{
BlurValue = 0;
}
return blurValue;
}
set
@@ -1035,7 +1077,10 @@ namespace GeekDesk.ViewModel
private void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
if (propertyName != null && !propertyName.Contains("NoWrite"))
{
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
}
}
#endregion

View File

@@ -8,6 +8,8 @@ namespace GeekDesk.ViewModel
[Serializable]
public class GradientBGParam : INotifyPropertyChanged
{
private string id;
private string color1;
private string color2;
@@ -16,14 +18,26 @@ namespace GeekDesk.ViewModel
public GradientBGParam() { }
public GradientBGParam(string name, string color1, string color2)
public GradientBGParam(string id, string name, string color1, string color2)
{
this.id = id;
this.name = name;
this.color1 = color1;
this.color2 = color2;
}
public string Id
{
get
{
return id;
}
set
{
id = value;
OnPropertyChanged("Id");
}
}
public string Color1
{

View File

@@ -28,6 +28,21 @@ namespace GeekDesk.ViewModel
private IconType iconType = IconType.OTHER;
private bool isChecked = false; //是否选中
public bool IsChecked_NoWrite
{
get
{
return isChecked;
}
set
{
isChecked = value;
OnPropertyChanged("IsChecked_NoWrite");
}
}
public string RelativePath_NoWrite
{
@@ -347,7 +362,7 @@ namespace GeekDesk.ViewModel
private void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
if (propertyName!=null && propertyName.Contains("NoWrite"))
if (propertyName!=null && !propertyName.Contains("NoWrite"))
{
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
}

View File

@@ -13,9 +13,9 @@ namespace GeekDesk.ViewModel.Temp
//gradientBGParams = (ObservableCollection<GradientBGParam>)ConfigurationManager.GetSection("SystemBGs")
gradientBGParams = new ObservableCollection<GradientBGParam>
{
new GradientBGParam("魅惑妖术", "#EE9CA7", "#FFDDE1"),
new GradientBGParam ("森林之友", "#EBF7E3", "#A8E4C0"),
new GradientBGParam("完美谢幕", "#D76D77", "#FFAF7B")
new GradientBGParam("1E7BFD15-92CE-1332-F583-94E1C39729FF", "魅惑妖术", "#EE9CA7", "#FFDDE1"),
new GradientBGParam ("F54F9B03-8F50-8FFB-54C6-1BCCA03BF0F8", "森林之友", "#EBF7E3", "#A8E4C0"),
new GradientBGParam("36C16080-0516-0DAC-FE09-721CC6AB57A4", "完美谢幕", "#D76D77", "#FFAF7B")
};
}