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

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

@@ -2,6 +2,8 @@
<configuration> <configuration>
<configSections> <configSections>
<section name="SystemIcons" type="System.Configuration.DictionarySectionHandler" /> <section name="SystemIcons" type="System.Configuration.DictionarySectionHandler" />
<section name="SystemBGs" type="System.Collections.ObjectModel.ObservableCollection" />
<section name="GradientBGParam" type="GeekDesk.ViewModel.GradientBGParam" />
</configSections> </configSections>
<SystemIcons> <SystemIcons>
<add key="Calculator" value="计算器" /> <add key="Calculator" value="计算器" />
@@ -16,6 +18,9 @@
<add key="CMD" value="命令行" /> <add key="CMD" value="命令行" />
<add key="Services" value="服务" /> <add key="Services" value="服务" />
</SystemIcons> </SystemIcons>
<SystemBGs>
<GradientBGParam Color1="#FCCF31" Color2="#F55555" Name="诸神黄昏"/>
</SystemBGs>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup> </startup>

View File

@@ -1,12 +1,7 @@
using GeekDesk.Constant; using GeekDesk.Constant;
using GeekDesk.Util; using GeekDesk.Util;
using Microsoft.Win32;
using System; using System;
using System.IO;
using System.Text;
using System.Windows; using System.Windows;
using System.Windows.Media.Animation;
using System.Windows.Threading;
namespace GeekDesk namespace GeekDesk
{ {

View File

@@ -1,10 +1,4 @@
using System; /// <summary>
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
/// <summary>
/// 背景风格 /// 背景风格
/// </summary> /// </summary>
namespace GeekDesk.Constant namespace GeekDesk.Constant

View File

@@ -1,10 +1,6 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic;
using System.Configuration; using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.Constant namespace GeekDesk.Constant
{ {

10
Constant/HotKeyType.cs Normal file
View File

@@ -0,0 +1,10 @@
namespace GeekDesk.Constant
{
public enum HotKeyType
{
Main = 0, //主窗口
ToDo = 1, //待办任务
ColorPicker = 2 //拾色器
}
}

View File

@@ -1,10 +1,4 @@
using System; /// <summary>
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
/// <summary>
/// 图标应用启动方式 /// 图标应用启动方式
/// </summary> /// </summary>
namespace GeekDesk.Constant namespace GeekDesk.Constant

View File

@@ -1,10 +1,4 @@
using System; namespace GeekDesk.Constant
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.Constant
{ {
public enum IconType public enum IconType
{ {

View File

@@ -1,10 +1,4 @@
using System; namespace GeekDesk.Constant
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.Constant
{ {
internal class RunTimeStatus internal class RunTimeStatus
{ {

View File

@@ -1,10 +1,4 @@
using System; namespace GeekDesk.Constant
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.Constant
{ {
public enum TodoTaskExecType public enum TodoTaskExecType
{ {

View File

@@ -1,10 +1,4 @@
using System; /// <summary>
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
/// <summary>
/// 更新源 /// 更新源
/// </summary> /// </summary>
namespace GeekDesk.Constant namespace GeekDesk.Constant

View File

@@ -5,18 +5,8 @@ using GeekDesk.ViewModel;
using HandyControl.Controls; using HandyControl.Controls;
using Quartz; using Quartz;
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace GeekDesk.Control.Other namespace GeekDesk.Control.Other
{ {

View File

@@ -1,13 +1,9 @@
using GeekDesk.Control.Windows; using GeekDesk.Control.Windows;
using GeekDesk.Util; using GeekDesk.Util;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using Microsoft.Win32;
using System;
using System.Configuration; using System.Configuration;
using System.Diagnostics; using System.Diagnostics;
using System.Windows; using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Imaging;
namespace GeekDesk.Control.Other namespace GeekDesk.Control.Other

View File

@@ -1,11 +1,8 @@
using GeekDesk.Util; using GeekDesk.Util;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using GeekDesk.ViewModel.Temp; using GeekDesk.ViewModel.Temp;
using Microsoft.Win32;
using System;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Media.Imaging;
namespace GeekDesk.Control.Other namespace GeekDesk.Control.Other

View File

@@ -3,7 +3,6 @@ using GeekDesk.ViewModel;
using Microsoft.Win32; using Microsoft.Win32;
using System; using System;
using System.Windows; using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;

View File

@@ -4,7 +4,6 @@ using GeekDesk.ViewModel;
using Microsoft.Win32; using Microsoft.Win32;
using System; using System;
using System.Windows; using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
@@ -89,7 +88,8 @@ namespace GeekDesk.Control.Other
info.BitmapImage = ImageUtil.GetBitmapIconByPath(ofd.FileName); info.BitmapImage = ImageUtil.GetBitmapIconByPath(ofd.FileName);
CommonCode.SaveAppData(MainWindow.appData); CommonCode.SaveAppData(MainWindow.appData);
} }
} catch (Exception ex) }
catch (Exception ex)
{ {
HandyControl.Controls.Growl.WarningGlobal("修改图标失败,已重置为默认图标!"); HandyControl.Controls.Growl.WarningGlobal("修改图标失败,已重置为默认图标!");
LogUtil.WriteErrorLog(ex, "修改图标失败!"); LogUtil.WriteErrorLog(ex, "修改图标失败!");

View File

@@ -0,0 +1,30 @@
<Border x:Class="GeekDesk.Control.Other.MyColorPickerDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hc="https://handyorg.github.io/handycontrol"
CornerRadius="4"
>
<Grid>
<StackPanel>
<Grid Width="750"
Height="550"
Panel.ZIndex="0"
MouseDown="DragMove"
>
<Grid.Background>
<SolidColorBrush Color="Black" Opacity="0.01"/>
</Grid.Background>
</Grid>
<hc:ColorPicker x:Name="MyColorPicker"
Panel.ZIndex="99"
Margin="0,-500,0,0"
Confirmed="MyColorPicker_Confirmed"
Canceled="MyColorPicker_Canceled"
ToggleButton.Checked="MyColorPicker_Checked"
SelectedColorChanged="MyColorPicker_SelectedColorChanged"/>
</StackPanel>
</Grid>
</Border>

View File

@@ -0,0 +1,120 @@
using GeekDesk.Control.Windows;
using GeekDesk.ViewModel;
using System;
using System.Reflection;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
namespace GeekDesk.Control.Other
{
public enum ColorType
{
COLOR_1 = 1,
COLOR_2 = 2,
TEXT_COLOR = 3
}
/// <summary>
/// TextDialog.xaml 的交互逻辑
/// </summary>
public partial class MyColorPickerDialog
{
public static ColorType COLOR_TYPE = new ColorType();
private static AppConfig appConfig = MainWindow.appData.AppConfig;
public static HandyControl.Controls.Dialog dialog;
private System.Windows.Controls.Primitives.ToggleButton toggleButton = null;
private static ColorType colorType;
public MyColorPickerDialog(string strType, string token)
{
InitializeComponent();
switch (strType)
{
case "Color1":
colorType = ColorType.COLOR_1; break;
case "Color2":
colorType = ColorType.COLOR_2; break;
default:
colorType = ColorType.TEXT_COLOR; break;
}
dialog = HandyControl.Controls.Dialog.Show(this, token);
}
/// <summary>
/// 取消按钮事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void MyColorPicker_Canceled(object sender, EventArgs e)
{
MyColorPickerClose(sender);
}
private void MyColorPicker_Confirmed(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
{
MyColorPickerClose(sender);
}
private void MyColorPicker_SelectedColorChanged(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
{
SolidColorBrush scb = MyColorPicker.SelectedBrush;
switch (colorType)
{
case ColorType.COLOR_1:
appConfig.GradientBGParam.Color1 = scb.ToString(); break;
case ColorType.COLOR_2:
appConfig.GradientBGParam.Color2 = scb.ToString(); break;
default:
appConfig.TextColor = scb.ToString(); break;
}
}
/// <summary>
/// 移动窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void DragMove(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
{
Window.GetWindow(this).DragMove();
}
}
private void MyColorPicker_Checked(object sender, RoutedEventArgs e)
{
toggleButton = e.OriginalSource as System.Windows.Controls.Primitives.ToggleButton;
PixelColorPickerWindow colorPickerWindow = new PixelColorPickerWindow(MyColorPicker);
colorPickerWindow.Show();
}
private void MyColorPickerClose(object sender)
{
ClickColorPickerToggleButton(sender as HandyControl.Controls.ColorPicker);
dialog.Close();
}
public void ClickColorPickerToggleButton(HandyControl.Controls.ColorPicker colorPicker)
{
if (toggleButton != null && toggleButton.IsChecked == true)
{
const BindingFlags InstanceBindFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
Type type = colorPicker.GetType();
toggleButton.IsChecked = false;
MethodInfo mi = type.GetMethod("ToggleButtonDropper_Click", InstanceBindFlags);
mi.Invoke(colorPicker, new object[] { null, null });
}
}
}
}

View File

@@ -1,20 +1,9 @@
using System; using GeekDesk.Constant;
using GeekDesk.Util;
using System.Configuration; using System.Configuration;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using GeekDesk.Util;
using GeekDesk.Constant;
namespace GeekDesk.Control.UserControls.Config namespace GeekDesk.Control.UserControls.Config
{ {

View File

@@ -4,10 +4,13 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:cvt="clr-namespace:GeekDesk.Converts" xmlns:cvt="clr-namespace:GeekDesk.Converts"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d" mc:Ignorable="d"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel"
d:DataContext="{d:DesignInstance Type=viewmodel:AppConfig}"
xmlns:cst="clr-namespace:GeekDesk.Constant"
Background="Transparent" Background="Transparent"
d:DesignHeight="300" d:DesignWidth="450"> d:DesignHeight="400" d:DesignWidth="450">
<UserControl.Resources> <UserControl.Resources>
<cvt:HideTypeConvert x:Key="HideTypeConvert"/> <cvt:HideTypeConvert x:Key="HideTypeConvert"/>
@@ -109,30 +112,74 @@
<TextBlock Text="热键设置" VerticalAlignment="Center"/> <TextBlock Text="热键设置" VerticalAlignment="Center"/>
</hc:UniformSpacingPanel> </hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4"> <hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<TextBlock Text="主面板:" VerticalAlignment="Center" Width="55"/> <TextBlock Text="主面板:" VerticalAlignment="Center" Margin="0,5,0,0" Width="55"/>
<hc:TextBox HorizontalAlignment="Left" <hc:TextBox HorizontalAlignment="Left"
Tag="Main" Tag="{x:Static cst:HotKeyType.Main}"
VerticalAlignment="Top" VerticalAlignment="Top"
IsReadOnly="True" IsReadOnly="True"
IsReadOnlyCaretVisible="True" IsReadOnlyCaretVisible="True"
Width="200" Width="170"
Text="{Binding HotkeyStr}" Text="{Binding HotkeyStr}"
KeyDown="HotKeyDown" KeyDown="HotKeyDown"
KeyUp="HotKeyUp" KeyUp="HotKeyUp"
/> />
<CheckBox Content="启用"
Click="EnableHotKey_Click"
Tag="{x:Static cst:HotKeyType.Main}"
IsChecked="{Binding EnableAppHotKey}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
</hc:UniformSpacingPanel> </hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4"> <hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<TextBlock Text="新建待办:" Width="55"/> <TextBlock Text="新建待办:" Margin="0,5,0,0" Width="55"/>
<hc:TextBox HorizontalAlignment="Left" <hc:TextBox HorizontalAlignment="Left"
Tag="ToDo" Tag="{x:Static cst:HotKeyType.ToDo}"
VerticalAlignment="Top" VerticalAlignment="Top"
IsReadOnly="True" IsReadOnly="True"
IsReadOnlyCaretVisible="True" IsReadOnlyCaretVisible="True"
Width="200" Width="170"
Text="{Binding ToDoHotkeyStr}" Text="{Binding ToDoHotkeyStr}"
KeyDown="HotKeyDown" KeyDown="HotKeyDown"
KeyUp="HotKeyUp" KeyUp="HotKeyUp"
/> />
<CheckBox Content="启用"
Click="EnableHotKey_Click"
Tag="{x:Static cst:HotKeyType.ToDo}"
IsChecked="{Binding EnableTodoHotKey}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
</hc:UniformSpacingPanel>
<hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
<TextBlock Text="拾色器:" Margin="0,5,0,0" Width="55"/>
<hc:TextBox HorizontalAlignment="Left"
Tag="{x:Static cst:HotKeyType.ColorPicker}"
VerticalAlignment="Top"
IsReadOnly="True"
IsReadOnlyCaretVisible="True"
Width="170"
Text="{Binding ColorPickerHotkeyStr}"
KeyDown="HotKeyDown"
KeyUp="HotKeyUp"
/>
<CheckBox Content="启用"
Tag="{x:Static cst:HotKeyType.ColorPicker}"
Click="EnableHotKey_Click"
IsChecked="{Binding EnableColorPickerHotKey}">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
</hc:UniformSpacingPanel> </hc:UniformSpacingPanel>
</StackPanel> </StackPanel>
</Grid> </Grid>

View File

@@ -1,26 +1,12 @@
using GeekDesk.Constant; using GeekDesk.Constant;
using GeekDesk.Control.Windows;
using GeekDesk.MyThread; using GeekDesk.MyThread;
using GeekDesk.Util; using GeekDesk.Util;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using HandyControl.Data;
using Microsoft.Win32;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using static GeekDesk.Util.GlobalHotKey; using static GeekDesk.Util.GlobalHotKey;
namespace GeekDesk.Control.UserControls.Config namespace GeekDesk.Control.UserControls.Config
@@ -48,7 +34,7 @@ namespace GeekDesk.Control.UserControls.Config
/// <param name="e"></param> /// <param name="e"></param>
private void HotKeyDown(object sender, KeyEventArgs e) private void HotKeyDown(object sender, KeyEventArgs e)
{ {
string tag = (sender as TextBox).Tag.ToString(); HotKeyType hkType = (HotKeyType)(sender as TextBox).Tag;
Key downKey = e.Key; Key downKey = e.Key;
if (downKey == Key.System) if (downKey == Key.System)
@@ -56,47 +42,59 @@ namespace GeekDesk.Control.UserControls.Config
downKey = e.SystemKey; downKey = e.SystemKey;
} }
bool main = false; if (!CheckIsEnable(hkType)) return;
if ("Main".Equals(tag))
{
main = true;
}
if (prevKeyTemp == Key.None || prevKeyTemp != downKey) if (prevKeyTemp == Key.None || prevKeyTemp != downKey)
{ {
if (hotkeyFinished) if (hotkeyFinished)
{ {
if (main)
switch (hkType)
{ {
case HotKeyType.Main:
appConfig.Hotkey = 0; appConfig.Hotkey = 0;
appConfig.HotkeyStr = ""; appConfig.HotkeyStr = "";
appConfig.HotkeyModifiers = 0; appConfig.HotkeyModifiers = 0;
} break;
else case HotKeyType.ToDo:
{
appConfig.ToDoHotkey = 0; appConfig.ToDoHotkey = 0;
appConfig.ToDoHotkeyStr = ""; appConfig.ToDoHotkeyStr = "";
appConfig.ToDoHotkeyModifiers = 0; appConfig.ToDoHotkeyModifiers = 0;
break;
case HotKeyType.ColorPicker:
appConfig.ColorPickerHotkey = 0;
appConfig.ColorPickerHotkeyStr = "";
appConfig.ColorPickerHotkeyModifiers = 0;
break;
} }
hotkeyFinished = false; hotkeyFinished = false;
} }
//首次按下按键 //首次按下按键
if ((main && (appConfig.HotkeyStr == null || appConfig.HotkeyStr.Length == 0)) if ((HotKeyType.Main == hkType && (appConfig.HotkeyStr == null || appConfig.HotkeyStr.Length == 0))
|| (!main && (appConfig.ToDoHotkeyStr == null || appConfig.ToDoHotkeyStr.Length == 0))) || (HotKeyType.ToDo == hkType && (appConfig.ToDoHotkeyStr == null || appConfig.ToDoHotkeyStr.Length == 0))
|| (HotKeyType.ColorPicker == hkType && (appConfig.ColorPickerHotkeyStr == null || appConfig.ColorPickerHotkeyStr.Length == 0))
)
{ {
if (CheckModifierKeys(downKey)) if (CheckModifierKeys(downKey))
{ {
//辅助键 //辅助键
if (main) switch (hkType)
{ {
case HotKeyType.Main:
appConfig.HotkeyStr = GetKeyName(downKey); appConfig.HotkeyStr = GetKeyName(downKey);
appConfig.HotkeyModifiers = GetModifierKeys(downKey); appConfig.HotkeyModifiers = GetModifierKeys(downKey);
} break;
else case HotKeyType.ToDo:
{
appConfig.ToDoHotkeyStr = GetKeyName(downKey); appConfig.ToDoHotkeyStr = GetKeyName(downKey);
appConfig.ToDoHotkeyModifiers = GetModifierKeys(downKey); appConfig.ToDoHotkeyModifiers = GetModifierKeys(downKey);
break;
case HotKeyType.ColorPicker:
appConfig.ColorPickerHotkeyStr = GetKeyName(downKey);
appConfig.ColorPickerHotkeyModifiers = GetModifierKeys(downKey);
break;
} }
prevKeyTemp = downKey; prevKeyTemp = downKey;
keysTemp.Add(e); keysTemp.Add(e);
} }
@@ -109,30 +107,41 @@ namespace GeekDesk.Control.UserControls.Config
|| (downKey >= Key.F1 && downKey <= Key.F12) || (downKey >= Key.F1 && downKey <= Key.F12)
|| (downKey >= Key.D0 && downKey <= Key.D9))) || (downKey >= Key.D0 && downKey <= Key.D9)))
{ {
if (main) switch (hkType)
{ {
case HotKeyType.Main:
appConfig.Hotkey = downKey; appConfig.Hotkey = downKey;
appConfig.HotkeyStr += downKey.ToString(); appConfig.HotkeyStr += downKey.ToString();
} break;
else case HotKeyType.ToDo:
{
appConfig.ToDoHotkey = downKey; appConfig.ToDoHotkey = downKey;
appConfig.ToDoHotkeyStr += downKey.ToString(); appConfig.ToDoHotkeyStr += downKey.ToString();
break;
case HotKeyType.ColorPicker:
appConfig.ColorPickerHotkey = downKey;
appConfig.ColorPickerHotkeyStr += downKey.ToString();
break;
} }
prevKeyTemp = downKey; prevKeyTemp = downKey;
keysTemp.Add(e); keysTemp.Add(e);
} }
else if (CheckModifierKeys(downKey)) else if (CheckModifierKeys(downKey))
{ {
if (main) switch (hkType)
{ {
case HotKeyType.Main:
appConfig.HotkeyStr += GetKeyName(downKey); appConfig.HotkeyStr += GetKeyName(downKey);
appConfig.HotkeyModifiers |= GetModifierKeys(downKey); appConfig.HotkeyModifiers |= GetModifierKeys(downKey);
} break;
else case HotKeyType.ToDo:
{
appConfig.ToDoHotkeyStr += GetKeyName(downKey); appConfig.ToDoHotkeyStr += GetKeyName(downKey);
appConfig.ToDoHotkeyModifiers |= GetModifierKeys(downKey); appConfig.ToDoHotkeyModifiers |= GetModifierKeys(downKey);
break;
case HotKeyType.ColorPicker:
appConfig.ColorPickerHotkeyStr += GetKeyName(downKey);
appConfig.ColorPickerHotkeyModifiers |= GetModifierKeys(downKey);
break;
} }
prevKeyTemp = downKey; prevKeyTemp = downKey;
@@ -194,12 +203,10 @@ namespace GeekDesk.Control.UserControls.Config
[MethodImpl(MethodImplOptions.Synchronized)] [MethodImpl(MethodImplOptions.Synchronized)]
private void HotKeyUp(object sender, KeyEventArgs e) private void HotKeyUp(object sender, KeyEventArgs e)
{ {
string tag = (sender as TextBox).Tag.ToString(); HotKeyType hkType = (HotKeyType)(sender as TextBox).Tag;
bool main = false;
if ("Main".Equals(tag)) if (!CheckIsEnable(hkType)) return;
{
main = true;
}
lock (this) lock (this)
{ {
bool allKeyUp = true; bool allKeyUp = true;
@@ -218,28 +225,50 @@ namespace GeekDesk.Control.UserControls.Config
prevKeyTemp = Key.None; prevKeyTemp = Key.None;
hotkeyFinished = true; hotkeyFinished = true;
if (main) switch (hkType)
{ {
case HotKeyType.Main:
if (MainWindow.hotKeyId != -1) if (MainWindow.hotKeyId != -1)
{ {
//Hotkey.UnRegist(new WindowInteropHelper(MainWindow.mainWindow).Handle, Hotkey.keymap[MainWindow.hotKeyId]); //Hotkey.UnRegist(new WindowInteropHelper(MainWindow.mainWindow).Handle, Hotkey.keymap[MainWindow.hotKeyId]);
GlobalHotKey.Dispose(MainWindow.hotKeyId); GlobalHotKey.Dispose(MainWindow.hotKeyId);
} }
MainWindow.RegisterHotKey(false); MainWindow.RegisterHotKey(false);
} break;
else case HotKeyType.ToDo:
{
if (MainWindow.toDoHotKeyId != -1) if (MainWindow.toDoHotKeyId != -1)
{ {
//Hotkey.UnRegist(new WindowInteropHelper(MainWindow.toDoInfoWindow).Handle, Hotkey.keymap[MainWindow.toDoHotKeyId]); //Hotkey.UnRegist(new WindowInteropHelper(MainWindow.toDoInfoWindow).Handle, Hotkey.keymap[MainWindow.toDoHotKeyId]);
GlobalHotKey.Dispose(MainWindow.toDoHotKeyId); GlobalHotKey.Dispose(MainWindow.toDoHotKeyId);
} }
MainWindow.RegisterCreateToDoHotKey(false); MainWindow.RegisterCreateToDoHotKey(false);
break;
case HotKeyType.ColorPicker:
if (MainWindow.colorPickerHotKeyId != -1)
{
//Hotkey.UnRegist(new WindowInteropHelper(MainWindow.toDoInfoWindow).Handle, Hotkey.keymap[MainWindow.toDoHotKeyId]);
GlobalHotKey.Dispose(MainWindow.colorPickerHotKeyId);
}
MainWindow.RegisterColorPickerHotKey(false);
break;
} }
}
}
}
private bool CheckIsEnable(HotKeyType hkType)
{
switch (hkType)
{
case HotKeyType.Main:
return true == appConfig.EnableAppHotKey;
case HotKeyType.ToDo:
return true == appConfig.EnableTodoHotKey;
case HotKeyType.ColorPicker:
return true == appConfig.EnableColorPickerHotKey;
} }
} return false;
} }
/// <summary> /// <summary>
@@ -295,5 +324,29 @@ namespace GeekDesk.Control.UserControls.Config
} }
} }
/// <summary>
/// 启用热键
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void EnableHotKey_Click(object sender, RoutedEventArgs e)
{
HotKeyType hkType = (HotKeyType)(sender as CheckBox).Tag;
switch (hkType)
{
case HotKeyType.Main:
if (true == appConfig.EnableAppHotKey)
MainWindow.RegisterHotKey(false);
break;
case HotKeyType.ToDo:
if (true == appConfig.EnableTodoHotKey)
MainWindow.RegisterCreateToDoHotKey(false);
break;
case HotKeyType.ColorPicker:
if (true == appConfig.EnableColorPickerHotKey)
MainWindow.RegisterColorPickerHotKey(false);
break;
}
}
} }
} }

View File

@@ -1,20 +1,9 @@
using GeekDesk.Constant; using GeekDesk.Constant;
using GeekDesk.Util; using GeekDesk.Util;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace GeekDesk.Control.UserControls.Config namespace GeekDesk.Control.UserControls.Config
{ {

View File

@@ -18,7 +18,7 @@
<cvt:Visibility2BooleanConverter x:Key="Visibility2BooleanConverter"/> <cvt:Visibility2BooleanConverter x:Key="Visibility2BooleanConverter"/>
</UserControl.Resources> </UserControl.Resources>
<Grid> <Grid>
<Grid MouseDown="DragMove" Background="Transparent"> <Grid Background="Transparent">
<StackPanel Margin="20" > <StackPanel Margin="20" >
<hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4"> <hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
<TextBlock Text="背景风格" VerticalAlignment="Center"/> <TextBlock Text="背景风格" VerticalAlignment="Center"/>
@@ -228,10 +228,10 @@
<SolidColorBrush Color="AliceBlue" Opacity="0.01"/> <SolidColorBrush Color="AliceBlue" Opacity="0.01"/>
</StackPanel.Background>--> </StackPanel.Background>-->
<hc:ColorPicker Name="MyColorPicker" <!--<hc:ColorPicker Name="MyColorPicker"
Canceled="MyColorPicker_Canceled" Canceled="MyColorPicker_Canceled"
Confirmed="MyColorPicker_Confirmed" Confirmed="MyColorPicker_Confirmed"
SelectedColorChanged="MyColorPicker_SelectedColorChanged"/> SelectedColorChanged="MyColorPicker_SelectedColorChanged"/>-->
<!--</StackPanel>--> <!--</StackPanel>-->
</Grid> </Grid>

View File

@@ -1,50 +1,25 @@
using GeekDesk.Constant; using GeekDesk.Constant;
using GeekDesk.Control.Other; using GeekDesk.Control.Other;
using GeekDesk.Control.Windows;
using GeekDesk.Util; using GeekDesk.Util;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using Microsoft.Win32; using Microsoft.Win32;
using System; using System;
using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data; using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Effects;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
namespace GeekDesk.Control.UserControls.Config namespace GeekDesk.Control.UserControls.Config
{ {
enum ColorType
{
COLOR_1 = 1,
COLOR_2 = 2,
TEXT_COLOR = 3
}
/// <summary> /// <summary>
/// MotionControl.xaml 的交互逻辑 /// MotionControl.xaml 的交互逻辑
/// </summary> /// </summary>
public partial class ThemeControl : System.Windows.Controls.UserControl public partial class ThemeControl : System.Windows.Controls.UserControl
{ {
private static ColorType colorType;
private static AppConfig appConfig = MainWindow.appData.AppConfig; private static AppConfig appConfig = MainWindow.appData.AppConfig;
private System.Windows.Controls.Primitives.ToggleButton toggleButton = null;
public ThemeControl() public ThemeControl()
{ {
@@ -111,60 +86,9 @@ namespace GeekDesk.Control.UserControls.Config
private void ColorButton_Click(object sender, RoutedEventArgs e) private void ColorButton_Click(object sender, RoutedEventArgs e)
{ {
string tag = (sender as Button).Tag.ToString(); string tag = (sender as Button).Tag.ToString();
switch (tag) new MyColorPickerDialog(tag, "ConfigWindowDialog");
{
case "Color1":
colorType = ColorType.COLOR_1;break;
case "Color2":
colorType = ColorType.COLOR_2;break;
default:
colorType = ColorType.TEXT_COLOR;break;
}
MyColorPicker.Visibility = Visibility.Visible;
new ColorPickerWindow().Show();
} }
/// <summary>
/// 取消按钮事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void MyColorPicker_Canceled(object sender, EventArgs e)
{
MyColorPickerClose(sender);
}
private void MyColorPicker_Confirmed(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
{
MyColorPickerClose(sender);
}
private void MyColorPicker_SelectedColorChanged(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
{
SolidColorBrush scb = MyColorPicker.SelectedBrush;
switch (colorType)
{
case ColorType.COLOR_1:
appConfig.GradientBGParam.Color1 = scb.ToString();break;
case ColorType.COLOR_2:
appConfig.GradientBGParam.Color2 = scb.ToString(); break;
default:
appConfig.TextColor = scb.ToString();break;
}
}
/// <summary>
/// 移动窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void DragMove(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
{
Window.GetWindow(this).DragMove();
}
}
private void PreviewSlider_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) private void PreviewSlider_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{ {
@@ -174,6 +98,7 @@ namespace GeekDesk.Control.UserControls.Config
}; };
System.Threading.ThreadStart ts = new System.Threading.ThreadStart(cbu.CheckButtonUp); System.Threading.ThreadStart ts = new System.Threading.ThreadStart(cbu.CheckButtonUp);
System.Threading.Thread t = new System.Threading.Thread(ts); System.Threading.Thread t = new System.Threading.Thread(ts);
t.IsBackground = true;
t.Start(); t.Start();
} }
@@ -201,25 +126,6 @@ namespace GeekDesk.Control.UserControls.Config
} }
} }
private void MyColorPicker_Checked(object sender, RoutedEventArgs e)
{
toggleButton = e.OriginalSource as System.Windows.Controls.Primitives.ToggleButton;
}
private void MyColorPickerClose(object sender)
{
if (toggleButton != null && toggleButton.IsChecked == true)
{
HandyControl.Controls.ColorPicker cp = sender as HandyControl.Controls.ColorPicker;
const BindingFlags InstanceBindFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
Type type = cp.GetType();
toggleButton.IsChecked = false;
MethodInfo mi = type.GetMethod("ToggleButtonDropper_Click", InstanceBindFlags);
mi.Invoke(cp, new object[] { null, null });
}
MyColorPicker.Visibility = Visibility.Collapsed;
}
public void BGStyle_Changed(object sender, RoutedEventArgs e) public void BGStyle_Changed(object sender, RoutedEventArgs e)
{ {
@@ -228,7 +134,8 @@ namespace GeekDesk.Control.UserControls.Config
{ {
GradientBGConf.Visibility = Visibility.Collapsed; GradientBGConf.Visibility = Visibility.Collapsed;
ImgBGConf.Visibility = Visibility.Visible; ImgBGConf.Visibility = Visibility.Visible;
} else }
else
{ {
ImgBGConf.Visibility = Visibility.Collapsed; ImgBGConf.Visibility = Visibility.Collapsed;
GradientBGConf.Visibility = Visibility.Visible; GradientBGConf.Visibility = Visibility.Visible;
@@ -248,7 +155,7 @@ namespace GeekDesk.Control.UserControls.Config
private void SysBG_Click(object sender, RoutedEventArgs e) private void SysBG_Click(object sender, RoutedEventArgs e)
{ {
GradientBGDialog gbg = new GradientBGDialog(); GradientBGDialog gbg = new GradientBGDialog();
gbg.dialog = HandyControl.Controls.Dialog.Show(gbg, "SysBGDialog"); gbg.dialog = HandyControl.Controls.Dialog.Show(gbg, "ConfigWindowDialog");
} }
} }
} }

View File

@@ -1,18 +1,4 @@
using GeekDesk.ViewModel; using System.Windows.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace GeekDesk.Control.UserControls.IconFont namespace GeekDesk.Control.UserControls.IconFont
{ {

View File

@@ -1,7 +1,6 @@
using DraggAnimatedPanelExample; using DraggAnimatedPanelExample;
using GeekDesk.Constant; using GeekDesk.Constant;
using GeekDesk.Control.Windows; using GeekDesk.Control.Windows;
using GeekDesk.MyThread;
using GeekDesk.Util; using GeekDesk.Util;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using System; using System;
@@ -10,10 +9,8 @@ using System.Collections.ObjectModel;
using System.Threading; using System.Threading;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Threading;
namespace GeekDesk.Control.UserControls.PannelCard namespace GeekDesk.Control.UserControls.PannelCard
{ {
@@ -333,7 +330,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
{ {
if (appData.AppConfig.HoverMenu && !IS_EDIT) if (appData.AppConfig.HoverMenu && !IS_EDIT)
{ {
new Thread(() => Thread t = new Thread(() =>
{ {
Thread.Sleep(200); Thread.Sleep(200);
this.Dispatcher.Invoke(() => this.Dispatcher.Invoke(() =>
@@ -345,7 +342,9 @@ namespace GeekDesk.Control.UserControls.PannelCard
MenuListBox.SelectedIndex = index; MenuListBox.SelectedIndex = index;
} }
}); });
}).Start(); });
t.IsBackground = true;
t.Start();
} }
} }
@@ -356,7 +355,8 @@ namespace GeekDesk.Control.UserControls.PannelCard
/// <param name="e"></param> /// <param name="e"></param>
private void ListBoxItem_MouseDown(object sender, MouseButtonEventArgs e) private void ListBoxItem_MouseDown(object sender, MouseButtonEventArgs e)
{ {
if (RunTimeStatus.SEARCH_BOX_SHOW) { if (RunTimeStatus.SEARCH_BOX_SHOW)
{
MainWindow.mainWindow.HidedSearchBox(); MainWindow.mainWindow.HidedSearchBox();
} }
} }

View File

@@ -176,7 +176,7 @@
VirtualizingPanel.IsContainerVirtualizable="True" VirtualizingPanel.IsContainerVirtualizable="True"
> >
<UniformGrid x:Name="VerticalUFG"> <UniformGrid x:Name="VerticalUFG">
<hc:TransitioningContentControl TransitionMode="Fade"> <hc:TransitioningContentControl TransitionMode="Left2RightWithFade">
<ListBox ItemsSource="{Binding Source={StaticResource SearchIconList},Path=IconList}" <ListBox ItemsSource="{Binding Source={StaticResource SearchIconList},Path=IconList}"
BorderThickness="0" BorderThickness="0"
Padding="0,10,0,0" Padding="0,10,0,0"

View File

@@ -9,13 +9,11 @@ using System;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Text.RegularExpressions;
using System.Threading; using System.Threading;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media.Animation; using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
namespace GeekDesk.Control.UserControls.PannelCard namespace GeekDesk.Control.UserControls.PannelCard
{ {
@@ -422,12 +420,31 @@ namespace GeekDesk.Control.UserControls.PannelCard
double height = appData.AppConfig.ImageHeight; double height = appData.AppConfig.ImageHeight;
width += width * 0.15; width += width * 0.15;
height += height * 0.15; height += height * 0.15;
Thread t = new Thread(() =>
{
this.Dispatcher.BeginInvoke(new Action(() =>
{
ImgStoryBoard(sender, (int)width, (int)height, 1, true); ImgStoryBoard(sender, (int)width, (int)height, 1, true);
}));
});
t.IsBackground = true;
t.Start();
} }
private void StackPanel_MouseLeave(object sender, MouseEventArgs e) private void StackPanel_MouseLeave(object sender, MouseEventArgs e)
{ {
ImgStoryBoard(sender, appData.AppConfig.ImageWidth, appData.AppConfig.ImageHeight, 220);
Thread t = new Thread(() =>
{
this.Dispatcher.BeginInvoke(new Action(() =>
{
ImgStoryBoard(sender, appData.AppConfig.ImageWidth, appData.AppConfig.ImageHeight, 260);
}));
});
t.IsBackground = true;
t.Start();
} }
@@ -491,6 +508,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
{ {
ThreadStart ts = new ThreadStart(crs.Remove); ThreadStart ts = new ThreadStart(crs.Remove);
System.Threading.Thread t = new System.Threading.Thread(ts); System.Threading.Thread t = new System.Threading.Thread(ts);
t.IsBackground = true;
t.Start(); t.Start();
} }
else else

View File

@@ -1,20 +1,8 @@
using GeekDesk.Constant; using GeekDesk.Constant;
using GeekDesk.Util; using GeekDesk.Util;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace GeekDesk.Control.UserControls.SystemItem namespace GeekDesk.Control.UserControls.SystemItem
{ {
@@ -47,7 +35,8 @@ namespace GeekDesk.Control.UserControls.SystemItem
}; };
iconInfo.Content_NoWrite = iconInfo.Name_NoWrite iconInfo.Content_NoWrite = iconInfo.Name_NoWrite
+ "\n使用次数:" + iconInfo.Count; + "\n使用次数:" + iconInfo.Count;
} else }
else
{ {
//startupMenu or Store //startupMenu or Store
iconInfo = CommonCode.GetIconInfoByPath(thisInfo.LnkPath_NoWrite); iconInfo = CommonCode.GetIconInfoByPath(thisInfo.LnkPath_NoWrite);

View File

@@ -3,19 +3,10 @@ using GeekDesk.Util;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using HandyControl.Controls; using HandyControl.Controls;
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace GeekDesk.Control.UserControls.Backlog namespace GeekDesk.Control.UserControls.Backlog
{ {

View File

@@ -24,7 +24,7 @@
<DropShadowEffect BlurRadius="20" Direction="-90" Color="Gray" <DropShadowEffect BlurRadius="20" Direction="-90" Color="Gray"
RenderingBias="Quality" ShadowDepth="2"/> RenderingBias="Quality" ShadowDepth="2"/>
</Grid.Effect> </Grid.Effect>
<Grid hc:Dialog.Token="SysBGDialog"> <Grid hc:Dialog.Token="ConfigWindowDialog">
<hc:DialogContainer Margin="10"> <hc:DialogContainer Margin="10">
<Border Style="{StaticResource BorderBG}"> <Border Style="{StaticResource BorderBG}">
<Grid Background="Transparent"> <Grid Background="Transparent">
@@ -110,7 +110,7 @@
</hc:Card> </hc:Card>
<hc:ScrollViewer Grid.Row="0" Grid.Column="1" BorderThickness="0" Margin="0,5,1,5"> <hc:ScrollViewer Grid.Row="0" Grid.Column="1" BorderThickness="0" Margin="0,5,1,5">
<UniformGrid x:Name="UFG"> <UniformGrid x:Name="UFG">
<hc:TransitioningContentControl TransitionMode="Fade"> <hc:TransitioningContentControl TransitionMode="Left2RightWithFade">
<hc:Card x:Name="RightCard" BorderThickness="0" MouseDown="DragMove"> <hc:Card x:Name="RightCard" BorderThickness="0" MouseDown="DragMove">
<hc:Card.Background> <hc:Card.Background>
<SolidColorBrush Opacity="0"/> <SolidColorBrush Opacity="0"/>

View File

@@ -1,13 +1,7 @@
 using GeekDesk.Control.UserControls.Config;
using GeekDesk.Constant;
using GeekDesk.Control.UserControls;
using GeekDesk.Control.UserControls.Config;
using GeekDesk.Interface; using GeekDesk.Interface;
using GeekDesk.Util;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using HandyControl.Controls; using HandyControl.Controls;
using HandyControl.Data;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;

View File

@@ -0,0 +1,49 @@
<Window x:Class="GeekDesk.Control.Windows.GlobalColorPickerWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:GeekDesk.Control.Windows"
xmlns:hc="https://handyorg.github.io/handycontrol"
WindowStyle="None"
AllowsTransparency="True"
Background="Transparent"
KeyDown="OnKeyDown"
>
<Border CornerRadius="8"
Background="White"
Height="385"
Width="228">
<StackPanel>
<Border MouseDown="DragMove"
VerticalAlignment="Top"
CornerRadius="8,8,0,0"
Height="20"
Background="White"
>
<Button Width="18" Height="18"
hc:IconElement.Geometry="{StaticResource ErrorGeometry}"
Padding="0"
Background="Transparent"
Opacity="0.6"
Margin="0,0,5,0"
Click="Button_Click"
HorizontalAlignment="Right"
MouseEnter="Button_MouseEnter"
MouseLeave="Button_MouseLeave"
VerticalAlignment="Center">
</Button>
</Border>
<hc:ColorPicker HorizontalAlignment="Center"
VerticalAlignment="Bottom"
SelectedColorChanged="MyColorPicker_SelectedColorChanged"
x:Name="MyColorPicker"
Confirmed="MyColorPicker_Confirmed"
Canceled="MyColorPicker_Canceled"
ToggleButton.Checked="MyColorPicker_Checked"/>
</StackPanel>
</Border>
</Window>

View File

@@ -0,0 +1,108 @@
using GeekDesk.Interface;
using System;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
namespace GeekDesk.Control.Windows
{
/// <summary>
/// GlobalColorPickerWindow.xaml 的交互逻辑
/// </summary>
public partial class GlobalColorPickerWindow : IWindowCommon
{
PixelColorPickerWindow colorPickerWindow;
public GlobalColorPickerWindow()
{
this.Topmost = true;
InitializeComponent();
}
public void OnKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Escape)
{
this.DataContext = null;
this.Close();
}
}
/// <summary>
/// 取消按钮事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void MyColorPicker_Canceled(object sender, EventArgs e)
{
MyColorPickerClose();
}
private void MyColorPicker_Confirmed(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
{
Color c = MyColorPicker.SelectedBrush.Color;
Clipboard.SetData(DataFormats.Text, string.Format("#{0:X2}{1:X2}{2:X2}{3:X2}", c.A, c.R, c.G, c.B));
}
/// <summary>
/// 移动窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void DragMove(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
{
this.DragMove();
}
}
private void MyColorPicker_Checked(object sender, RoutedEventArgs e)
{
this.Hide();
colorPickerWindow = new PixelColorPickerWindow(MyColorPicker);
colorPickerWindow.Show();
}
private void MyColorPickerClose()
{
this.Close();
}
private static System.Windows.Window window = null;
public static void Show()
{
if (window == null || !window.Activate())
{
window = new GlobalColorPickerWindow();
}
window.Show();
Keyboard.Focus(window);
}
private void MyColorPicker_SelectedColorChanged(object sender, HandyControl.Data.FunctionEventArgs<Color> e)
{
Show();
}
private void Button_MouseEnter(object sender, MouseEventArgs e)
{
Button btn = sender as Button;
btn.Opacity = 1;
}
private void Button_MouseLeave(object sender, MouseEventArgs e)
{
Button btn = sender as Button;
btn.Opacity = 0.6;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
}
}

View File

@@ -0,0 +1,90 @@
<Window
x:Class="GeekDesk.Control.Windows.PixelColorPickerWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xml:lang="zh-CN"
WindowStyle="None"
AllowsTransparency="True"
PreviewMouseMove="Window_PreviewMouseMove"
MouseLeftButtonDown="Window_MouseLeftButtonDown"
MouseWheel="Window_MouseWheel"
>
<Window.Resources>
<Style x:Key="TextKey" TargetType="TextBlock">
<Setter Property="FontSize" Value="12"/>
</Style>
<Style x:Key="TextValue" TargetType="TextBlock">
<Setter Property="FontSize" Value="12"/>
<Setter Property="Margin" Value="10,0,0,0"/>
</Style>
</Window.Resources>
<Grid>
<Grid x:Name="DesktopBG">
<Grid.Background>
<ImageBrush Stretch="Fill"/>
</Grid.Background>
</Grid>
<Canvas HorizontalAlignment="Left" VerticalAlignment="Top" Background="Transparent">
<Canvas x:Name="ColorCanvas"
Width="185"
Height="160">
<Border Background="White"
CornerRadius="5"
>
<Grid>
<WrapPanel HorizontalAlignment="Center" Height="70" Margin="0,5,0,80">
<Border Width="70" Height="70"
BorderBrush="Black"
BorderThickness="1">
<Rectangle x:Name="PixelColor" StrokeThickness="0">
<Rectangle.Fill>
<SolidColorBrush />
</Rectangle.Fill>
</Rectangle>
</Border>
<Border x:Name="Pixel"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Width="70"
Height="70"
BorderBrush="Black"
BorderThickness="1"
Margin="20,0,0,0"
>
<Grid>
<Rectangle x:Name="PixelBG" StrokeThickness="0">
<Rectangle.Fill>
<VisualBrush ViewboxUnits="Absolute" Viewbox="0,0,20,20"
ViewportUnits="RelativeToBoundingBox" Viewport="0,0,1,1">
</VisualBrush>
</Rectangle.Fill>
</Rectangle>
<Border HorizontalAlignment="Center"
VerticalAlignment="Center"
Width="6" Height="6"
BorderBrush="White" BorderThickness="0.6">
<Border Width="4.5" Height="4.5" BorderBrush="Black" BorderThickness="0.6"/>
</Border>
</Grid>
</Border>
</WrapPanel>
<WrapPanel HorizontalAlignment="Center" Height="80" Margin="0,85,0,5">
<StackPanel Width="100" Height="80">
<TextBlock Text="RGB:" Style="{StaticResource TextKey}"/>
<TextBlock x:Name="PixelColor_RGB" Style="{StaticResource TextValue}"/>
<TextBlock Text="HTML:" Margin="0,5,0,0" Style="{StaticResource TextKey}"/>
<TextBlock x:Name="PixelColor_HTML" Style="{StaticResource TextValue}"/>
</StackPanel>
<StackPanel Width="65" Height="80" Margin="10,0,0,0">
<TextBlock x:Name="Pixel_XY" TextAlignment="Right"/>
</StackPanel>
</WrapPanel>
</Grid>
</Border>
</Canvas>
</Canvas>
</Grid>
</Window>

View File

@@ -0,0 +1,208 @@
using GeekDesk.Interface;
using GeekDesk.Util;
using HandyControl.Controls;
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
namespace GeekDesk.Control.Windows
{
/// <summary>
/// ColorPickerWindow.xaml 的交互逻辑
/// </summary>
public partial class PixelColorPickerWindow : IWindowCommon
{
private static int PIXEL_REC_LENGTH = 20;
private static readonly int MIN_LENGTH = 10;
private static readonly int MAX_LENGTH = 50;
private static System.Drawing.Bitmap bgBitmap;
private readonly ColorPicker colorPicker;
public PixelColorPickerWindow(ColorPicker colorPicker)
{
InitializeComponent();
this.colorPicker = colorPicker;
ColorPickerWindow_Init();
}
private void ColorPickerWindow_Init()
{
this.WindowState = WindowState.Normal;//还原窗口(非最小化和最大化)
this.Width = SystemParameters.VirtualScreenWidth;
this.Height = SystemParameters.VirtualScreenHeight;
this.Left = SystemParameters.VirtualScreenLeft;
this.Top = SystemParameters.VirtualScreenTop;
DesktopBG.Width = this.Width;
DesktopBG.Height = this.Height;
this.Topmost = true;
bgBitmap = new System.Drawing.Bitmap(
(int)SystemParameters.VirtualScreenWidth,
(int)SystemParameters.VirtualScreenHeight,
System.Drawing.Imaging.PixelFormat.Format32bppArgb
);
using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bgBitmap))
{
g.CopyFromScreen(
0,
0,
0,
0,
bgBitmap.Size
);
}
BitmapSource bs = Imaging.CreateBitmapSourceFromHBitmap(
bgBitmap.GetHbitmap(),
IntPtr.Zero,
Int32Rect.Empty,
BitmapSizeOptions.FromEmptyOptions()
);
ImageBrush ib = (ImageBrush)DesktopBG.Background;
ib.ImageSource = bs;
VisualBrush b = (VisualBrush)PixelBG.Fill;
b.Visual = DesktopBG;
Mouse.OverrideCursor = Cursors.Cross;
SetPixelAbout(null);
}
[DllImport("gdi32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]
public static extern int BitBlt(IntPtr hDC, int x, int y, int nWidth, int nHeight, IntPtr hSrcDC, int xSrc, int ySrc, int dwRop);
public void OnKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Escape)
{
this.DataContext = null;
this.Close();
}
}
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
Point pos = e.MouseDevice.GetPosition(DesktopBG);
System.Drawing.Color colorD = bgBitmap.GetPixel((int)pos.X, (int)pos.Y);
colorPicker.SelectedBrush = new SolidColorBrush(Color.FromArgb(colorD.A, colorD.R, colorD.G, colorD.B));
DeleteObject(bgBitmap.GetHbitmap());
this.Close();
ClickColorPickerToggleButton(colorPicker);
}
public void ClickColorPickerToggleButton(ColorPicker colorPicker)
{
const BindingFlags InstanceBindFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
Type type = colorPicker.GetType();
FieldInfo fi = type.GetField("_toggleButtonDropper", InstanceBindFlags);
ToggleButton tb = (ToggleButton)fi.GetValue(colorPicker);
if (tb != null && tb.IsChecked == true)
{
tb.IsChecked = false;
MethodInfo mi = type.GetMethod("ToggleButtonDropper_Click", InstanceBindFlags);
mi.Invoke(colorPicker, new object[] { null, null });
}
}
private void Window_MouseEnter(object sender, MouseEventArgs e)
{
Mouse.OverrideCursor = Cursors.Cross;
}
private void Window_PreviewMouseMove(object sender, MouseEventArgs e)
{
SetPixelAbout(e);
}
[System.Runtime.InteropServices.DllImport("gdi32.dll")]
public static extern bool DeleteObject(IntPtr onj);
private void SetPixelAbout(MouseEventArgs e)
{
VisualBrush b = (VisualBrush)PixelBG.Fill;
Point pos;
if (e == null)
{
pos = MouseUtil.GetMousePosition();
}
else
{
pos = e.MouseDevice.GetPosition(DesktopBG);
}
Rect viewBox = b.Viewbox;
viewBox.Width = PIXEL_REC_LENGTH;
viewBox.Height = PIXEL_REC_LENGTH;
viewBox.X = pos.X - PIXEL_REC_LENGTH / 2;
viewBox.Y = pos.Y - PIXEL_REC_LENGTH / 2;
b.Viewbox = viewBox;
double x = pos.X + 10;
double y = pos.Y + 10;
if (x + ColorCanvas.Width > SystemParameters.VirtualScreenWidth)
{
x = pos.X - ColorCanvas.Width - 10;
}
if (y + ColorCanvas.Height > SystemParameters.VirtualScreenHeight)
{
y = pos.Y - ColorCanvas.Height - 10;
}
Canvas.SetLeft(ColorCanvas, x);
Canvas.SetTop(ColorCanvas, y);
System.Drawing.Color dColor = bgBitmap.GetPixel((int)pos.X, (int)pos.Y);
PixelColor_HTML.Text = "#" + dColor.Name.ToUpper();
PixelColor_RGB.Text = dColor.R + "," + dColor.G + "," + dColor.B;
Pixel_XY.Text = pos.X + "*" + pos.Y;
SolidColorBrush scb = (SolidColorBrush)PixelColor.Fill;
scb.Color = Color.FromArgb(dColor.A, dColor.R, dColor.G, dColor.B);
}
/// <summary>
/// 滚轮控制缩放区域
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Window_MouseWheel(object sender, MouseWheelEventArgs e)
{
if (e.Delta < 0 && PIXEL_REC_LENGTH < MAX_LENGTH)
{
//缩小
PIXEL_REC_LENGTH += 5;
}
else if (e.Delta > 0 && PIXEL_REC_LENGTH > MIN_LENGTH)
{
//放大
PIXEL_REC_LENGTH -= 5;
}
SetPixelAbout(e);
}
}
}

View File

@@ -1,5 +1,4 @@
using GeekDesk.Constant; using GeekDesk.Constant;
using GeekDesk.Control.Other;
using GeekDesk.Interface; using GeekDesk.Interface;
using GeekDesk.Util; using GeekDesk.Util;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
@@ -8,13 +7,10 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing;
using System.IO; using System.IO;
using System.Resources;
using System.Threading; using System.Threading;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using static GeekDesk.Util.ShowWindowFollowMouse; using static GeekDesk.Util.ShowWindowFollowMouse;
@@ -85,7 +81,8 @@ namespace GeekDesk.Control.Windows
IsBackground = true IsBackground = true
}; };
t.Start(); t.Start();
} else }
else
{ {
StartMenuLoading.Visibility = Visibility.Collapsed; StartMenuLoading.Visibility = Visibility.Collapsed;
vm.IconInfos = startMenuIcons; vm.IconInfos = startMenuIcons;
@@ -109,7 +106,8 @@ namespace GeekDesk.Control.Windows
vm.IconInfos = null; vm.IconInfos = null;
systemIcons = GetSysteIconInfos(); systemIcons = GetSysteIconInfos();
vm.IconInfos = systemIcons; vm.IconInfos = systemIcons;
} else }
else
{ {
vm.IconInfos = systemIcons; vm.IconInfos = systemIcons;
} }
@@ -161,7 +159,8 @@ namespace GeekDesk.Control.Windows
if (filePaths == null || filePaths.Length == 0) if (filePaths == null || filePaths.Length == 0)
{ {
dirPaths.CopyTo(paths, 0); dirPaths.CopyTo(paths, 0);
} else }
else
{ {
dirPaths.CopyTo(paths, filePaths.Length - 1); dirPaths.CopyTo(paths, filePaths.Length - 1);
} }

View File

@@ -5,18 +5,9 @@ using GeekDesk.ViewModel;
using HandyControl.Controls; using HandyControl.Controls;
using Quartz; using Quartz;
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace GeekDesk.Control.Windows namespace GeekDesk.Control.Windows
{ {
@@ -42,7 +33,8 @@ namespace GeekDesk.Control.Windows
DateTime time = DateTime.Now.AddMinutes(10); DateTime time = DateTime.Now.AddMinutes(10);
ExeTime.SelectedDateTime = time; ExeTime.SelectedDateTime = time;
SetTimePanel.Visibility = Visibility.Visible; SetTimePanel.Visibility = Visibility.Visible;
this.DataContext = new ToDoInfo { this.DataContext = new ToDoInfo
{
ExeTime = time.ToString("yyyy-MM-dd HH:mm:ss") ExeTime = time.ToString("yyyy-MM-dd HH:mm:ss")
}; };
} }
@@ -97,7 +89,8 @@ namespace GeekDesk.Control.Windows
{ {
Growl.Warning("任务标题不能为空!"); Growl.Warning("任务标题不能为空!");
return; return;
} else }
else
{ {
if (SetTimePanel.Visibility == Visibility.Visible) if (SetTimePanel.Visibility == Visibility.Visible)
{ {
@@ -117,7 +110,9 @@ namespace GeekDesk.Control.Windows
return; return;
} }
execTime = ExeTime.Text; execTime = ExeTime.Text;
} else { }
else
{
execType = TodoTaskExecType.CRON; execType = TodoTaskExecType.CRON;
if (Cron.Text.Trim() == "") if (Cron.Text.Trim() == "")
{ {
@@ -128,7 +123,8 @@ namespace GeekDesk.Control.Windows
{ {
bool isValid = CronExpression.IsValidExpression(Cron.Text); bool isValid = CronExpression.IsValidExpression(Cron.Text);
if (!isValid) throw new Exception(); if (!isValid) throw new Exception();
} catch (Exception) }
catch (Exception)
{ {
Growl.Warning("请输入正确的Cron表达式!"); Growl.Warning("请输入正确的Cron表达式!");
return; return;
@@ -155,7 +151,8 @@ namespace GeekDesk.Control.Windows
if (appData.HiToDoList.Contains(tdi)) if (appData.HiToDoList.Contains(tdi))
{ {
appData.HiToDoList.Remove(tdi); appData.HiToDoList.Remove(tdi);
} else if (appData.ToDoList.Contains(tdi)) }
else if (appData.ToDoList.Contains(tdi))
{ {
appData.ToDoList.Remove(tdi); appData.ToDoList.Remove(tdi);
} }
@@ -175,7 +172,8 @@ namespace GeekDesk.Control.Windows
int h = minutes / 60; int h = minutes / 60;
Growl.SuccessGlobal("设置待办任务成功, 系统将在 " + h + " 小时零 " + m + " 分钟后提醒您!"); Growl.SuccessGlobal("设置待办任务成功, 系统将在 " + h + " 小时零 " + m + " 分钟后提醒您!");
} else }
else
{ {
Growl.SuccessGlobal("设置待办任务成功, 系统将在 " + minutes + " 分钟后提醒您!"); Growl.SuccessGlobal("设置待办任务成功, 系统将在 " + minutes + " 分钟后提醒您!");
} }
@@ -202,7 +200,8 @@ namespace GeekDesk.Control.Windows
{ {
window = new ToDoInfoWindow(); window = new ToDoInfoWindow();
window.Show(); window.Show();
} else }
else
{ {
window.Close(); window.Close();
} }

View File

@@ -2,20 +2,8 @@
using GeekDesk.Interface; using GeekDesk.Interface;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using HandyControl.Controls; using HandyControl.Controls;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace GeekDesk.Control.Windows namespace GeekDesk.Control.Windows
{ {

View File

@@ -4,20 +4,10 @@ using GeekDesk.Util;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System; using System;
using System.Collections.Generic;
using System.Configuration; using System.Configuration;
using System.Diagnostics; using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace GeekDesk.Control.Windows namespace GeekDesk.Control.Windows
{ {

View File

@@ -1,10 +1,6 @@
using GeekDesk.Constant; using GeekDesk.Constant;
using System; using System;
using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data; using System.Windows.Data;
namespace GeekDesk.Converts namespace GeekDesk.Converts

View File

@@ -1,9 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Data; using System.Windows.Data;

View File

@@ -1,10 +1,6 @@
using GeekDesk.Constant; using GeekDesk.Constant;
using System; using System;
using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data; using System.Windows.Data;
namespace GeekDesk.Converts namespace GeekDesk.Converts

View File

@@ -1,9 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Data; using System.Windows.Data;

View File

@@ -1,10 +1,5 @@
using GeekDesk.Constant; using System;
using System;
using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data; using System.Windows.Data;
namespace GeekDesk.Converts namespace GeekDesk.Converts
@@ -17,7 +12,8 @@ namespace GeekDesk.Converts
if (menuIndex == -1) if (menuIndex == -1)
{ {
return ""; return "";
} else }
else
{ {
string type = parameter.ToString(); string type = parameter.ToString();
if ("1".Equals(type)) if ("1".Equals(type))

View File

@@ -1,9 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data; using System.Windows.Data;
namespace GeekDesk.Converts namespace GeekDesk.Converts

View File

@@ -1,10 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data; using System.Windows.Data;
namespace GeekDesk.Converts namespace GeekDesk.Converts
@@ -18,7 +13,8 @@ namespace GeekDesk.Converts
{ {
double menuLeftWidth = double.Parse(value.ToString()); double menuLeftWidth = double.Parse(value.ToString());
return MainWindow.mainWindow.Width - menuLeftWidth; return MainWindow.mainWindow.Width - menuLeftWidth;
} else }
else
{ {
double menuLeftWidth = double.Parse(value.ToString()); double menuLeftWidth = double.Parse(value.ToString());
return (MainWindow.mainWindow.Width - menuLeftWidth) / 2; return (MainWindow.mainWindow.Width - menuLeftWidth) / 2;

View File

@@ -1,10 +1,6 @@
using GeekDesk.Constant; using GeekDesk.Constant;
using System; using System;
using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data; using System.Windows.Data;
namespace GeekDesk.Converts namespace GeekDesk.Converts

View File

@@ -1,10 +1,5 @@
using GeekDesk.Constant; using System;
using System;
using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data; using System.Windows.Data;
namespace GeekDesk.Converts namespace GeekDesk.Converts
@@ -17,7 +12,8 @@ namespace GeekDesk.Converts
if (parameter == null) if (parameter == null)
{ {
return value.ToString(); return value.ToString();
} else }
else
{ {
string val = value.ToString(); string val = value.ToString();
string param = parameter.ToString(); string param = parameter.ToString();

View File

@@ -1,10 +1,6 @@
using GeekDesk.Constant; using GeekDesk.Constant;
using System; using System;
using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data; using System.Windows.Data;
namespace GeekDesk.Converts namespace GeekDesk.Converts

View File

@@ -1,10 +1,6 @@
using GeekDesk.Constant; using GeekDesk.Constant;
using System; using System;
using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data; using System.Windows.Data;
namespace GeekDesk.Converts namespace GeekDesk.Converts

View File

@@ -1,9 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Data; using System.Windows.Data;
@@ -16,7 +12,8 @@ namespace GeekDesk.Converts
if ((Visibility)value == Visibility.Visible) if ((Visibility)value == Visibility.Visible)
{ {
return true; return true;
} else }
else
{ {
return false; return false;
} }
@@ -27,7 +24,8 @@ namespace GeekDesk.Converts
if ((bool)value) if ((bool)value)
{ {
return Visibility.Visible; return Visibility.Visible;
} else }
else
{ {
return Visibility.Collapsed; return Visibility.Collapsed;
} }

View File

@@ -15,6 +15,21 @@
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic> <Deterministic>true</Deterministic>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
@@ -127,12 +142,14 @@
<Compile Include="Command\DelegateCommandBase.cs" /> <Compile Include="Command\DelegateCommandBase.cs" />
<Compile Include="Constant\AppHideType.cs" /> <Compile Include="Constant\AppHideType.cs" />
<Compile Include="Constant\Constants.cs" /> <Compile Include="Constant\Constants.cs" />
<Compile Include="Constant\HotKeyType.cs" />
<Compile Include="Constant\IconType.cs" /> <Compile Include="Constant\IconType.cs" />
<Compile Include="Constant\CommonEnum.cs" /> <Compile Include="Constant\CommonEnum.cs" />
<Compile Include="Constant\IconStartType.cs" /> <Compile Include="Constant\IconStartType.cs" />
<Compile Include="Constant\RunTimeStatus.cs" /> <Compile Include="Constant\RunTimeStatus.cs" />
<Compile Include="Constant\SortType.cs" /> <Compile Include="Constant\SortType.cs" />
<Compile Include="Constant\TodoTaskExecType.cs" /> <Compile Include="Constant\TodoTaskExecType.cs" />
<Compile Include="Constant\BGStyle.cs" />
<Compile Include="Constant\UpdateType.cs" /> <Compile Include="Constant\UpdateType.cs" />
<Compile Include="Control\Other\BacklogNotificatin.xaml.cs"> <Compile Include="Control\Other\BacklogNotificatin.xaml.cs">
<DependentUpon>BacklogNotificatin.xaml</DependentUpon> <DependentUpon>BacklogNotificatin.xaml</DependentUpon>
@@ -140,6 +157,12 @@
<Compile Include="Control\Other\CustomIconUrlDialog.xaml.cs"> <Compile Include="Control\Other\CustomIconUrlDialog.xaml.cs">
<DependentUpon>CustomIconUrlDialog.xaml</DependentUpon> <DependentUpon>CustomIconUrlDialog.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Control\Other\GradientBGDialog.xaml.cs">
<DependentUpon>GradientBGDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Control\Other\MyColorPickerDialog.xaml.cs">
<DependentUpon>MyColorPickerDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Control\Other\IconInfoUrlDialog.xaml.cs"> <Compile Include="Control\Other\IconInfoUrlDialog.xaml.cs">
<DependentUpon>IconInfoUrlDialog.xaml</DependentUpon> <DependentUpon>IconInfoUrlDialog.xaml</DependentUpon>
</Compile> </Compile>
@@ -155,6 +178,12 @@
<Compile Include="Control\UserControls\IconFont\IconPannel.xaml.cs"> <Compile Include="Control\UserControls\IconFont\IconPannel.xaml.cs">
<DependentUpon>IconPannel.xaml</DependentUpon> <DependentUpon>IconPannel.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Control\Windows\GlobalColorPickerWindow.xaml.cs">
<DependentUpon>GlobalColorPickerWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Control\Windows\PixelColorPickerWindow.xaml.cs">
<DependentUpon>PixelColorPickerWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Control\Windows\SystemItemWindow.xaml.cs"> <Compile Include="Control\Windows\SystemItemWindow.xaml.cs">
<DependentUpon>SystemItemWindow.xaml</DependentUpon> <DependentUpon>SystemItemWindow.xaml</DependentUpon>
</Compile> </Compile>
@@ -191,6 +220,7 @@
<Compile Include="Control\Windows\UpdateWindow.xaml.cs"> <Compile Include="Control\Windows\UpdateWindow.xaml.cs">
<DependentUpon>UpdateWindow.xaml</DependentUpon> <DependentUpon>UpdateWindow.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Converts\StringAppendConvert.cs" />
<Compile Include="Converts\DoubleToGridLength.cs" /> <Compile Include="Converts\DoubleToGridLength.cs" />
<Compile Include="Converts\MenuInfoConvert.cs" /> <Compile Include="Converts\MenuInfoConvert.cs" />
<Compile Include="Converts\SearchResWidth.cs" /> <Compile Include="Converts\SearchResWidth.cs" />
@@ -198,7 +228,9 @@
<Compile Include="Converts\TodoTaskExecConvert.cs" /> <Compile Include="Converts\TodoTaskExecConvert.cs" />
<Compile Include="Converts\IntToCornerRadius.cs" /> <Compile Include="Converts\IntToCornerRadius.cs" />
<Compile Include="Converts\OpcityConvert.cs" /> <Compile Include="Converts\OpcityConvert.cs" />
<Compile Include="Converts\BGStyleConvert.cs" />
<Compile Include="Converts\UpdateTypeConvert.cs" /> <Compile Include="Converts\UpdateTypeConvert.cs" />
<Compile Include="Converts\Visibility2BooleanConverter.cs" />
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.cs" /> <Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.cs" />
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.Drag.cs" /> <Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.Drag.cs" />
<Compile Include="Converts\HideTypeConvert.cs" /> <Compile Include="Converts\HideTypeConvert.cs" />
@@ -208,6 +240,8 @@
<Compile Include="MyThread\DispatcherBuild.cs" /> <Compile Include="MyThread\DispatcherBuild.cs" />
<Compile Include="MyThread\UpdateThread.cs" /> <Compile Include="MyThread\UpdateThread.cs" />
<Compile Include="Util\AeroGlassHelper.cs" /> <Compile Include="Util\AeroGlassHelper.cs" />
<Compile Include="Util\BGSettingUtil.cs" />
<Compile Include="Util\ColorUtil.cs" />
<Compile Include="Util\GlobalHotKey.cs" /> <Compile Include="Util\GlobalHotKey.cs" />
<Compile Include="Util\CommonCode.cs" /> <Compile Include="Util\CommonCode.cs" />
<Compile Include="Util\FileIcon.cs" /> <Compile Include="Util\FileIcon.cs" />
@@ -225,6 +259,9 @@
<Compile Include="Util\SvgToGeometry.cs" /> <Compile Include="Util\SvgToGeometry.cs" />
<Compile Include="ViewModel\AppConfig.cs" /> <Compile Include="ViewModel\AppConfig.cs" />
<Compile Include="ViewModel\AppData.cs" /> <Compile Include="ViewModel\AppData.cs" />
<Compile Include="ViewModel\GradientBGParam.cs" />
<Compile Include="ViewModel\CPDataContext.cs" />
<Compile Include="ViewModel\Temp\GradientBGParamList.cs" />
<Compile Include="ViewModel\Temp\SearchIconList.cs" /> <Compile Include="ViewModel\Temp\SearchIconList.cs" />
<Compile Include="ViewModel\ToDoInfo.cs" /> <Compile Include="ViewModel\ToDoInfo.cs" />
<Compile Include="ViewModel\IconfontInfo.cs" /> <Compile Include="ViewModel\IconfontInfo.cs" />
@@ -238,6 +275,14 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Include="Control\Other\GradientBGDialog.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Control\Other\MyColorPickerDialog.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Control\Other\IconInfoUrlDialog.xaml"> <Page Include="Control\Other\IconInfoUrlDialog.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
@@ -258,6 +303,14 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Control\Windows\GlobalColorPickerWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Control\Windows\PixelColorPickerWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Control\Windows\SystemItemWindow.xaml"> <Page Include="Control\Windows\SystemItemWindow.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
@@ -402,5 +455,17 @@
<Resource Include="Resource\Image\SystemIcon\RecycleBin.png" /> <Resource Include="Resource\Image\SystemIcon\RecycleBin.png" />
<Resource Include="Resource\Image\SystemIcon\Registry.png" /> <Resource Include="Resource\Image\SystemIcon\Registry.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 和 x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

View File

@@ -1,7 +1,7 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Blend for Visual Studio Version 16 # Visual Studio Version 17
VisualStudioVersion = 16.0.30907.101 VisualStudioVersion = 17.1.32319.34
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeekDesk", "GeekDesk.csproj", "{B4983CEC-2281-413C-8ECF-92EE0E40A713}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeekDesk", "GeekDesk.csproj", "{B4983CEC-2281-413C-8ECF-92EE0E40A713}"
EndProject EndProject

View File

@@ -1,10 +1,4 @@
using System; using System.Windows.Input;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
namespace GeekDesk.Interface namespace GeekDesk.Interface
{ {

View File

@@ -60,7 +60,7 @@
Focusable="True" Focusable="True"
> >
<hc:DialogContainer Focusable="True"> <hc:DialogContainer Focusable="True">
<!-- -1是为了解决圆角白线的问题-->
<Border x:Name="BGBorder" <Border x:Name="BGBorder"
CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}" CornerRadius="{Binding AppConfig.PannelCornerRadius, Mode=TwoWay, Converter={StaticResource IntToCornerRadius}}"
BorderThickness="0" BorderThickness="0"
@@ -149,6 +149,7 @@
<hc:NotifyIcon.ContextMenu> <hc:NotifyIcon.ContextMenu>
<ContextMenu Width="130"> <ContextMenu Width="130">
<MenuItem Header="打开面板" Click="ShowApp"/> <MenuItem Header="打开面板" Click="ShowApp"/>
<MenuItem Header="拾色器" Click="ColorPicker"/>
<MenuItem Header="隐藏图标" Click="CloseBarIcon"/> <MenuItem Header="隐藏图标" Click="CloseBarIcon"/>
<MenuItem Header="待办" Click="BacklogMenuClick"/> <MenuItem Header="待办" Click="BacklogMenuClick"/>
<MenuItem Header="程序目录" Click="OpenThisDir"/> <MenuItem Header="程序目录" Click="OpenThisDir"/>

View File

@@ -2,23 +2,21 @@
using GeekDesk.Control.UserControls.Config; using GeekDesk.Control.UserControls.Config;
using GeekDesk.Control.Windows; using GeekDesk.Control.Windows;
using GeekDesk.Interface; using GeekDesk.Interface;
using GeekDesk.Task;
using GeekDesk.MyThread; using GeekDesk.MyThread;
using GeekDesk.Task;
using GeekDesk.Util; using GeekDesk.Util;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using GeekDesk.ViewModel.Temp;
using NPinyin;
using System; using System;
using System.Collections.ObjectModel;
using System.Diagnostics; using System.Diagnostics;
using System.Threading;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media.Animation; using System.Windows.Media.Animation;
using static GeekDesk.Util.ShowWindowFollowMouse; using static GeekDesk.Util.ShowWindowFollowMouse;
using System.Collections.ObjectModel;
using NPinyin;
using GeekDesk.ViewModel.Temp;
using System.Threading;
using DraggAnimatedPanelExample;
namespace GeekDesk namespace GeekDesk
{ {
@@ -33,6 +31,7 @@ namespace GeekDesk
public static ToDoInfoWindow toDoInfoWindow; public static ToDoInfoWindow toDoInfoWindow;
public static int hotKeyId = -1; public static int hotKeyId = -1;
public static int toDoHotKeyId = -1; public static int toDoHotKeyId = -1;
public static int colorPickerHotKeyId = -1;
public static MainWindow mainWindow; public static MainWindow mainWindow;
public MainWindow() public MainWindow()
{ {
@@ -153,8 +152,19 @@ namespace GeekDesk
BarIcon.Text = Constants.MY_NAME; BarIcon.Text = Constants.MY_NAME;
//注册热键 //注册热键
if (true == appData.AppConfig.EnableAppHotKey)
{
RegisterHotKey(true); RegisterHotKey(true);
}
if (true == appData.AppConfig.EnableTodoHotKey)
{
RegisterCreateToDoHotKey(true); RegisterCreateToDoHotKey(true);
}
if (true == appData.AppConfig.EnableColorPickerHotKey)
{
RegisterColorPickerHotKey(true);
}
//注册自启动 //注册自启动
if (!appData.AppConfig.SelfStartUped && !Constants.DEV) if (!appData.AppConfig.SelfStartUped && !Constants.DEV)
@@ -196,12 +206,12 @@ namespace GeekDesk
} }
} }
}); });
}
if (!first) if (!first)
{ {
HandyControl.Controls.Growl.Success("GeekDesk快捷键注册成功(" + appData.AppConfig.HotkeyStr + ")!", "HotKeyGrowl"); HandyControl.Controls.Growl.Success("GeekDesk快捷键注册成功(" + appData.AppConfig.HotkeyStr + ")!", "HotKeyGrowl");
} }
} }
}
catch (Exception) catch (Exception)
{ {
if (first) if (first)
@@ -236,12 +246,13 @@ namespace GeekDesk
ToDoInfoWindow.ShowOrHide(); ToDoInfoWindow.ShowOrHide();
} }
}); });
}
if (!first) if (!first)
{ {
HandyControl.Controls.Growl.Success("新建待办任务快捷键注册成功(" + appData.AppConfig.ToDoHotkeyStr + ")!", "HotKeyGrowl"); HandyControl.Controls.Growl.Success("新建待办任务快捷键注册成功(" + appData.AppConfig.ToDoHotkeyStr + ")!", "HotKeyGrowl");
} }
} }
}
catch (Exception) catch (Exception)
{ {
if (first) if (first)
@@ -255,6 +266,43 @@ namespace GeekDesk
} }
} }
/// <summary>
/// 注册新建待办的热键
/// </summary>
public static void RegisterColorPickerHotKey(bool first)
{
try
{
if (appData.AppConfig.ColorPickerHotkeyModifiers != 0)
{
//加载完毕注册热键
colorPickerHotKeyId = GlobalHotKey.RegisterHotKey(appData.AppConfig.ColorPickerHotkeyModifiers, appData.AppConfig.ColorPickerHotkey, () =>
{
if (MotionControl.hotkeyFinished)
{
GlobalColorPickerWindow.Show();
}
});
if (!first)
{
HandyControl.Controls.Growl.Success("拾色器快捷键注册成功(" + appData.AppConfig.ColorPickerHotkeyStr + ")!", "HotKeyGrowl");
}
}
}
catch (Exception)
{
if (first)
{
HandyControl.Controls.Growl.WarningGlobal("拾色器快捷键已被其它程序占用(" + appData.AppConfig.ColorPickerHotkeyStr + ")!");
}
else
{
HandyControl.Controls.Growl.Warning("拾色器快捷键已被其它程序占用(" + appData.AppConfig.ColorPickerHotkeyStr + ")!", "HotKeyGrowl");
}
}
}
/// <summary> /// <summary>
/// 重置窗体大小 写入缓存 /// 重置窗体大小 写入缓存
@@ -384,20 +432,23 @@ namespace GeekDesk
if (RunTimeStatus.SEARCH_BOX_SHOW) if (RunTimeStatus.SEARCH_BOX_SHOW)
{ {
mainWindow.HidedSearchBox(); mainWindow.HidedSearchBox();
new Thread(() => Thread t = new Thread(() =>
{ {
Thread.Sleep(100); Thread.Sleep(100);
App.Current.Dispatcher.BeginInvoke(new Action(() => App.Current.Dispatcher.BeginInvoke(new Action(() =>
{ {
FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed); FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
})); }));
}).Start(); });
t.IsBackground = true;
t.Start();
} }
else else
{ {
FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed); FadeStoryBoard(0, (int)CommonEnum.WINDOW_ANIMATION_TIME, Visibility.Collapsed);
} }
} else }
else
{ {
ShowApp(); ShowApp();
} }
@@ -630,5 +681,10 @@ namespace GeekDesk
//防止延迟贴边隐藏 //防止延迟贴边隐藏
RunTimeStatus.MARGIN_HIDE_AND_OTHER_SHOW = false; RunTimeStatus.MARGIN_HIDE_AND_OTHER_SHOW = false;
} }
private void ColorPicker(object sender, RoutedEventArgs e)
{
GlobalColorPickerWindow.Show();
}
} }
} }

