:fire:增加自定义背景保存
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using GeekDesk.ViewModel.Temp;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
@@ -16,7 +18,13 @@ namespace GeekDesk.Control.Other
|
||||
|
||||
public GradientBGDialog()
|
||||
{
|
||||
this.DataContext = GradientBGParamList.GradientBGParams;
|
||||
ObservableCollection<GradientBGParam> bgArr = DeepCopyUtil.DeepCopy(GradientBGParamList.GradientBGParams);
|
||||
foreach(var bg in MainWindow.appData.AppConfig.CustomBGParams)
|
||||
{
|
||||
bgArr.Add(bg);
|
||||
}
|
||||
|
||||
this.DataContext = DeepCopyUtil.DeepCopy(bgArr);
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
@@ -45,8 +53,38 @@ namespace GeekDesk.Control.Other
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void Delete(object sender, RoutedEventArgs e)
|
||||
{
|
||||
HandyControl.Controls.Growl.Ask("确认删除吗?", isConfirmed =>
|
||||
{
|
||||
if (isConfirmed)
|
||||
{
|
||||
GradientBGParam bg = (GradientBGParam)(((MenuItem)sender).Tag);
|
||||
ObservableCollection<GradientBGParam> bgArr = (ObservableCollection<GradientBGParam>)this.DataContext;
|
||||
bgArr.Remove(bg);
|
||||
MainWindow.appData.AppConfig.CustomBGParams.Remove(bg);
|
||||
for (int i = MainWindow.appData.AppConfig.CustomBGParams.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var cbg = MainWindow.appData.AppConfig.CustomBGParams[i];
|
||||
if (cbg.Id == null)
|
||||
{
|
||||
if (cbg.Color1.Equals(bg.Color1) && cbg.Color2.Equals(bg.Color2))
|
||||
{
|
||||
MainWindow.appData.AppConfig.CustomBGParams.RemoveAt(i);
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (cbg.Id.Equals(bg.Id))
|
||||
{
|
||||
MainWindow.appData.AppConfig.CustomBGParams.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
MainWindow.appData.AppConfig.CustomBGParams = DeepCopyUtil.DeepCopy(MainWindow.appData.AppConfig.CustomBGParams);
|
||||
}
|
||||
return true;
|
||||
}, "ConfigWindowAskGrowl");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user