diff --git a/App.xaml b/App.xaml
index b47e702..1e6f819 100644
--- a/App.xaml
+++ b/App.xaml
@@ -12,6 +12,7 @@
+
diff --git a/Constant/Constants.cs b/Constant/Constants.cs
index c8e0b05..e956ca2 100644
--- a/Constant/Constants.cs
+++ b/Constant/Constants.cs
@@ -10,7 +10,7 @@ namespace GeekDesk.Constant
{
public static string APP_DIR = AppDomain.CurrentDomain.BaseDirectory.Trim();
- public static string MY_NAME = "GeekDesk";
+ public static string MY_NAME = "GeekDesk-D";
///
/// app数据文件路径
diff --git a/Control/Other/BacklogNotificatin.xaml b/Control/Other/BacklogNotificatin.xaml
index dc1c9d6..ba35f1a 100644
--- a/Control/Other/BacklogNotificatin.xaml
+++ b/Control/Other/BacklogNotificatin.xaml
@@ -32,7 +32,7 @@
-
+
diff --git a/Control/Other/CustomIconUrlDialog.xaml b/Control/Other/CustomIconUrlDialog.xaml
index fce78be..abcb6a4 100644
--- a/Control/Other/CustomIconUrlDialog.xaml
+++ b/Control/Other/CustomIconUrlDialog.xaml
@@ -5,7 +5,8 @@
CornerRadius="3"
Width="400"
Height="230"
- Opacity="0.95">
+ Opacity="0.95"
+ Style="{StaticResource BorderBG}">
-
-
-
-
+
@@ -42,10 +40,9 @@
/>
+ Style="{StaticResource Btn1}"/>
-
+
\ No newline at end of file
diff --git a/Control/Other/IconInfoDialog.xaml b/Control/Other/IconInfoDialog.xaml
index 6e64002..af45bde 100644
--- a/Control/Other/IconInfoDialog.xaml
+++ b/Control/Other/IconInfoDialog.xaml
@@ -4,34 +4,35 @@
xmlns:hc="https://handyorg.github.io/handycontrol"
CornerRadius="4"
Width="300"
- Height="300"
+ Height="340"
+ Style="{StaticResource BorderBG}"
>
-
-
-
-
-
-
+
+
+
+
-
-
+
+
-
+
-
-
+
+
@@ -40,11 +41,10 @@
-
-
-
+
+
+
-
-
+
\ No newline at end of file
diff --git a/Control/Other/IconInfoUrlDialog.xaml b/Control/Other/IconInfoUrlDialog.xaml
index a999be4..e585641 100644
--- a/Control/Other/IconInfoUrlDialog.xaml
+++ b/Control/Other/IconInfoUrlDialog.xaml
@@ -4,42 +4,43 @@
xmlns:hc="https://handyorg.github.io/handycontrol"
CornerRadius="4"
Width="300"
- Height="300"
+ Height="340"
+ Style="{StaticResource BorderBG}"
>
-
-
-
-
-
+
+
+
+
-
-
+
+
-
-
+
+
-
+
-
-
-
+
+
+
-
-
+
\ No newline at end of file
diff --git a/Control/UserControls/Config/MotionControl.xaml b/Control/UserControls/Config/MotionControl.xaml
index c574c76..30c8cc5 100644
--- a/Control/UserControls/Config/MotionControl.xaml
+++ b/Control/UserControls/Config/MotionControl.xaml
@@ -6,13 +6,16 @@
xmlns:cvt="clr-namespace:GeekDesk.Converts"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
- Background="AliceBlue"
+ Background="Transparent"
d:DesignHeight="300" d:DesignWidth="450">
-
+
+
+
@@ -37,6 +40,16 @@
+
+
+
+
+
+
+
+
+
+
@@ -101,7 +114,6 @@
KeyUp="HotKeyUp"
/>
-
diff --git a/Control/UserControls/Config/MotionControl.xaml.cs b/Control/UserControls/Config/MotionControl.xaml.cs
index 89e5caa..43f9a3b 100644
--- a/Control/UserControls/Config/MotionControl.xaml.cs
+++ b/Control/UserControls/Config/MotionControl.xaml.cs
@@ -30,7 +30,7 @@ namespace GeekDesk.Control.UserControls.Config
public partial class MotionControl : UserControl
{
public static bool hotkeyFinished = true; //热键设置结束
- private KeyEventArgs prevKeyTemp; //上一个按键
+ private Key prevKeyTemp = Key.None; //上一个按键
private readonly List keysTemp = new List();//存储一次快捷键集合
private readonly AppConfig appConfig = MainWindow.appData.AppConfig;
@@ -49,13 +49,19 @@ namespace GeekDesk.Control.UserControls.Config
{
string tag = (sender as TextBox).Tag.ToString();
+ Key downKey = e.Key;
+ if (downKey == Key.System)
+ {
+ downKey = e.SystemKey;
+ }
+
bool main = false;
if ("Main".Equals(tag))
{
main = true;
}
- if (!e.IsRepeat)
+ if (prevKeyTemp == Key.None || prevKeyTemp!=downKey)
{
if (hotkeyFinished)
{
@@ -71,25 +77,24 @@ namespace GeekDesk.Control.UserControls.Config
appConfig.ToDoHotkeyModifiers = 0;
}
hotkeyFinished = false;
-
}
//首次按下按键
if ((main && (appConfig.HotkeyStr == null || appConfig.HotkeyStr.Length == 0))
|| (!main && (appConfig.ToDoHotkeyStr == null || appConfig.ToDoHotkeyStr.Length == 0)))
{
- if (CheckModifierKeys(e))
+ if (CheckModifierKeys(downKey))
{
//辅助键
if (main)
{
- appConfig.HotkeyStr = GetKeyName(e);
- appConfig.HotkeyModifiers = GetModifierKeys(e);
+ appConfig.HotkeyStr = GetKeyName(downKey);
+ appConfig.HotkeyModifiers = GetModifierKeys(downKey);
} else
{
- appConfig.ToDoHotkeyStr = GetKeyName(e);
- appConfig.ToDoHotkeyModifiers = GetModifierKeys(e);
+ appConfig.ToDoHotkeyStr = GetKeyName(downKey);
+ appConfig.ToDoHotkeyModifiers = GetModifierKeys(downKey);
}
- prevKeyTemp = e;
+ prevKeyTemp = downKey;
keysTemp.Add(e);
}
}
@@ -97,44 +102,43 @@ namespace GeekDesk.Control.UserControls.Config
{
//非首次按下 需要判断前一个键值是否为辅助键
if (CheckModifierKeys(prevKeyTemp)
- && ((e.Key >= Key.A && e.Key <= Key.Z)
- || (e.Key >= Key.F1 && e.Key <= Key.F12)
- || (e.Key >= Key.D0 && e.Key <= Key.D9)))
+ && ((downKey >= Key.A && downKey <= Key.Z)
+ || (downKey >= Key.F1 && downKey <= Key.F12)
+ || (downKey >= Key.D0 && downKey <= Key.D9)))
{
if (main)
{
- appConfig.Hotkey = e.Key;
- appConfig.HotkeyStr += e.Key.ToString();
+ appConfig.Hotkey = downKey;
+ appConfig.HotkeyStr += downKey.ToString();
} else
{
- appConfig.ToDoHotkey = e.Key;
- appConfig.ToDoHotkeyStr += e.Key.ToString();
+ appConfig.ToDoHotkey = downKey;
+ appConfig.ToDoHotkeyStr += downKey.ToString();
}
- prevKeyTemp = e;
+ prevKeyTemp = downKey;
keysTemp.Add(e);
}
- else if (CheckModifierKeys(e))
+ else if (CheckModifierKeys(downKey))
{
if (main)
{
- appConfig.HotkeyStr += GetKeyName(e);
- appConfig.HotkeyModifiers |= GetModifierKeys(e);
+ appConfig.HotkeyStr += GetKeyName(downKey);
+ appConfig.HotkeyModifiers |= GetModifierKeys(downKey);
} else
{
- appConfig.ToDoHotkeyStr += GetKeyName(e);
- appConfig.ToDoHotkeyModifiers |= GetModifierKeys(e);
+ appConfig.ToDoHotkeyStr += GetKeyName(downKey);
+ appConfig.ToDoHotkeyModifiers |= GetModifierKeys(downKey);
}
- prevKeyTemp = e;
+ prevKeyTemp = downKey;
keysTemp.Add(e);
}
}
}
}
- private string GetKeyName(KeyEventArgs e)
+ private string GetKeyName(Key key)
{
- Key key = e.Key;
if (key == Key.LeftCtrl || key == Key.RightCtrl)
{
return "Ctrl + ";
@@ -150,12 +154,10 @@ namespace GeekDesk.Control.UserControls.Config
{
return "Alt + ";
}
-
}
- private HotkeyModifiers GetModifierKeys(KeyEventArgs e)
+ private HotkeyModifiers GetModifierKeys(Key key)
{
- Key key = e.Key;
if (key == Key.LeftCtrl || key == Key.RightCtrl)
{
return HotkeyModifiers.MOD_CONTROL;
@@ -174,9 +176,8 @@ namespace GeekDesk.Control.UserControls.Config
}
}
- private bool CheckModifierKeys(KeyEventArgs e)
+ private bool CheckModifierKeys(Key key)
{
- Key key = e.Key;
return key == Key.LeftCtrl || key == Key.RightCtrl
|| key == Key.LWin || key == Key.RWin
|| key == Key.LeftShift || key == Key.RightShift
@@ -208,6 +209,7 @@ namespace GeekDesk.Control.UserControls.Config
if (allKeyUp && !hotkeyFinished)
{
keysTemp.Clear();
+ prevKeyTemp = Key.None;
hotkeyFinished = true;
if (main)
@@ -271,5 +273,19 @@ namespace GeekDesk.Control.UserControls.Config
}
+ ///
+ /// 鼠标中键呼出 change
+ ///
+ ///
+ ///
+ private void MouseMiddle_Changed(object sender, RoutedEventArgs e)
+ {
+
+ }
+
+ private void HookListener_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
+ {
+ Console.WriteLine(e.KeyChar);
+ }
}
}
diff --git a/Control/UserControls/Config/OtherControl.xaml b/Control/UserControls/Config/OtherControl.xaml
index ff6c744..6f58f8a 100644
--- a/Control/UserControls/Config/OtherControl.xaml
+++ b/Control/UserControls/Config/OtherControl.xaml
@@ -7,14 +7,14 @@
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
- Background="AliceBlue"
+ Background="Transparent"
d:DesignHeight="400" d:DesignWidth="500"
>
-
+
diff --git a/Control/UserControls/Config/ThemeControl.xaml b/Control/UserControls/Config/ThemeControl.xaml
index 8bc53a2..65c12f2 100644
--- a/Control/UserControls/Config/ThemeControl.xaml
+++ b/Control/UserControls/Config/ThemeControl.xaml
@@ -6,12 +6,12 @@
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.Config"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
- Background="AliceBlue"
+ Background="Transparent"
d:DesignHeight="500" d:DesignWidth="450">
-
+
@@ -26,6 +26,7 @@
hc:Poptip.Placement="TopLeft"
/>
+
diff --git a/Control/UserControls/Config/ThemeControl.xaml.cs b/Control/UserControls/Config/ThemeControl.xaml.cs
index 3be49f3..6b54c22 100644
--- a/Control/UserControls/Config/ThemeControl.xaml.cs
+++ b/Control/UserControls/Config/ThemeControl.xaml.cs
@@ -1,4 +1,5 @@
-using GeekDesk.Util;
+using GeekDesk.Constant;
+using GeekDesk.Util;
using GeekDesk.ViewModel;
using Microsoft.Win32;
using System;
@@ -59,6 +60,23 @@ namespace GeekDesk.Control.UserControls.Config
}
+
+ private void DefaultButton_Click(object sender, RoutedEventArgs e)
+ {
+
+ try
+ {
+ appConfig.BitmapImage = ImageUtil.Base64ToBitmapImage(Constants.DEFAULT_BAC_IMAGE_BASE64);
+ appConfig.BacImgName = "系统默认";
+ }
+ catch (Exception)
+ {
+ HandyControl.Controls.Growl.WarningGlobal("修改背景失败,已重置为默认背景!");
+ }
+
+ }
+
+
private void ColorButton_Click(object sender, RoutedEventArgs e)
{
ColorPanel.Visibility = Visibility.Visible;
diff --git a/Control/UserControls/IconFont/IconPannel.xaml b/Control/UserControls/IconFont/IconPannel.xaml
index af9614f..7cf778f 100644
--- a/Control/UserControls/IconFont/IconPannel.xaml
+++ b/Control/UserControls/IconFont/IconPannel.xaml
@@ -5,10 +5,11 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.IconFont"
- mc:Ignorable="d"
+ mc:Ignorable="d"
+ Background="#00FFFFFF"
>
-
-
+
+
diff --git a/Control/UserControls/PannelCard/RightCardControl.xaml b/Control/UserControls/PannelCard/RightCardControl.xaml
index 590679e..1ebf46a 100644
--- a/Control/UserControls/PannelCard/RightCardControl.xaml
+++ b/Control/UserControls/PannelCard/RightCardControl.xaml
@@ -8,7 +8,9 @@
xmlns:cvt="clr-namespace:GeekDesk.Converts"
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
mc:Ignorable="d"
- d:DesignHeight="450" d:DesignWidth="800">
+ d:DesignHeight="450" d:DesignWidth="800"
+
+ >
@@ -42,7 +59,7 @@
-
+
diff --git a/Control/UserControls/ToDo/TodoControl.xaml.cs b/Control/UserControls/ToDo/TodoControl.xaml.cs
index 971ab83..7957a0a 100644
--- a/Control/UserControls/ToDo/TodoControl.xaml.cs
+++ b/Control/UserControls/ToDo/TodoControl.xaml.cs
@@ -73,13 +73,31 @@ namespace GeekDesk.Control.UserControls.Backlog
BacklogList.ContextMenu = null;
}
-
- private void DataGridRow_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
+ ///
+ /// 打开右键菜单
+ ///
+ ///
+ ///
+ private void DataGridRow_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
BacklogList.SelectedIndex = ((DataGridRow)sender).GetIndex();
Menu.IsOpen = true;
}
-
+ ///
+ /// 选中时颜色变化
+ ///
+ ///
+ ///
+ private void DataGridRow_Selected(object sender, RoutedEventArgs e)
+ {
+ Color c = Color.FromRgb(91, 192, 222);
+ SolidColorBrush b = new SolidColorBrush
+ {
+ Color = c,
+ Opacity = 0.9
+ };
+ ((DataGridRow)sender).Background = b;
+ }
}
}
diff --git a/Control/Windows/ConfigWindow.xaml b/Control/Windows/ConfigWindow.xaml
index a43a955..73cd8ad 100644
--- a/Control/Windows/ConfigWindow.xaml
+++ b/Control/Windows/ConfigWindow.xaml
@@ -8,63 +8,44 @@
Title="Setting"
mc:Ignorable="d"
WindowStartupLocation="CenterScreen"
- Height="450"
- Width="600"
+ Height="550"
+ Width="750"
WindowStyle="None"
+ ResizeMode="NoResize"
AllowsTransparency="True"
- Background="Transparent" ShowInTaskbar="False"
+ Background="#00FFFFFF" ShowInTaskbar="False"
+ BorderThickness="0"
>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
+
+
-
-
+
-
-
+
+
-
-
-
+
-
-
-
+
+
-
-
+
-
-
-
-
-
-
-
-
-
+
+
+
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/Control/Windows/ConfigWindow.xaml.cs b/Control/Windows/ConfigWindow.xaml.cs
index c12b031..915754e 100644
--- a/Control/Windows/ConfigWindow.xaml.cs
+++ b/Control/Windows/ConfigWindow.xaml.cs
@@ -1,6 +1,8 @@
+using GeekDesk.Constant;
using GeekDesk.Control.UserControls;
using GeekDesk.Control.UserControls.Config;
+using GeekDesk.Util;
using GeekDesk.ViewModel;
using HandyControl.Controls;
using HandyControl.Data;
@@ -24,6 +26,7 @@ namespace GeekDesk.Control.Windows
private ConfigWindow(AppConfig appConfig, MainWindow mainWindow)
{
InitializeComponent();
+ //BG.Source = ImageUtil.Base64ToBitmapImage(Constants.DEFAULT_BAC_IMAGE_BASE64);
this.DataContext = appConfig;
RightCard.Content = about;
this.Topmost = true;
diff --git a/Control/Windows/IconfontWindow.xaml b/Control/Windows/IconfontWindow.xaml
index 55312e6..a6efc33 100644
--- a/Control/Windows/IconfontWindow.xaml
+++ b/Control/Windows/IconfontWindow.xaml
@@ -8,46 +8,76 @@
xmlns:uc="clr-namespace:GeekDesk.Control.UserControls.IconFont"
mc:Ignorable="d"
Title="Svg"
- Height="450" Width="600"
+ Height="520" Width="700"
WindowStyle="None"
+ ResizeMode="NoResize"
AllowsTransparency="True"
- Background="AliceBlue"
- MouseDown="DragMove"
+ Background="Transparent" ShowInTaskbar="False"
+ BorderThickness="0"
>
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Control/Windows/IconfontWindow.xaml.cs b/Control/Windows/IconfontWindow.xaml.cs
index 4ad380e..9c9cc06 100644
--- a/Control/Windows/IconfontWindow.xaml.cs
+++ b/Control/Windows/IconfontWindow.xaml.cs
@@ -132,7 +132,7 @@ namespace GeekDesk.Control.Windows
window = new IconfontWindow(listInfo, menuInfo);
}
window.Show();
- ShowWindowFollowMouse.Show(window, MousePosition.LEFT_CENTER, 0, 0);
+ ShowWindowFollowMouse.Show(window, MousePosition.LEFT_CENTER, 0, 0, false);
}
private void CustomButton_Click(object sender, RoutedEventArgs e)
diff --git a/Control/Windows/ToDoInfoWindow.xaml b/Control/Windows/ToDoInfoWindow.xaml
index 2d278bc..ad717a5 100644
--- a/Control/Windows/ToDoInfoWindow.xaml
+++ b/Control/Windows/ToDoInfoWindow.xaml
@@ -8,9 +8,8 @@
xmlns:local="clr-namespace:GeekDesk"
mc:Ignorable="d"
WindowStartupLocation="CenterScreen"
- Height="700"
- Width="450"
- Title="TaskInfo"
+ Height="450"
+ Width="510"
WindowStyle="None"
AllowsTransparency="True"
Background="Transparent" ShowInTaskbar="False"
@@ -18,81 +17,84 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
+
+
-
-
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/Control/Windows/ToDoWindow.xaml b/Control/Windows/ToDoWindow.xaml
index 99dc6e6..101894e 100644
--- a/Control/Windows/ToDoWindow.xaml
+++ b/Control/Windows/ToDoWindow.xaml
@@ -7,60 +7,48 @@
xmlns:local="clr-namespace:GeekDesk"
mc:Ignorable="d"
WindowStartupLocation="CenterScreen"
- Height="450"
- Width="850"
+ Height="550"
+ Width="1000"
Title="Task"
WindowStyle="None"
AllowsTransparency="True"
Background="Transparent" ShowInTaskbar="False"
>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
-
-
-
+
-
-
-
+
+
-
-
+
-
-
-
-
-
+
+
+
+
+
+
-
-
+
-
-
+
+
+
diff --git a/Control/Windows/ToDoWindow.xaml.cs b/Control/Windows/ToDoWindow.xaml.cs
index 4f1ded7..3381699 100644
--- a/Control/Windows/ToDoWindow.xaml.cs
+++ b/Control/Windows/ToDoWindow.xaml.cs
@@ -85,7 +85,9 @@ namespace GeekDesk.Control.Windows
private static System.Windows.Window window = null;
+#pragma warning disable CS0108 // “ToDoWindow.Show()”隐藏继承的成员“Window.Show()”。如果是有意隐藏,请使用关键字 new。
public static void Show()
+#pragma warning restore CS0108 // “ToDoWindow.Show()”隐藏继承的成员“Window.Show()”。如果是有意隐藏,请使用关键字 new。
{
if (window == null || !window.Activate())
{
diff --git a/Control/Windows/UpdateWindow.xaml b/Control/Windows/UpdateWindow.xaml
index 17579cd..5056b54 100644
--- a/Control/Windows/UpdateWindow.xaml
+++ b/Control/Windows/UpdateWindow.xaml
@@ -6,39 +6,49 @@
xmlns:local="clr-namespace:GeekDesk.Control.Windows"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
- Title="UpdateWindow" Height="300" Width="450"
+ Height="460" Width="610"
WindowStyle="None"
AllowsTransparency="True"
Background="Transparent" ShowInTaskbar="False">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Control/Windows/UpdateWindow.xaml.cs b/Control/Windows/UpdateWindow.xaml.cs
index 5d8dc42..90aa496 100644
--- a/Control/Windows/UpdateWindow.xaml.cs
+++ b/Control/Windows/UpdateWindow.xaml.cs
@@ -33,6 +33,7 @@ namespace GeekDesk.Control.Windows
try
{
WindowStartupLocation = WindowStartupLocation.CenterScreen;
+ this.Topmost = true;
InitializeComponent();
DataHandle(jo);
}
@@ -68,7 +69,7 @@ namespace GeekDesk.Control.Windows
string msg = "";
for (int i=0; i
packages\CommonServiceLocator.2.0.6\lib\net45\CommonServiceLocator.dll
-
- packages\HandyControl.3.1.0\lib\net472\HandyControl.dll
+
+ packages\MouseKeyHook.5.6.0\lib\net40\Gma.System.MouseKeyHook.dll
+
+
+ packages\HandyControl.3.3.0\lib\net472\HandyControl.dll
+
+
+ packages\KeyMouseHook.1.0.6\lib\net40\KeyMouseHook.dll
packages\Microsoft.Extensions.Logging.Abstractions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll
@@ -184,6 +190,8 @@
+
+
@@ -294,6 +302,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
diff --git a/MainWindow.xaml b/MainWindow.xaml
index 2c5f8d6..1511c93 100644
--- a/MainWindow.xaml
+++ b/MainWindow.xaml
@@ -9,20 +9,19 @@
xmlns:cvt="clr-namespace:GeekDesk.Converts"
xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel"
x:Name="window"
- xmlns:hc="https://handyorg.github.io/handycontrol"
+ xmlns:hc="https://handyorg.github.io/handycontrol"
Title="GeekDesk"
d:DesignHeight="500" d:DesignWidth="700"
WindowStyle="None"
AllowsTransparency="True"
- Background="#00FFFFFF"
- OpacityMask ="White"
+ Background="Transparent"
ShowInTaskbar="False"
Opacity="0"
Deactivated="Window_Deactivated"
SizeChanged="Window_SizeChanged"
>
-
+
@@ -32,50 +31,59 @@
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ Opacity="{Binding AppConfig.PannelOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"
+ VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.IsContainerVirtualizable="True"
+ hc:Dialog.Token="IconInfoDialog"
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
-
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
index 26ee807..9e6c4a2 100644
--- a/MainWindow.xaml.cs
+++ b/MainWindow.xaml.cs
@@ -7,7 +7,9 @@ using GeekDesk.Task;
using GeekDesk.Thread;
using GeekDesk.Util;
using GeekDesk.ViewModel;
+using Gma.System.MouseKeyHook;
using HandyControl.Data;
+
using System;
using System.Collections.ObjectModel;
using System.Diagnostics;
@@ -30,6 +32,8 @@ namespace GeekDesk
public partial class MainWindow : Window
{
+ //public IKeyboardMouseEvents m_GlobalHook = Hook.GlobalEvents();
+
public static AppData appData = CommonCode.GetAppDataByFile();
//public static ToDoInfoWindow toDoInfoWindow = (ToDoInfoWindow)ToDoInfoWindow.GetThis();
public static ToDoInfoWindow toDoInfoWindow;
@@ -55,6 +59,9 @@ namespace GeekDesk
}
}
+ ///
+ /// 加载缓存数据
+ ///
private void LoadData()
{
this.DataContext = appData;
@@ -64,10 +71,14 @@ namespace GeekDesk
}
this.Width = appData.AppConfig.WindowWidth;
- this.Height = appData.AppConfig.WindowHeight;
-
+ this.Height = appData.AppConfig.WindowHeight;
}
+ ///
+ /// 窗口加载完毕 执行方法
+ ///
+ ///
+ ///
void Window_Loaded(object sender, RoutedEventArgs e)
{
if (!appData.AppConfig.StartedShowPanel)
@@ -83,17 +94,48 @@ namespace GeekDesk
{
ShowApp();
}
+
+ //注册热键
RegisterHotKey(true);
RegisterCreateToDoHotKey(true);
- if (!appData.AppConfig.SelfStartUped)
+ //注册自启动
+ if (!appData.AppConfig.SelfStartUped && "GeekDesk".Equals(Constants.MY_NAME))
{
RegisterUtil.SetSelfStarting(appData.AppConfig.SelfStartUp, Constants.MY_NAME);
}
- UpdateThread.Update();
+ //注册鼠标中键监听事件
+ //m_GlobalHook.MouseUpExt += M_GlobalHook_MouseUpExt;
+ MouseHookThread.MiddleHook();
+
+ //更新线程开启 检测更新
+ UpdateThread.Update();
}
+ ///
+ /// 鼠标中键呼出
+ ///
+ ///
+ ///
+ //private void M_GlobalHook_MouseUpExt(object sender, System.Windows.Forms.MouseEventArgs e)
+ //{
+ // if (appData.AppConfig.MouseMiddleShow && e.Button == System.Windows.Forms.MouseButtons.Middle)
+ // {
+ // if (MotionControl.hotkeyFinished)
+ // {
+ // if (mainWindow.Visibility == Visibility.Collapsed || mainWindow.Opacity == 0)
+ // {
+ // ShowApp();
+ // }
+ // else
+ // {
+ // HideApp();
+ // }
+ // }
+ // }
+ //}
+
///
/// 注册当前窗口的热键
///
@@ -138,6 +180,12 @@ namespace GeekDesk
}
}
+ ///
+ /// 淡入淡出效果
+ ///
+ ///
+ ///
+ ///
public static void FadeStoryBoard(int opacity, int milliseconds, Visibility visibility)
{
if (appData.AppConfig.AppAnimation)
@@ -209,6 +257,11 @@ namespace GeekDesk
}
+ ///
+ /// 重置窗体大小 写入缓存
+ ///
+ ///
+ ///
void MainWindow_Resize(object sender, System.EventArgs e)
{
if (this.DataContext != null)
@@ -221,7 +274,11 @@ namespace GeekDesk
-
+ ///
+ /// 程序窗体拖动
+ ///
+ ///
+ ///
private void DragMove(object sender, MouseEventArgs e)
{
//if (e.LeftButton == MouseButtonState.Pressed)
@@ -298,6 +355,11 @@ namespace GeekDesk
}
public static void ShowApp()
{
+ //有全屏化应用则不显示
+ //if (CommonCode.IsPrimaryFullScreen())
+ //{
+ // return;
+ //}
if (appData.AppConfig.FollowMouse)
{
ShowWindowFollowMouse.Show(mainWindow, MousePosition.CENTER, 0, 0, false);
diff --git a/Resource/Dictionary/CommonStyle.xaml b/Resource/Dictionary/CommonStyle.xaml
new file mode 100644
index 0000000..c3e5ef5
--- /dev/null
+++ b/Resource/Dictionary/CommonStyle.xaml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Thread/DispatcherBuild.cs b/Thread/DispatcherBuild.cs
new file mode 100644
index 0000000..ab017bb
--- /dev/null
+++ b/Thread/DispatcherBuild.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows.Threading;
+
+namespace GeekDesk.Thread
+{
+ public class DispatcherBuild
+ {
+
+ //创建一个Dispatcher来单独使用ui线程
+ public static Dispatcher Build()
+ {
+ Dispatcher dispatcher = null;
+ var manualResetEvent = new ManualResetEvent(false);
+ var thread = new System.Threading.Thread(() =>
+ {
+ dispatcher = Dispatcher.CurrentDispatcher;
+ var synchronizationContext = new DispatcherSynchronizationContext(dispatcher);
+ SynchronizationContext.SetSynchronizationContext(synchronizationContext);
+
+ manualResetEvent.Set();
+ Dispatcher.Run();
+ });
+ thread.Start();
+ manualResetEvent.WaitOne();
+ manualResetEvent.Dispose();
+ return dispatcher;
+ }
+ }
+}
diff --git a/Thread/MouseHookThread.cs b/Thread/MouseHookThread.cs
new file mode 100644
index 0000000..8bb3a37
--- /dev/null
+++ b/Thread/MouseHookThread.cs
@@ -0,0 +1,58 @@
+using GeekDesk.Control.UserControls.Config;
+using GeekDesk.ViewModel;
+using Gma.System.MouseKeyHook;
+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.Threading;
+
+namespace GeekDesk.Thread
+{
+ public class MouseHookThread
+ {
+ private static AppConfig appConfig = MainWindow.appData.AppConfig;
+ public static IKeyboardMouseEvents m_GlobalHook = Hook.GlobalEvents();
+
+
+ public static void MiddleHook()
+ {
+ //使用dispatcher来单独监听UI线程 防止程序卡顿
+ Dispatcher dispatcher = DispatcherBuild.Build();
+ dispatcher.Invoke((Action)(() =>
+ {
+ m_GlobalHook.MouseDownExt += M_GlobalHook_MouseDownExt;
+ }));
+ }
+
+ ///
+ /// 鼠标中键呼出
+ ///
+ ///
+ ///
+ private static void M_GlobalHook_MouseDownExt(object sender, System.Windows.Forms.MouseEventArgs e)
+ {
+ if (appConfig.MouseMiddleShow && e.Button == System.Windows.Forms.MouseButtons.Middle)
+ {
+ if (MotionControl.hotkeyFinished)
+ {
+ MainWindow.mainWindow.Dispatcher.Invoke((Action)(() =>
+ {
+ if (MainWindow.mainWindow.Visibility == Visibility.Collapsed || MainWindow.mainWindow.Opacity == 0)
+ {
+ MainWindow.ShowApp();
+ }
+ else
+ {
+ MainWindow.HideApp();
+ }
+ }));
+ }
+ }
+ }
+
+ }
+}
diff --git a/Thread/UpdateThread.cs b/Thread/UpdateThread.cs
index 6be5d06..815ffff 100644
--- a/Thread/UpdateThread.cs
+++ b/Thread/UpdateThread.cs
@@ -32,7 +32,7 @@ namespace GeekDesk.Thread
{
//等待1分钟后再检查更新 有的网络连接过慢
- System.Threading.Thread.Sleep(60 * 1000);
+ System.Threading.Thread.Sleep(1 * 1000);
string updateUrl;
string nowVersion = ConfigurationManager.AppSettings["Version"];
@@ -50,7 +50,7 @@ namespace GeekDesk.Thread
{
JObject jo = JObject.Parse(updateInfo);
string onlineVersion = jo["version"].ToString();
- if (onlineVersion.CompareTo(nowVersion) > 0)
+ if (onlineVersion.CompareTo(nowVersion) > 0 || true)
{
App.Current.Dispatcher.Invoke((Action)(() =>
{
@@ -59,7 +59,9 @@ namespace GeekDesk.Thread
}));
}
}
+#pragma warning disable CS0168 // 声明了变量“e”,但从未使用过
} catch (Exception e)
+#pragma warning restore CS0168 // 声明了变量“e”,但从未使用过
{
//不做处理
//MessageBox.Show(e.Message);
diff --git a/Util/CommonCode.cs b/Util/CommonCode.cs
index fe7c88a..92de068 100644
--- a/Util/CommonCode.cs
+++ b/Util/CommonCode.cs
@@ -2,6 +2,7 @@
using GeekDesk.ViewModel;
using System;
using System.IO;
+using System.Runtime.InteropServices;
using System.Runtime.Serialization.Formatters.Binary;
using System.Windows;
@@ -52,7 +53,46 @@ namespace GeekDesk.Util
}
}
-
+
+
+ ///
+ /// 判断当前屏幕(鼠标最后活动屏幕)是否有全屏化应用
+ ///
+ ///
+ public static bool IsPrimaryFullScreen()
+ {
+ RECT rect = new RECT();
+ GetWindowRect(new HandleRef(null, GetForegroundWindow()), ref rect);
+
+ int windowHeight = rect.bottom - rect.top;
+ int screenHeight = (int)SystemParameters.PrimaryScreenHeight;
+
+ if (windowHeight >= screenHeight)
+ {
+ return true;
+ }
+ return false;
+ }
+
+
+ [StructLayout(LayoutKind.Sequential)]
+ private struct RECT
+ {
+ public int left;
+ public int top;
+ public int right;
+ public int bottom;
+ }
+
+ [DllImport("user32.dll")]
+ private static extern bool GetWindowRect(HandleRef hWnd, [In, Out] ref RECT rect);
+
+ [DllImport("user32.dll")]
+ private static extern IntPtr GetForegroundWindow();
+
+
+
+
}
diff --git a/Util/FileIcon.cs b/Util/FileIcon.cs
index ec0abd0..bc7f5b1 100644
--- a/Util/FileIcon.cs
+++ b/Util/FileIcon.cs
@@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
+using System.Drawing.Imaging;
using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Media.Imaging;
@@ -65,7 +66,15 @@ namespace GeekDesk.Util
Bitmap bmp = ico.ToBitmap();
MemoryStream strm = new MemoryStream();
- bmp.Save(strm, System.Drawing.Imaging.ImageFormat.Png);
+
+ ImageCodecInfo myImageCodecInfo = GetEncoderInfo("image/png");
+ Encoder myEncoder = Encoder.Quality;
+ EncoderParameter myEncoderParameter = new EncoderParameter(myEncoder, 75L);
+ EncoderParameters myEncoderParameters = new EncoderParameters(1);
+ myEncoderParameters.Param[0] = myEncoderParameter;
+
+ bmp.Save(strm, myImageCodecInfo, myEncoderParameters);
+ bmp.Save("d:\\test.png", myImageCodecInfo, myEncoderParameters);
BitmapImage bmpImage = new BitmapImage();
bmpImage.BeginInit();
strm.Seek(0, SeekOrigin.Begin);
@@ -78,7 +87,20 @@ namespace GeekDesk.Util
return bmpImage.Clone();
}
-
+ private static ImageCodecInfo GetEncoderInfo(String mimeType)
+ {
+ int j;
+ ImageCodecInfo[] encoders;
+ encoders = ImageCodecInfo.GetImageEncoders();
+ for (j = 0; j < encoders.Length; ++j)
+ {
+ if (encoders[j].MimeType == mimeType)
+ return encoders[j];
+ }
+ return null;
+ }
+
+
public static int GetIconIndex(string pszFile)
{
diff --git a/Util/FileUtil.cs b/Util/FileUtil.cs
index 1c53714..3eb823a 100644
--- a/Util/FileUtil.cs
+++ b/Util/FileUtil.cs
@@ -23,7 +23,9 @@ namespace GeekDesk.Util
}
return shortcut.TargetPath;
}
+#pragma warning disable CS0168 // 声明了变量“e”,但从未使用过
catch (Exception e)
+#pragma warning restore CS0168 // 声明了变量“e”,但从未使用过
{
return null;
}
diff --git a/Util/GlobalHotKey.cs b/Util/GlobalHotKey.cs
index a6a4164..34bcb48 100644
--- a/Util/GlobalHotKey.cs
+++ b/Util/GlobalHotKey.cs
@@ -1,10 +1,8 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
-using System.Windows;
using System.Windows.Forms;
using System.Windows.Input;
-using System.Windows.Interop;
namespace GeekDesk.Util
{
@@ -50,10 +48,17 @@ namespace GeekDesk.Util
public static void Dispose(int id)
{
- bool test = UnregisterHotKey(handleTemp[id].Handle, id);
- GlobalHotKey.handleTemp[id].Dispose();
- GlobalHotKey.handleTemp.Remove(id);
- Console.WriteLine(test);
+ try
+ {
+ UnregisterHotKey(handleTemp[id].Handle, id);
+ GlobalHotKey.handleTemp[id].Dispose();
+ GlobalHotKey.handleTemp.Remove(id);
+ } catch
+ {
+ //nothing
+ }
+
+
}
// Registers a hot key with Windows.
diff --git a/Util/MarginHide.cs b/Util/MarginHide.cs
index cd7979d..861c72f 100644
--- a/Util/MarginHide.cs
+++ b/Util/MarginHide.cs
@@ -31,7 +31,9 @@ namespace GeekDesk.Util
private double showMarginWidth = 1;
+#pragma warning disable CS0414 // 字段“MarginHide.isHide”已被赋值,但从未使用过它的值
private bool isHide;
+#pragma warning restore CS0414 // 字段“MarginHide.isHide”已被赋值,但从未使用过它的值
public Timer timer;
//构造函数,传入将要匹配的窗体
diff --git a/Util/RegisterUtil.cs b/Util/RegisterUtil.cs
index 99c5abb..d6f723c 100644
--- a/Util/RegisterUtil.cs
+++ b/Util/RegisterUtil.cs
@@ -48,7 +48,9 @@ namespace GeekDesk.Util
key.Close();
}
+#pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过
catch (Exception ex)
+#pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过
{
return false;
}
@@ -60,14 +62,18 @@ namespace GeekDesk.Util
key.DeleteValue(exeName);//取消开机启动
key.Close();
}
+#pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过
catch (Exception ex)
+#pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过
{
return false;
}
}
return true;
}
+#pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过
catch (Exception ex)
+#pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过
{
if (key != null)
{
diff --git a/Util/ShellContextMenu.cs b/Util/ShellContextMenu.cs
index 6d121b1..dec8a0b 100644
--- a/Util/ShellContextMenu.cs
+++ b/Util/ShellContextMenu.cs
@@ -1509,7 +1509,9 @@ namespace GeekDesk.Util
m_hookType,
m_filterFunc,
IntPtr.Zero,
+#pragma warning disable CS0618 // AppDomain.GetCurrentThreadId()ѹʱ:AppDomain.GetCurrentThreadId has been deprecated because it does not provide a stable Id when managed threads are running on fibers (aka lightweight threads). To get a stable identifier for a managed thread, use the ManagedThreadId property on Thread. http://go.microsoft.com/fwlink/?linkid=14202
(int)AppDomain.GetCurrentThreadId());
+#pragma warning restore CS0618 // AppDomain.GetCurrentThreadId()ѹʱ:AppDomain.GetCurrentThreadId has been deprecated because it does not provide a stable Id when managed threads are running on fibers (aka lightweight threads). To get a stable identifier for a managed thread, use the ManagedThreadId property on Thread. http://go.microsoft.com/fwlink/?linkid=14202
}
// ************************************************************************
diff --git a/ViewModel/AppConfig.cs b/ViewModel/AppConfig.cs
index 0c0cad1..6e4766a 100644
--- a/ViewModel/AppConfig.cs
+++ b/ViewModel/AppConfig.cs
@@ -66,7 +66,22 @@ namespace GeekDesk.ViewModel
private int imageWidth = (int)CommonEnum.IMAGE_WIDTH; //图片宽度
private int imageHeight = (int)CommonEnum.IMAGE_HEIGHT; //图片高度
+ private bool mouseMiddleShow = false; //鼠标中键呼出 默认不启用
+
#region GetSet
+ public bool MouseMiddleShow
+ {
+ get
+ {
+ return mouseMiddleShow;
+ }
+ set
+ {
+ mouseMiddleShow = value;
+ OnPropertyChanged("MouseMiddleShow");
+ }
+ }
+
public int ImageWidth
{
get
@@ -101,6 +116,10 @@ namespace GeekDesk.ViewModel
{
s -= i;
}
+ if (s < 2.2)
+ {
+ s = 2.2;
+ }
//设置容器宽度
ImgPanelWidth = (int)(ImageWidth * s);
@@ -138,6 +157,7 @@ namespace GeekDesk.ViewModel
{
s -= i;
}
+ if (s < 1.5) s = 1.5;
//设置容器高度
ImgPanelHeight = ImageHeight * s;
diff --git a/packages.config b/packages.config
index b2dc769..0eceaa8 100644
--- a/packages.config
+++ b/packages.config
@@ -1,8 +1,10 @@
-
+
+
+