View File

@@ -1,9 +1,4 @@
using System; using System.Threading;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Threading; using System.Windows.Threading;
namespace GeekDesk.MyThread namespace GeekDesk.MyThread
@@ -25,6 +20,7 @@ namespace GeekDesk.MyThread
manualResetEvent.Set(); manualResetEvent.Set();
Dispatcher.Run(); Dispatcher.Run();
}); });
thread.IsBackground = true;
thread.Start(); thread.Start();
manualResetEvent.WaitOne(); manualResetEvent.WaitOne();
manualResetEvent.Dispose(); manualResetEvent.Dispose();

View File

@@ -2,11 +2,6 @@
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using Gma.System.MouseKeyHook; using Gma.System.MouseKeyHook;
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Threading; using System.Windows.Threading;

View File

@@ -4,13 +4,8 @@ using GeekDesk.Util;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System; using System;
using System.Collections.Generic;
using System.Configuration; using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
using System.Windows;
namespace GeekDesk.MyThread namespace GeekDesk.MyThread
{ {
@@ -59,7 +54,8 @@ namespace GeekDesk.MyThread
})); }));
} }
} }
} catch (Exception ex) }
catch (Exception ex)
{ {
LogUtil.WriteErrorLog(ex, "获取更新失败!"); LogUtil.WriteErrorLog(ex, "获取更新失败!");
} }

