Browse Source

:bug: 控制主面板热键调用频率

Demo_Liu 2 years ago
parent
commit
37dd2f7fb2
3 changed files with 22 additions and 1 deletions
  1. 8 0
      Constant/RunTimeStatus.cs
  2. 6 1
      Control/UserControls/ToDo/TodoControl.xaml
  3. 8 0
      MainWindow.xaml.cs

+ 8 - 0
Constant/RunTimeStatus.cs

@@ -70,5 +70,13 @@
         /// </summary>
         public static int EVERYTHING_SEARCH_DELAY_TIME = 300;
 
+        /// <summary>
+        /// 控制主界面热键按下规定时间内只执行一次show hide
+        /// </summary>
+        public static bool MAIN_HOT_KEY_DOWN = false;
+        /// <summary>
+        /// 控制主界面热键按下规定时间内只执行一次show hide
+        /// </summary>
+        public static int MAIN_HOT_KEY_TIME = 500;
     }
 }

+ 6 - 1
Control/UserControls/ToDo/TodoControl.xaml

@@ -82,10 +82,15 @@
                             <Setter Property="Template">
                                 <Setter.Value>
                                     <ControlTemplate TargetType="{x:Type DataGridRow}">
-                                        <Border CornerRadius="8" MouseRightButtonDown="DataGridRow_MouseRightButtonDown" Margin="0,0,0,5" BorderBrush="Black" BorderThickness="0" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
+                                        <Border CornerRadius="8" MouseRightButtonDown="DataGridRow_MouseRightButtonDown" Margin="0,0,0,5" BorderBrush="Black" BorderThickness="0" SnapsToDevicePixels="True">
                                             <Border.Style>
                                                 <Style TargetType="Border">
                                                     <Setter Property="FocusVisualStyle" Value="{x:Null}" />
+                                                    <Setter Property="Background">
+                                                        <Setter.Value>
+                                                            <SolidColorBrush Color="White" Opacity="0.6"/>
+                                                        </Setter.Value>
+                                                    </Setter>
                                                 </Style>
                                             </Border.Style>
                                             <SelectiveScrollingGrid>

+ 8 - 0
MainWindow.xaml.cs

@@ -374,6 +374,14 @@ namespace GeekDesk
                 {
                     hotKeyId = GlobalHotKey.RegisterHotKey(appData.AppConfig.HotkeyModifiers, appData.AppConfig.Hotkey, () =>
                     {
+                        if (RunTimeStatus.MAIN_HOT_KEY_DOWN) return;
+                        RunTimeStatus.MAIN_HOT_KEY_DOWN = true;
+                        new Thread(() =>
+                        {
+                            Thread.Sleep(RunTimeStatus.MAIN_HOT_KEY_TIME);
+                            RunTimeStatus.MAIN_HOT_KEY_DOWN = false;
+                        }).Start();
+
                         if (MotionControl.hotkeyFinished)
                         {
                             if (CheckSholeShowApp())