diff --git a/Control/Other/GradientBGDialog.xaml b/Control/Other/GradientBGDialog.xaml
new file mode 100644
index 0000000..e5a6216
--- /dev/null
+++ b/Control/Other/GradientBGDialog.xaml
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Control/Other/GradientBGDialog.xaml.cs b/Control/Other/GradientBGDialog.xaml.cs
new file mode 100644
index 0000000..ede92f8
--- /dev/null
+++ b/Control/Other/GradientBGDialog.xaml.cs
@@ -0,0 +1,38 @@
+using GeekDesk.Util;
+using GeekDesk.ViewModel;
+using GeekDesk.ViewModel.Temp;
+using Microsoft.Win32;
+using System;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media.Imaging;
+
+
+namespace GeekDesk.Control.Other
+{
+ ///
+ /// TextDialog.xaml 的交互逻辑
+ ///
+ public partial class GradientBGDialog
+ {
+ public HandyControl.Controls.Dialog dialog;
+
+ public GradientBGDialog()
+ {
+ this.DataContext = GradientBGParamList.GradientBGParams;
+ InitializeComponent();
+ }
+
+ private void Close_Click(object sender, RoutedEventArgs e)
+ {
+ dialog.Close();
+ }
+
+ private void BGBorder_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
+ {
+ GradientBGParam bgParam = (sender as Border).Tag as GradientBGParam;
+ MainWindow.appData.AppConfig.GradientBGParam = bgParam;
+ BGSettingUtil.BGSetting();
+ }
+ }
+}
diff --git a/Control/UserControls/Config/ThemeControl.xaml b/Control/UserControls/Config/ThemeControl.xaml
index dbea9d4..ba48415 100644
--- a/Control/UserControls/Config/ThemeControl.xaml
+++ b/Control/UserControls/Config/ThemeControl.xaml
@@ -30,7 +30,7 @@
-
@@ -65,7 +65,7 @@
-
@@ -98,6 +98,7 @@
hc:Poptip.IsOpen="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}"
hc:Poptip.Content="{Binding GradientBGParam.Name, Converter={StaticResource StringAppendConvert}, ConverterParameter=当前设置: \{\}}"
hc:Poptip.Placement="Top"
+ Click="SysBG_Click"
/>
diff --git a/Control/UserControls/Config/ThemeControl.xaml.cs b/Control/UserControls/Config/ThemeControl.xaml.cs
index 2777a85..55604a3 100644
--- a/Control/UserControls/Config/ThemeControl.xaml.cs
+++ b/Control/UserControls/Config/ThemeControl.xaml.cs
@@ -1,4 +1,5 @@
using GeekDesk.Constant;
+using GeekDesk.Control.Other;
using GeekDesk.Util;
using GeekDesk.ViewModel;
using Microsoft.Win32;
@@ -241,5 +242,11 @@ namespace GeekDesk.Control.UserControls.Config
{
BGSettingUtil.BGSetting();
}
+
+ private void SysBG_Click(object sender, RoutedEventArgs e)
+ {
+ GradientBGDialog gbg = new GradientBGDialog();
+ gbg.dialog = HandyControl.Controls.Dialog.Show(gbg, "SysBGDialog");
+ }
}
}
diff --git a/Control/Windows/ConfigWindow.xaml b/Control/Windows/ConfigWindow.xaml
index dc063f5..cd71764 100644
--- a/Control/Windows/ConfigWindow.xaml
+++ b/Control/Windows/ConfigWindow.xaml
@@ -24,30 +24,32 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
-
-
+
-
-
+
+
-
-
-
+
-
-
-
+
+
-
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Control/Windows/ConfigWindow.xaml.cs b/Control/Windows/ConfigWindow.xaml.cs
index 78d90a0..bf6b62a 100644
--- a/Control/Windows/ConfigWindow.xaml.cs
+++ b/Control/Windows/ConfigWindow.xaml.cs
@@ -8,7 +8,9 @@ using GeekDesk.ViewModel;
using HandyControl.Controls;
using HandyControl.Data;
using System;
+using System.Collections.Generic;
using System.Windows;
+using System.Windows.Controls;
using System.Windows.Input;
namespace GeekDesk.Control.Windows
@@ -22,6 +24,14 @@ namespace GeekDesk.Control.Windows
private static readonly ThemeControl theme = new ThemeControl();
private static readonly MotionControl motion = new MotionControl();
private static readonly OtherControl other = new OtherControl();
+ private static List ucList = new List();
+ static ConfigWindow()
+ {
+ ucList.Add(about);
+ ucList.Add(theme);
+ ucList.Add(motion);
+ ucList.Add(other);
+ }
public MainWindow mainWindow;
private ConfigWindow(AppConfig appConfig, MainWindow mainWindow)
@@ -53,16 +63,24 @@ namespace GeekDesk.Control.Windows
switch (smi.Tag.ToString())
{
case "Motion":
+ UFG.Visibility = Visibility.Collapsed;
RightCard.Content = motion;
+ UFG.Visibility = Visibility.Visible;
break;
case "Theme":
+ UFG.Visibility = Visibility.Collapsed;
RightCard.Content = theme;
+ UFG.Visibility = Visibility.Visible;
break;
case "Other":
+ UFG.Visibility = Visibility.Collapsed;
RightCard.Content = other;
+ UFG.Visibility = Visibility.Visible;
break;
default:
+ UFG.Visibility = Visibility.Collapsed;
RightCard.Content = about;
+ UFG.Visibility = Visibility.Visible;
break;
}
}
diff --git a/Converts/StringAppendConvert.cs b/Converts/StringAppendConvert.cs
new file mode 100644
index 0000000..7ec7b0b
--- /dev/null
+++ b/Converts/StringAppendConvert.cs
@@ -0,0 +1,33 @@
+using GeekDesk.Constant;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace GeekDesk.Converts
+{
+ class StringAppendConvert : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value == null) return null;
+ if (parameter == null)
+ {
+ return value.ToString();
+ } else
+ {
+ string val = value.ToString();
+ string param = parameter.ToString();
+ return param.Replace("{}", val);
+ }
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/MainWindow.xaml b/MainWindow.xaml
index ce377d2..f80c2d6 100644
--- a/MainWindow.xaml
+++ b/MainWindow.xaml
@@ -34,10 +34,6 @@
-
-
-
-
diff --git a/ViewModel/AppConfig.cs b/ViewModel/AppConfig.cs
index 5f9526b..37cd230 100644
--- a/ViewModel/AppConfig.cs
+++ b/ViewModel/AppConfig.cs
@@ -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
diff --git a/ViewModel/GradientBGParam.cs b/ViewModel/GradientBGParam.cs
new file mode 100644
index 0000000..d031f54
--- /dev/null
+++ b/ViewModel/GradientBGParam.cs
@@ -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);
+ }
+
+ }
+}
diff --git a/ViewModel/Temp/GradientBGParamList.cs b/ViewModel/Temp/GradientBGParamList.cs
new file mode 100644
index 0000000..6c5886f
--- /dev/null
+++ b/ViewModel/Temp/GradientBGParamList.cs
@@ -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 gradientBGParams;
+
+ static GradientBGParamList()
+ {
+ //gradientBGParams = (ObservableCollection)ConfigurationManager.GetSection("SystemBGs")
+ gradientBGParams = new ObservableCollection
+ {
+ new GradientBGParam("诸神黄昏", "#FCCF31", "#F55555"),
+ new GradientBGParam ("森林之友", "#EBF7E3", "#A8E4C0"),
+ new GradientBGParam("魅惑妖术", "#FFDDE1", "#EE9CA7"),
+ new GradientBGParam("魅惑妖术", "#D2F6FF", "#91B0E4")
+ };
+ }
+
+ public static ObservableCollection GradientBGParams
+ {
+ get
+ {
+ return gradientBGParams;
+ }
+ set
+ {
+ gradientBGParams = value;
+ }
+ }
+
+ }
+}