View File

@@ -1,16 +1,11 @@
using GeekDesk.Control; using GeekDesk.Control.Other;
using GeekDesk.Control.Other;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using HandyControl.Controls; using HandyControl.Controls;
using HandyControl.Data; using HandyControl.Data;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Timers; using System.Timers;
namespace GeekDesk.Task namespace GeekDesk.Task

View File

@@ -1,13 +1,8 @@
using GeekDesk.Constant; using GeekDesk.Constant;
using GeekDesk.ViewModel; using GeekDesk.ViewModel;
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Effects; using System.Windows.Media.Effects;

15
Util/ColorUtil.cs Normal file
View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.Util
{
public class ColorUtil
{
}
}

View File

@@ -1,5 +1,4 @@
using IWshRuntimeLibrary; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;

View File

@@ -1,11 +1,8 @@
using IWshRuntimeLibrary; using IWshRuntimeLibrary;
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace GeekDesk.Util namespace GeekDesk.Util
{ {

View File

@@ -53,7 +53,8 @@ namespace GeekDesk.Util
UnregisterHotKey(handleTemp[id].Handle, id); UnregisterHotKey(handleTemp[id].Handle, id);
GlobalHotKey.handleTemp[id].Dispose(); GlobalHotKey.handleTemp[id].Dispose();
GlobalHotKey.handleTemp.Remove(id); GlobalHotKey.handleTemp.Remove(id);
} catch }
catch
{ {
//nothing //nothing
} }

