代码清理/拾色器功能/部分程序优化

This commit is contained in:
liufei
2022-05-20 15:39:52 +08:00
parent 5cfaf9a37d
commit d01a27b827
83 changed files with 1320 additions and 627 deletions

View File

@@ -48,7 +48,12 @@ namespace GeekDesk.ViewModel
private string toDoHotkeyStr = "Ctrl + Shift + Q"; //待办任务快捷键
private HotkeyModifiers toDoHotkeyModifiers; //待办任务快捷键
private Key toDoHotkey = Key.E; //待办任务快捷键
private Key toDoHotkey = Key.Q; //待办任务快捷键
private string colorPickerHotkeyStr = ""; //拾色器快捷键
private HotkeyModifiers colorPickerHotkeyModifiers; //拾色器快捷键
private Key colorPickerHotkey; //拾色器快捷键
private string customIconUrl; //自定义图标url
private string customIconJsonUrl; //自定义图标json信息url
@@ -81,9 +86,55 @@ namespace GeekDesk.ViewModel
private GradientBGParam gradientBGParam = null; //渐变背景参数
private bool? enableAppHotKey = true; //可能为null
private bool? enableTodoHotKey = true; //可能为null
private bool enableColorPickerHotKey; //新增 默认为false 不需要考虑null值
#region GetSet
public bool EnableColorPickerHotKey
{
get
{
return enableColorPickerHotKey;
}
set
{
enableColorPickerHotKey = value;
OnPropertyChanged("EnableColorPickerHotKey");
}
}
public bool? EnableAppHotKey
{
get
{
if (enableAppHotKey == null) enableAppHotKey = true;
return enableAppHotKey;
}
set
{
enableAppHotKey = value;
OnPropertyChanged("EnableAppHotKey");
}
}
public bool? EnableTodoHotKey
{
get
{
if (enableTodoHotKey == null) enableTodoHotKey = true;
return enableTodoHotKey;
}
set
{
enableTodoHotKey = value;
OnPropertyChanged("EnableTodoHotKey");
}
}
public Visibility TitleLogoVisible
{
get
@@ -375,6 +426,47 @@ namespace GeekDesk.ViewModel
}
}
public Key ColorPickerHotkey
{
get
{
return colorPickerHotkey;
}
set
{
colorPickerHotkey = value;
OnPropertyChanged("ColorPickerHotkey");
}
}
public HotkeyModifiers ColorPickerHotkeyModifiers
{
get
{
return colorPickerHotkeyModifiers;
}
set
{
colorPickerHotkeyModifiers = value;
OnPropertyChanged("ColorPickerHotkeyModifiers");
}
}
public string ColorPickerHotkeyStr
{
get
{
return colorPickerHotkeyStr;
}
set
{
colorPickerHotkeyStr = value;
OnPropertyChanged("ColorPickerHotkeyStr");
}
}
public Key ToDoHotkey
{
get
@@ -382,7 +474,7 @@ namespace GeekDesk.ViewModel
//兼容老版本
if (toDoHotkey == Key.None)
{
toDoHotkey = Key.Q;
toDoHotkey = Key.E;
}
return toDoHotkey;
}

View File

@@ -1,6 +1,5 @@
using GeekDesk.Util;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;

View File

@@ -0,0 +1,93 @@
using System.ComponentModel;
using System.Windows.Media;
using System.Windows.Media.Imaging;
namespace GeekDesk.ViewModel
{
public class CPDataContext : INotifyPropertyChanged
{
private BitmapSource pixelIMG;
private System.Drawing.Color pixelColor_D;
public Color pixelColor;
private string colorHtml;
private string colorRGB;
private string pixelXY;
public BitmapSource PixelIMG
{
set
{
pixelIMG = value;
OnPropertyChanged("PixelIMG");
}
get { return pixelIMG; }
}
public System.Drawing.Color PixelColor_D
{
set
{
pixelColor_D = value;
ColorHtml = pixelColor_D.Name.ToUpper().Substring(2);
ColorRGB = pixelColor_D.R + "," + pixelColor_D.G + "," + pixelColor_D.B;
PixelColor = Color.FromArgb(pixelColor_D.A, pixelColor_D.R, pixelColor_D.G, pixelColor_D.B);
}
get { return pixelColor_D; }
}
public Color PixelColor
{
set
{
pixelColor = value;
OnPropertyChanged("PixelColor");
}
get { return pixelColor; }
}
public string ColorRGB
{
set
{
colorRGB = value;
OnPropertyChanged("ColorRGB");
}
get { return colorRGB; }
}
public string ColorHtml
{
set
{
colorHtml = value;
OnPropertyChanged("ColorHtml");
}
get { return colorHtml; }
}
public string PixelXY
{
set
{
pixelXY = value;
OnPropertyChanged("PixelXY");
}
get { return pixelXY; }
}
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}

View File

@@ -1,10 +1,6 @@
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
{
@@ -19,7 +15,8 @@ namespace GeekDesk.ViewModel
public GradientBGParam() { }
public GradientBGParam(string name, string color1, string color2) {
public GradientBGParam(string name, string color1, string color2)
{
this.name = name;
this.color1 = color1;
this.color2 = color2;

View File

@@ -1,11 +1,7 @@
using GeekDesk.Constant;
using GeekDesk.Util;
using Newtonsoft.Json;
using System;
using System.ComponentModel;
using System.IO;
using System.Reflection;
using System.Text;
using System.Windows.Media.Imaging;
/// <summary>

View File

@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.ViewModel
namespace GeekDesk.ViewModel
{
public class IconfontInfo
{

View File

@@ -11,7 +11,7 @@ namespace GeekDesk.ViewModel
[Serializable]
public class MenuInfo : INotifyPropertyChanged
{
private string menuName;
private string menuId;
@@ -65,7 +65,7 @@ namespace GeekDesk.ViewModel
set
{
menuName = value;
OnPropertyChanged("MenuName");
OnPropertyChanged("MenuName");
}
}
@@ -94,7 +94,8 @@ namespace GeekDesk.ViewModel
if (menuEdit == Visibility.Visible)
{
NotMenuEdit = Visibility.Collapsed;
} else
}
else
{
NotMenuEdit = Visibility.Visible;
}

View File

@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
namespace GeekDesk.ViewModel.Temp
{
@@ -37,6 +31,6 @@ namespace GeekDesk.ViewModel.Temp
gradientBGParams = value;
}
}
}
}

View File

@@ -1,11 +1,7 @@
using GeekDesk.Constant;
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
{