From e82af431b5a295931af7a9e10e09b21b3615ba74 Mon Sep 17 00:00:00 2001 From: BookerLiu Date: Tue, 30 Aug 2022 09:06:27 +0800 Subject: [PATCH 1/4] =?UTF-8?q?:ambulance:=20=E4=BF=AE=E5=A4=8D=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E5=AF=BC=E8=87=B4=E8=BE=93=E5=85=A5=E6=B3=95=E7=89=B9?= =?UTF-8?q?=E5=AE=9A=E5=9C=BA=E6=99=AF=E5=8D=A1=E9=A1=BF=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.config | 117 +-- App.xaml.cs | 5 +- Constant/Constants.cs | 8 +- Constant/RunTimeStatus.cs | 18 + Constant/WidthTypeEnum.cs | 15 + .../UserControls/Config/MotionControl.xaml.cs | 24 +- Control/UserControls/Config/OtherControl.xaml | 18 +- .../UserControls/Config/OtherControl.xaml.cs | 81 ++ .../PannelCard/LeftCardControl.xaml.cs | 84 +- .../PannelCard/RightCardControl.xaml | 185 ++-- .../PannelCard/RightCardControl.xaml.cs | 436 ++++++--- Control/Windows/PixelColorPickerWindow.xaml | 3 +- .../Windows/PixelColorPickerWindow.xaml.cs | 32 +- Control/Windows/ToDoWindow.xaml.cs | 4 +- Converts/GetWidthByWWConvert.cs | 40 + GeekDesk.csproj | 13 + MainWindow.xaml | 126 +-- MainWindow.xaml.cs | 88 +- MyThread/MouseHookThread.cs | 109 ++- MyThread/RelativePathThread.cs | 39 +- Task/ToDoTask.cs | 4 +- Util/CommonCode.cs | 45 +- Util/FileUtil.cs | 23 +- Util/HideWindowUtil.cs | 227 +++++ Util/ListBoxDragDropManager.cs | 1 + Util/MessageUtil.cs | 131 +++ Util/MouseHook.cs | 156 ++++ Util/ScreenUtil.cs | 156 ++++ Util/ScrollUtil.cs | 75 ++ Util/UserActivityHook.cs | 837 ++++++++++++++++++ ViewModel/AppConfig.cs | 17 + 31 files changed, 2687 insertions(+), 430 deletions(-) create mode 100644 Constant/WidthTypeEnum.cs create mode 100644 Converts/GetWidthByWWConvert.cs create mode 100644 Util/HideWindowUtil.cs create mode 100644 Util/MessageUtil.cs create mode 100644 Util/MouseHook.cs create mode 100644 Util/ScreenUtil.cs create mode 100644 Util/ScrollUtil.cs create mode 100644 Util/UserActivityHook.cs diff --git a/App.config b/App.config index fd0f07f..d831df3 100644 --- a/App.config +++ b/App.config @@ -2,9 +2,16 @@
+
+ + + + + + @@ -21,59 +28,59 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/App.xaml.cs b/App.xaml.cs index 72790e9..3d92836 100644 --- a/App.xaml.cs +++ b/App.xaml.cs @@ -24,7 +24,6 @@ namespace GeekDesk private void App_Startup(object sender, StartupEventArgs e) { - mutex = new System.Threading.Mutex(true, Constants.MY_NAME, out bool ret); if (!ret) { @@ -32,6 +31,10 @@ namespace GeekDesk mutex = new System.Threading.Mutex(true, Constants.MY_NAME, out ret); if (!ret) { + MessageUtil.SendMsgByWName( + "GeekDesk_Main_" + Constants.MY_UUID, + "ShowApp" + ); Environment.Exit(0); } } diff --git a/Constant/Constants.cs b/Constant/Constants.cs index 544262d..37c8ddb 100644 --- a/Constant/Constants.cs +++ b/Constant/Constants.cs @@ -13,7 +13,7 @@ namespace GeekDesk.Constant public static string MY_NAME = DEV ? "GeekDesk-D" : "GeekDesk"; - + public static string MY_UUID = "8400A17AEEF7C029"; /// /// app数据文件路径 /// @@ -30,6 +30,12 @@ namespace GeekDesk.Constant public static string ERROR_FILE_PATH = APP_DIR + "logs\\error.log"; // 错误日志 + /// + /// 插件文件夹 + /// + public static string PLUGINS_PATH = APP_DIR + "plugins\\"; + + public static int SHADOW_WIDTH = 20; //系统图标 diff --git a/Constant/RunTimeStatus.cs b/Constant/RunTimeStatus.cs index 82df63b..ffb5b27 100644 --- a/Constant/RunTimeStatus.cs +++ b/Constant/RunTimeStatus.cs @@ -40,5 +40,23 @@ /// public static bool IS_MENU_EDIT = false; + + /// + /// 图标card 鼠标滚轮是否正在工作 + /// 用来控制popup的显示 否则低性能机器会造成卡顿 + /// + public static bool ICONLIST_MOUSE_WHEEL = false; + /// + /// 控制多少毫秒后 关闭(ICONLIST_MOUSE_WHEEL)鼠标滚轮运行状态 + /// + public static int MOUSE_WHEEL_WAIT_MS = 100; + /// + /// 与关闭popup 配合使用, 避免线程结束后不显示popup + /// + public static bool MOUSE_ENTER_ICON = false; + /// + /// 控制每次刷新搜索结果 鼠标移动后显示popup + /// + public static int MOUSE_MOVE_COUNT = 0; } } diff --git a/Constant/WidthTypeEnum.cs b/Constant/WidthTypeEnum.cs new file mode 100644 index 0000000..0c032f8 --- /dev/null +++ b/Constant/WidthTypeEnum.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace GeekDesk.Constant +{ + public enum WidthTypeEnum + { + LEFT_CARD = 0, //左侧托盘宽度 + RIGHT_CARD = 1, //右侧托盘宽度 + RIGHT_CARD_HALF = 2 //右侧托盘宽度的一半 + } +} diff --git a/Control/UserControls/Config/MotionControl.xaml.cs b/Control/UserControls/Config/MotionControl.xaml.cs index da521c3..9321ae2 100644 --- a/Control/UserControls/Config/MotionControl.xaml.cs +++ b/Control/UserControls/Config/MotionControl.xaml.cs @@ -47,7 +47,7 @@ namespace GeekDesk.Control.UserControls.Config if (!CheckIsEnable(hkType)) return; - + if (prevKeyTemp == Key.None || prevKeyTemp != downKey) { if (hotkeyFinished) @@ -315,14 +315,17 @@ namespace GeekDesk.Control.UserControls.Config /// private void MouseMiddle_Changed(object sender, RoutedEventArgs e) { - if (appConfig.MouseMiddleShow) - { - MouseHookThread.MiddleHook(); - } - else - { - MouseHookThread.Dispose(); - } + //if (appConfig.MouseMiddleShow) + //{ + // MouseHookThread.MiddleHook(); + //} + //else + //{ + // MouseHookThread.DisposeMiddle(); + //} + + MouseHookThread.Dispose(); + MouseHookThread.Hook(); } /// @@ -339,7 +342,8 @@ namespace GeekDesk.Control.UserControls.Config if (true == appConfig.EnableAppHotKey) { MainWindow.RegisterHotKey(false); - } else + } + else { if (MainWindow.hotKeyId != -1) { diff --git a/Control/UserControls/Config/OtherControl.xaml b/Control/UserControls/Config/OtherControl.xaml index 989f205..4ddb204 100644 --- a/Control/UserControls/Config/OtherControl.xaml +++ b/Control/UserControls/Config/OtherControl.xaml @@ -5,7 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:cvt="clr-namespace:GeekDesk.Converts" xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard" - xmlns:hc="https://handyorg.github.io/handycontrol" + xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel" d:DataContext="{d:DesignInstance Type=viewmodel:AppConfig}" mc:Ignorable="d" Background="Transparent" d:DesignHeight="400" d:DesignWidth="500" @@ -41,6 +41,20 @@ + + + + + + + + + + @@ -93,7 +107,7 @@ Foreground="Black" IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=2}"/> - +