View File

@@ -1,10 +1,6 @@
using System; using System.IO;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net; using System.Net;
using System.Text; using System.Text;
using System.Web;
namespace GeekDesk.Util namespace GeekDesk.Util
{ {

View File

@@ -1,12 +1,9 @@
using GeekDesk.Constant; using GeekDesk.Constant;
using System; using System;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Interop;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;

View File

@@ -1,10 +1,7 @@
using GeekDesk.Constant; using GeekDesk.Constant;
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.Util namespace GeekDesk.Util
{ {
@@ -48,7 +45,8 @@ namespace GeekDesk.Util
fs.Write(buffer, 0, buffer.Length); fs.Write(buffer, 0, buffer.Length);
} }
} }
} catch }
catch
{ {
} }
@@ -58,7 +56,8 @@ namespace GeekDesk.Util
public static void WriteLog(string msg) public static void WriteLog(string msg)
{ {
try { try
{
using (FileStream fs = File.Open(Constants.LOG_FILE_PATH, FileMode.OpenOrCreate, FileAccess.ReadWrite)) using (FileStream fs = File.Open(Constants.LOG_FILE_PATH, FileMode.OpenOrCreate, FileAccess.ReadWrite))
{ {
fs.Seek(0, SeekOrigin.End); fs.Seek(0, SeekOrigin.End);
@@ -68,7 +67,8 @@ namespace GeekDesk.Util
buffer = Encoding.Default.GetBytes(DateTime.Now.ToString() + msg + "\r\n"); buffer = Encoding.Default.GetBytes(DateTime.Now.ToString() + msg + "\r\n");
fs.Write(buffer, 0, buffer.Length); fs.Write(buffer, 0, buffer.Length);
} }
} catch { } }
catch { }
} }

