浏览代码

:children_crossing: 优化快捷键/优化拾色器

liufei 3 年之前
父节点
当前提交
39607bdcb5

+ 44 - 28
Control/UserControls/Config/MotionControl.xaml

@@ -10,10 +10,11 @@
              d:DataContext="{d:DesignInstance Type=viewmodel:AppConfig}"
              xmlns:cst="clr-namespace:GeekDesk.Constant"
              Background="Transparent"
-             d:DesignHeight="400" d:DesignWidth="450">
+             d:DesignHeight="450" d:DesignWidth="450">
 
     <UserControl.Resources>
         <cvt:HideTypeConvert x:Key="HideTypeConvert"/>
+        <cvt:SearchTypeConvert x:Key="SearchTypeConvert"/>
     </UserControl.Resources>
     <Grid Background="Transparent" MouseDown="DragMove" 
           >
@@ -108,21 +109,34 @@
                          IsChecked="{Binding AppHideType, Mode=TwoWay, Converter={StaticResource HideTypeConvert}, ConverterParameter=3}"/>
             </hc:UniformSpacingPanel>
 
+            <hc:UniformSpacingPanel Spacing="10" Margin="0,10,0,0" Grid.ColumnSpan="4">
+                <TextBlock Text="搜索方式" VerticalAlignment="Center"/>
+            </hc:UniformSpacingPanel>
+            <hc:UniformSpacingPanel Spacing="10" Margin="10,5,0,0" Grid.ColumnSpan="4">
+                <RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}" 
+                         Style="{StaticResource RadioButtonIcon}" Content="快捷键"
+                         IsChecked="{Binding SearchType, Mode=TwoWay, Converter={StaticResource SearchTypeConvert}, ConverterParameter=0}"/>
+                <RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
+                         Style="{StaticResource RadioButtonIcon}" Content="按键即搜" 
+                         IsChecked="{Binding SearchType, Mode=TwoWay, Converter={StaticResource SearchTypeConvert}, ConverterParameter=1}"/>
+            </hc:UniformSpacingPanel>
+
             <hc:UniformSpacingPanel Spacing="10"  Margin="0,10,0,0" Grid.ColumnSpan="4">
                 <TextBlock Text="热键设置" VerticalAlignment="Center"/>
             </hc:UniformSpacingPanel>
             <hc:UniformSpacingPanel Spacing="10"  Margin="10,5,0,0" Grid.ColumnSpan="4">
                 <TextBlock Text="主面板:" VerticalAlignment="Center" Margin="0,5,0,0" Width="55"/>
                 <hc:TextBox HorizontalAlignment="Left" 
-                        Tag="{x:Static cst:HotKeyType.Main}"
-                        VerticalAlignment="Top" 
-                        IsReadOnly="True" 
-                        IsReadOnlyCaretVisible="True" 
-                        Width="170"
-                        Text="{Binding HotkeyStr}" 
-                        KeyDown="HotKeyDown"
-                        KeyUp="HotKeyUp"
-                        />
+                            Tag="{x:Static cst:HotKeyType.Main}"
+                            VerticalAlignment="Top" 
+                            IsReadOnly="True" 
+                            IsReadOnlyCaretVisible="True" 
+                            Width="170"
+                            Text="{Binding HotkeyStr}" 
+                            KeyDown="HotKeyDown"
+                            KeyUp="HotKeyUp"
+                            InputMethod.IsInputMethodEnabled="False"
+                            />
                 <CheckBox Content="启用" 
                           Click="EnableHotKey_Click" 
                           Tag="{x:Static cst:HotKeyType.Main}" 
@@ -137,15 +151,16 @@
             <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.ToDo}"
-                        VerticalAlignment="Top" 
-                        IsReadOnly="True" 
-                        IsReadOnlyCaretVisible="True" 
-                        Width="170"
-                        Text="{Binding ToDoHotkeyStr}" 
-                        KeyDown="HotKeyDown"
-                        KeyUp="HotKeyUp"
-                        />
+                            Tag="{x:Static cst:HotKeyType.ToDo}"
+                            VerticalAlignment="Top" 
+                            IsReadOnly="True" 
+                            IsReadOnlyCaretVisible="True" 
+                            Width="170"
+                            Text="{Binding ToDoHotkeyStr}" 
+                            KeyDown="HotKeyDown"
+                            KeyUp="HotKeyUp"
+                            InputMethod.IsInputMethodEnabled="False"
+                            />
                 <CheckBox Content="启用" 
                           Click="EnableHotKey_Click" 
                           Tag="{x:Static cst:HotKeyType.ToDo}" 
@@ -161,15 +176,16 @@
             <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"
-                        />
+                            Tag="{x:Static cst:HotKeyType.ColorPicker}"
+                            VerticalAlignment="Top" 
+                            IsReadOnly="True" 
+                            IsReadOnlyCaretVisible="True" 
+                            Width="170"
+                            Text="{Binding ColorPickerHotkeyStr}" 
+                            KeyDown="HotKeyDown"
+                            KeyUp="HotKeyUp"
+                            InputMethod.IsInputMethodEnabled="False"
+                            />
                 <CheckBox Content="启用" 
                           Tag="{x:Static cst:HotKeyType.ColorPicker}"
                           Click="EnableHotKey_Click"

+ 130 - 92
Control/UserControls/Config/MotionControl.xaml.cs

@@ -2,6 +2,7 @@
 using GeekDesk.MyThread;
 using GeekDesk.Util;
 using GeekDesk.ViewModel;
+using System;
 using System.Collections.Generic;
 using System.Runtime.CompilerServices;
 using System.Windows;
@@ -34,118 +35,130 @@ namespace GeekDesk.Control.UserControls.Config
         /// <param name="e"></param>
         private void HotKeyDown(object sender, KeyEventArgs e)
         {
-            HotKeyType hkType = (HotKeyType)(sender as TextBox).Tag;
+            Console.WriteLine("downKey:" + e.Key.ToString());
 
-            Key downKey = e.Key;
-            if (downKey == Key.System)
+            lock (this)
             {
-                downKey = e.SystemKey;
-            }
+                HotKeyType hkType = (HotKeyType)(sender as TextBox).Tag;
 
-            if (!CheckIsEnable(hkType)) return;
+                Key downKey = e.Key;
+                if (downKey == Key.System)
+                {
+                    downKey = e.SystemKey;
+                }
 
+                if (!CheckIsEnable(hkType)) return;
 
-            if (prevKeyTemp == Key.None || prevKeyTemp != downKey)
-            {
-                if (hotkeyFinished)
-                {
 
-                    switch (hkType)
-                    {
-                        case HotKeyType.Main:
-                            appConfig.Hotkey = 0;
-                            appConfig.HotkeyStr = "";
-                            appConfig.HotkeyModifiers = 0;
-                            break;
-                        case HotKeyType.ToDo:
-                            appConfig.ToDoHotkey = 0;
-                            appConfig.ToDoHotkeyStr = "";
-                            appConfig.ToDoHotkeyModifiers = 0;
-                            break;
-                        case HotKeyType.ColorPicker:
-                            appConfig.ColorPickerHotkey = 0;
-                            appConfig.ColorPickerHotkeyStr = "";
-                            appConfig.ColorPickerHotkeyModifiers = 0;
-                            break;
-                    }
-                    hotkeyFinished = false;
-                }
-                //首次按下按键
-                if ((HotKeyType.Main == hkType && (appConfig.HotkeyStr == null || appConfig.HotkeyStr.Length == 0))
-                    || (HotKeyType.ToDo == hkType && (appConfig.ToDoHotkeyStr == null || appConfig.ToDoHotkeyStr.Length == 0))
-                    || (HotKeyType.ColorPicker == hkType && (appConfig.ColorPickerHotkeyStr == null || appConfig.ColorPickerHotkeyStr.Length == 0))
-                    )
+                Console.WriteLine("prevKeyTemp:" + prevKeyTemp.ToString());
+                
+                if (prevKeyTemp == Key.None || prevKeyTemp != downKey)
                 {
-                    if (CheckModifierKeys(downKey))
+                    if (hotkeyFinished)
                     {
-                        //辅助键
                         switch (hkType)
                         {
                             case HotKeyType.Main:
-                                appConfig.HotkeyStr = GetKeyName(downKey);
-                                appConfig.HotkeyModifiers = GetModifierKeys(downKey);
+                                appConfig.Hotkey = Key.None;
+                                appConfig.HotkeyStr = "";
+                                appConfig.HotkeyModifiers = GlobalHotKey.HotkeyModifiers.None;
                                 break;
                             case HotKeyType.ToDo:
-                                appConfig.ToDoHotkeyStr = GetKeyName(downKey);
-                                appConfig.ToDoHotkeyModifiers = GetModifierKeys(downKey);
+                                appConfig.ToDoHotkey = Key.None;
+                                appConfig.ToDoHotkeyStr = "";
+                                appConfig.ToDoHotkeyModifiers = GlobalHotKey.HotkeyModifiers.None;
                                 break;
                             case HotKeyType.ColorPicker:
-                                appConfig.ColorPickerHotkeyStr = GetKeyName(downKey);
-                                appConfig.ColorPickerHotkeyModifiers = GetModifierKeys(downKey);
+                                appConfig.ColorPickerHotkey = Key.None;
+                                appConfig.ColorPickerHotkeyStr = "";
+                                appConfig.ColorPickerHotkeyModifiers = GlobalHotKey.HotkeyModifiers.None;
                                 break;
                         }
-
-                        prevKeyTemp = downKey;
-                        keysTemp.Add(e);
+                        hotkeyFinished = false;
                     }
-                }
-                else
-                {
-                    //非首次按下  需要判断前一个键值是否为辅助键
-                    if (CheckModifierKeys(prevKeyTemp)
-                        && ((downKey >= Key.A && downKey <= Key.Z)
-                        || (downKey >= Key.F1 && downKey <= Key.F12)
-                        || (downKey >= Key.D0 && downKey <= Key.D9)))
+
+                    //首次按下按键
+                    if ((HotKeyType.Main == hkType && (appConfig.HotkeyStr == null || appConfig.HotkeyStr.Length == 0))
+                        || (HotKeyType.ToDo == hkType && (appConfig.ToDoHotkeyStr == null || appConfig.ToDoHotkeyStr.Length == 0))
+                        || (HotKeyType.ColorPicker == hkType && (appConfig.ColorPickerHotkeyStr == null || appConfig.ColorPickerHotkeyStr.Length == 0))
+                        )
                     {
-                        switch (hkType)
+                        if (CheckModifierKeys(downKey))
                         {
-                            case HotKeyType.Main:
-                                appConfig.Hotkey = downKey;
-                                appConfig.HotkeyStr += downKey.ToString();
-                                break;
-                            case HotKeyType.ToDo:
-                                appConfig.ToDoHotkey = downKey;
-                                appConfig.ToDoHotkeyStr += downKey.ToString();
-                                break;
-                            case HotKeyType.ColorPicker:
-                                appConfig.ColorPickerHotkey = downKey;
-                                appConfig.ColorPickerHotkeyStr += downKey.ToString();
-                                break;
+                            //辅助键
+                            switch (hkType)
+                            {
+                                case HotKeyType.Main:
+                                    appConfig.HotkeyStr = GetKeyName(downKey);
+                                    appConfig.HotkeyModifiers = GetModifierKeys(downKey);
+                                    break;
+                                case HotKeyType.ToDo:
+                                    appConfig.ToDoHotkeyStr = GetKeyName(downKey);
+                                    appConfig.ToDoHotkeyModifiers = GetModifierKeys(downKey);
+                                    break;
+                                case HotKeyType.ColorPicker:
+                                    appConfig.ColorPickerHotkeyStr = GetKeyName(downKey);
+                                    appConfig.ColorPickerHotkeyModifiers = GetModifierKeys(downKey);
+                                    break;
+                            }
+                            Console.WriteLine("进入设置" + downKey.ToString());
+                            prevKeyTemp = downKey;
+                            keysTemp.Add(e);
                         }
-
-                        prevKeyTemp = downKey;
-                        keysTemp.Add(e);
                     }
-                    else if (CheckModifierKeys(downKey))
+                    else
                     {
-                        switch (hkType)
+                        //非首次按下  需要判断前一个键值是否为辅助键
+                        if (CheckModifierKeys(prevKeyTemp)
+                            && ((downKey >= Key.A && downKey <= Key.Z)
+                            || (downKey >= Key.F1 && downKey <= Key.F12)
+                            || (downKey >= Key.D0 && downKey <= Key.D9)
+                            || downKey == Key.Oem3
+                            ))
                         {
-                            case HotKeyType.Main:
-                                appConfig.HotkeyStr += GetKeyName(downKey);
-                                appConfig.HotkeyModifiers |= GetModifierKeys(downKey);
-                                break;
-                            case HotKeyType.ToDo:
-                                appConfig.ToDoHotkeyStr += GetKeyName(downKey);
-                                appConfig.ToDoHotkeyModifiers |= GetModifierKeys(downKey);
-                                break;
-                            case HotKeyType.ColorPicker:
-                                appConfig.ColorPickerHotkeyStr += GetKeyName(downKey);
-                                appConfig.ColorPickerHotkeyModifiers |= GetModifierKeys(downKey);
-                                break;
+                            KeyUtil.KeyProp keyProp = new KeyUtil.KeyProp();
+                            KeyUtil.KeyToChar(downKey, ref keyProp, true);
+                            string downKeyStr = keyProp.character.ToString();
+                            //string downKeyStr = "";
+                            switch (hkType)
+                            {
+                                case HotKeyType.Main:
+                                    appConfig.Hotkey = downKey;
+                                    appConfig.HotkeyStr += downKeyStr;
+                                    break;
+                                case HotKeyType.ToDo:
+                                    appConfig.ToDoHotkey = downKey;
+                                    appConfig.ToDoHotkeyStr += downKeyStr;
+                                    break;
+                                case HotKeyType.ColorPicker:
+                                    appConfig.ColorPickerHotkey = downKey;
+                                    appConfig.ColorPickerHotkeyStr += downKeyStr;
+                                    break;
+                            }
+                            prevKeyTemp = downKey;
+                            keysTemp.Add(e);
                         }
+                        else if (CheckModifierKeys(downKey))
+                        {
+                            switch (hkType)
+                            {
+                                case HotKeyType.Main:
+                                    appConfig.HotkeyStr += GetKeyName(downKey);
+                                    appConfig.HotkeyModifiers |= GetModifierKeys(downKey);
+                                    break;
+                                case HotKeyType.ToDo:
+                                    appConfig.ToDoHotkeyStr += GetKeyName(downKey);
+                                    appConfig.ToDoHotkeyModifiers |= GetModifierKeys(downKey);
+                                    break;
+                                case HotKeyType.ColorPicker:
+                                    appConfig.ColorPickerHotkeyStr += GetKeyName(downKey);
+                                    appConfig.ColorPickerHotkeyModifiers |= GetModifierKeys(downKey);
+                                    break;
+                            }
 
-                        prevKeyTemp = downKey;
-                        keysTemp.Add(e);
+                            prevKeyTemp = downKey;
+                            keysTemp.Add(e);
+                        }
                     }
                 }
             }
@@ -200,13 +213,9 @@ namespace GeekDesk.Control.UserControls.Config
         }
 
 