View File

@@ -1,9 +1,8 @@
using System; using GeekDesk.Constant;
using System;
using System.Windows.Forms;
using System.Windows; using System.Windows;
using System.Windows.Forms;
using System.Windows.Media.Animation; using System.Windows.Media.Animation;
using GeekDesk.Constant;
namespace GeekDesk.Util namespace GeekDesk.Util
{ {
@@ -302,12 +301,14 @@ namespace GeekDesk.Util
public static void WaitHide(int waitTime) public static void WaitHide(int waitTime)
{ {
new System.Threading.Thread(()=> System.Threading.Thread t = new System.Threading.Thread(() =>
{ {
System.Threading.Thread.Sleep(waitTime); System.Threading.Thread.Sleep(waitTime);
//修改状态为false 继续执行贴边隐藏 //修改状态为false 继续执行贴边隐藏
RunTimeStatus.MARGIN_HIDE_AND_OTHER_SHOW = false; RunTimeStatus.MARGIN_HIDE_AND_OTHER_SHOW = false;
}).Start(); });
t.IsBackground = true;
t.Start();
} }

View File

@@ -1,9 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
namespace GeekDesk.Util namespace GeekDesk.Util

View File

@@ -1,9 +1,5 @@
using Microsoft.Win32; using Microsoft.Win32;
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.Util namespace GeekDesk.Util
{ {

View File

@@ -1,11 +1,9 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Drawing; using System.Drawing;
using System.Windows.Forms;
using System.IO; using System.IO;
using System.Security.Permissions; using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
namespace GeekDesk.Util namespace GeekDesk.Util
{ {

View File

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

View File

@@ -4,10 +4,8 @@ using Newtonsoft.Json.Linq;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Xml; using System.Xml;

View File

@@ -48,7 +48,12 @@ namespace GeekDesk.ViewModel
private string toDoHotkeyStr = "Ctrl + Shift + Q"; //待办任务快捷键 private string toDoHotkeyStr = "Ctrl + Shift + Q"; //待办任务快捷键
private HotkeyModifiers toDoHotkeyModifiers; //待办任务快捷键 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 customIconUrl; //自定义图标url
private string customIconJsonUrl; //自定义图标json信息url private string customIconJsonUrl; //自定义图标json信息url
@@ -81,8 +86,54 @@ namespace GeekDesk.ViewModel
private GradientBGParam gradientBGParam = null; //渐变背景参数 private GradientBGParam gradientBGParam = null; //渐变背景参数
private bool? enableAppHotKey = true; //可能为null
private bool? enableTodoHotKey = true; //可能为null
private bool enableColorPickerHotKey; //新增 默认为false 不需要考虑null值
#region GetSet #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 public Visibility TitleLogoVisible
{ {
@@ -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 public Key ToDoHotkey
{ {
get get
@@ -382,7 +474,7 @@ namespace GeekDesk.ViewModel
//兼容老版本 //兼容老版本
if (toDoHotkey == Key.None) if (toDoHotkey == Key.None)
{ {
toDoHotkey = Key.Q; toDoHotkey = Key.E;
} }
return toDoHotkey; return toDoHotkey;
} }

View File

@@ -1,6 +1,5 @@
using GeekDesk.Util; using GeekDesk.Util;
using System; using System;
using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel; 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 GeekDesk.Util;
using System; using System;
using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.ViewModel namespace GeekDesk.ViewModel
{ {
@@ -19,7 +15,8 @@ namespace GeekDesk.ViewModel
public GradientBGParam() { } public GradientBGParam() { }
public GradientBGParam(string name, string color1, string color2) { public GradientBGParam(string name, string color1, string color2)
{
this.name = name; this.name = name;
this.color1 = color1; this.color1 = color1;
this.color2 = color2; this.color2 = color2;

View File

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

View File

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

View File

@@ -94,7 +94,8 @@ namespace GeekDesk.ViewModel
if (menuEdit == Visibility.Visible) if (menuEdit == Visibility.Visible)
{ {
NotMenuEdit = Visibility.Collapsed; NotMenuEdit = Visibility.Collapsed;
} else }
else
{ {
NotMenuEdit = Visibility.Visible; NotMenuEdit = Visibility.Visible;
} }

View File

@@ -1,10 +1,4 @@
using System; using System.Collections.ObjectModel;
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 namespace GeekDesk.ViewModel.Temp
{ {

View File

@@ -1,11 +1,7 @@
using GeekDesk.Constant; using GeekDesk.Constant;
using GeekDesk.Util; using GeekDesk.Util;
using System; using System;
using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeekDesk.ViewModel namespace GeekDesk.ViewModel
{ {