-        [MethodImpl(MethodImplOptions.Synchronized)]
+        //[MethodImpl(MethodImplOptions.Synchronized)]
         private void HotKeyUp(object sender, KeyEventArgs e)
         {
-            HotKeyType hkType = (HotKeyType)(sender as TextBox).Tag;
-
-            if (!CheckIsEnable(hkType)) return;
-
             lock (this)
             {
                 bool allKeyUp = true;
@@ -225,6 +234,9 @@ namespace GeekDesk.Control.UserControls.Config
                     prevKeyTemp = Key.None;
                     hotkeyFinished = true;
 
+                    HotKeyType hkType = (HotKeyType)(sender as TextBox).Tag;
+                    if (!CheckIsEnable(hkType)) return;
+
                     switch (hkType)
                     {
                         case HotKeyType.Main:
@@ -336,15 +348,41 @@ namespace GeekDesk.Control.UserControls.Config
             {
                 case HotKeyType.Main:
                     if (true == appConfig.EnableAppHotKey)
-                    MainWindow.RegisterHotKey(false);
+                    {
+                        MainWindow.RegisterHotKey(false);
+                    } else
+                    {
+                        if (MainWindow.hotKeyId != -1)
+                        {
+                            GlobalHotKey.Dispose(MainWindow.hotKeyId);
+                        }
+                    }
                     break;
                 case HotKeyType.ToDo:
                     if (true == appConfig.EnableTodoHotKey)
+                    {
                         MainWindow.RegisterCreateToDoHotKey(false);
+                    }
+                    else
+                    {
+                        if (MainWindow.hotKeyId != -1)
+                        {
+                            GlobalHotKey.Dispose(MainWindow.toDoHotKeyId);
+                        }
+                    }
                     break;
                 case HotKeyType.ColorPicker:
                     if (true == appConfig.EnableColorPickerHotKey)
+                    {
                         MainWindow.RegisterColorPickerHotKey(false);
+                    }
+                    else
+                    {
+                        if (MainWindow.hotKeyId != -1)
+                        {
+                            GlobalHotKey.Dispose(MainWindow.colorPickerHotKeyId);
+                        }
+                    }
                     break;
             }
         }

+ 1 - 0
Control/Windows/GlobalColorPickerWindow.xaml.cs

@@ -81,6 +81,7 @@ namespace GeekDesk.Control.Windows
             if (window == null || !window.Activate())
             {
                 window = new GlobalColorPickerWindow();
+                window.Show();
             }
             window.Hide();
             GlobalColorPickerWindow thisWindow = (GlobalColorPickerWindow)window;

+ 1 - 0
Util/GlobalHotKey.cs

@@ -10,6 +10,7 @@ namespace GeekDesk.Util
     {
         public enum HotkeyModifiers
         {
+            None = 0,
             MOD_ALT = 0x1,
             MOD_CONTROL = 0x2,
             MOD_SHIFT = 0x4,

+ 137 - 0
Util/KeyUtil.cs

@@ -0,0 +1,137 @@
+using System;
+
+using System.Windows.Input;
+
+namespace GeekDesk.Util
+{
+    public class KeyUtil
+    {
+        public class KeyProp
+        {
+            public Key key;
+            public bool printable;
+            public char character;
+            public bool shift;
+            public bool ctrl;
+            public bool alt;
+            public int type; //sideband
+            public string s;    //sideband
+        };
+
+        public static void KeyToChar(Key key,
+            ref KeyProp keyProp,
+            bool downCap = false,
+            bool downShift = false
+            )
+        {
+            bool iscap;
+            bool caplock = false;
+            bool shift;
+
+            keyProp.key = key;
+
+            keyProp.alt = Keyboard.IsKeyDown(Key.LeftAlt) ||
+                              Keyboard.IsKeyDown(Key.RightAlt);
+
+            keyProp.ctrl = Keyboard.IsKeyDown(Key.LeftCtrl) ||
+                              Keyboard.IsKeyDown(Key.RightCtrl);
+
+            keyProp.shift = Keyboard.IsKeyDown(Key.LeftShift) ||
+                              Keyboard.IsKeyDown(Key.RightShift);
+
+            if (keyProp.alt || keyProp.ctrl)
+            {
+                keyProp.printable = false;
+                keyProp.type = 1;
+            }
+            else
+            {
+                keyProp.printable = true;
+                keyProp.type = 0;
+            }
+
+            shift = downShift || keyProp.shift;
+            //caplock = Console.CapsLock; //Keyboard.IsKeyToggled(Key.CapsLock);
+            iscap = downCap || ((caplock && !shift) || (!caplock && shift));
+
+            switch (key)
+            {
+                case Key.Enter: keyProp.character = '\n'; return;
+                case Key.A: keyProp.character = (iscap ? 'A' : 'a'); return;
+                case Key.B: keyProp.character = (iscap ? 'B' : 'b'); return;
+                case Key.C: keyProp.character = (iscap ? 'C' : 'c'); return;
+                case Key.D: keyProp.character = (iscap ? 'D' : 'd'); return;
+                case Key.E: keyProp.character = (iscap ? 'E' : 'e'); return;
+                case Key.F: keyProp.character = (iscap ? 'F' : 'f'); return;
+                case Key.G: keyProp.character = (iscap ? 'G' : 'g'); return;
+                case Key.H: keyProp.character = (iscap ? 'H' : 'h'); return;
+                case Key.I: keyProp.character = (iscap ? 'I' : 'i'); return;
+                case Key.J: keyProp.character = (iscap ? 'J' : 'j'); return;
+                case Key.K: keyProp.character = (iscap ? 'K' : 'k'); return;
+                case Key.L: keyProp.character = (iscap ? 'L' : 'l'); return;
+                case Key.M: keyProp.character = (iscap ? 'M' : 'm'); return;
+                case Key.N: keyProp.character = (iscap ? 'N' : 'n'); return;
+                case Key.O: keyProp.character = (iscap ? 'O' : 'o'); return;
+                case Key.P: keyProp.character = (iscap ? 'P' : 'p'); return;
+                case Key.Q: keyProp.character = (iscap ? 'Q' : 'q'); return;
+                case Key.R: keyProp.character = (iscap ? 'R' : 'r'); return;
+                case Key.S: keyProp.character = (iscap ? 'S' : 's'); return;
+                case Key.T: keyProp.character = (iscap ? 'T' : 't'); return;
+                case Key.U: keyProp.character = (iscap ? 'U' : 'u'); return;
+                case Key.V: keyProp.character = (iscap ? 'V' : 'v'); return;
+                case Key.W: keyProp.character = (iscap ? 'W' : 'w'); return;
+                case Key.X: keyProp.character = (iscap ? 'X' : 'x'); return;
+                case Key.Y: keyProp.character = (iscap ? 'Y' : 'y'); return;
+                case Key.Z: keyProp.character = (iscap ? 'Z' : 'z'); return;
+                case Key.D0: keyProp.character = (shift ? ')' : '0'); return;
+                case Key.D1: keyProp.character = (shift ? '!' : '1'); return;
+                case Key.D2: keyProp.character = (shift ? '@' : '2'); return;
+                case Key.D3: keyProp.character = (shift ? '#' : '3'); return;
+                case Key.D4: keyProp.character = (shift ? '$' : '4'); return;
+                case Key.D5: keyProp.character = (shift ? '%' : '5'); return;
+                case Key.D6: keyProp.character = (shift ? '^' : '6'); return;
+                case Key.D7: keyProp.character = (shift ? '&' : '7'); return;
+                case Key.D8: keyProp.character = (shift ? '*' : '8'); return;
+                case Key.D9: keyProp.character = (shift ? '(' : '9'); return;
+                case Key.OemPlus: keyProp.character = (shift ? '+' : '='); return;
+                case Key.OemMinus: keyProp.character = (shift ? '_' : '-'); return;
+                case Key.OemQuestion: keyProp.character = (shift ? '?' : '/'); return;
+                case Key.OemComma: keyProp.character = (shift ? '<' : ','); return;
+                case Key.OemPeriod: keyProp.character = (shift ? '>' : '.'); return;
+                case Key.OemOpenBrackets: keyProp.character = (shift ? '{' : '['); return;
+                case Key.OemQuotes: keyProp.character = (shift ? '"' : '\''); return;
+                case Key.Oem1: keyProp.character = (shift ? ':' : ';'); return;
+                case Key.Oem3: keyProp.character = (shift ? '~' : '`'); return;
+                case Key.Oem5: keyProp.character = (shift ? '|' : '\\'); return;
+                case Key.Oem6: keyProp.character = (shift ? '}' : ']'); return;
+                case Key.Tab: keyProp.character = '\t'; return;
+                case Key.Space: keyProp.character = ' '; return;
+
+                // Number Pad
+                case Key.NumPad0: keyProp.character = '0'; return;
+                case Key.NumPad1: keyProp.character = '1'; return;
+                case Key.NumPad2: keyProp.character = '2'; return;
+                case Key.NumPad3: keyProp.character = '3'; return;
+                case Key.NumPad4: keyProp.character = '4'; return;
+                case Key.NumPad5: keyProp.character = '5'; return;
+                case Key.NumPad6: keyProp.character = '6'; return;
+                case Key.NumPad7: keyProp.character = '7'; return;
+                case Key.NumPad8: keyProp.character = '8'; return;
+                case Key.NumPad9: keyProp.character = '9'; return;
+                case Key.Subtract: keyProp.character = '-'; return;
+                case Key.Add: keyProp.character = '+'; return;
+                case Key.Decimal: keyProp.character = '.'; return;
+                case Key.Divide: keyProp.character = '/'; return;
+                case Key.Multiply: keyProp.character = '*'; return;
+
+                default:
+                    keyProp.type = 1;
+                    keyProp.printable = false;
+                    keyProp.character = '\x00';
+                    return;
+            } //switch  
+        }
+
+
+    }
+}

+ 17 - 2
ViewModel/AppConfig.cs

@@ -86,14 +86,29 @@ namespace GeekDesk.ViewModel
 
         private GradientBGParam gradientBGParam = null; //渐变背景参数
 
-        private bool? enableAppHotKey = true;  //可能为null
-        private bool? enableTodoHotKey = true; //可能为null
+        private bool? enableAppHotKey = true;  //可能为null 开启热键
+        private bool? enableTodoHotKey = true; //可能为null 开启待办热键
 
         private bool enableColorPickerHotKey;  //新增 默认为false 不需要考虑null值
 
+        private SearchType searchType;
+
 
         #region GetSet
 
+        public SearchType SearchType
+        {
+            get
+            {
+                return searchType;
+            }
+            set
+            {
+                searchType = value;
+                OnPropertyChanged("SearchType");
+            }
+        }
+
         public bool EnableColorPickerHotKey
         {
             get