晚安, 还在功能性开发
This commit is contained in:
@@ -105,7 +105,7 @@
|
|||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<StackPanel MouseLeftButtonDown="MenuClick" Tag="{Binding}">
|
<StackPanel MouseLeftButtonDown="MenuClick" Tag="{Binding}">
|
||||||
<TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
|
<hc:TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}}"
|
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}}"
|
||||||
FontSize="15"
|
FontSize="15"
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="30,50,0,-102.337" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="30,50,0,-102.337" Grid.ColumnSpan="4">
|
||||||
<CheckBox Content="显示时追随鼠标位置" IsChecked="{Binding FollowMouse}" Unchecked="CheckBox_Unchecked">
|
<CheckBox Content="显示时追随鼠标位置" IsChecked="{Binding FollowMouse}">
|
||||||
<CheckBox.Background>
|
<CheckBox.Background>
|
||||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||||
<GradientStop Color="#FF9EA3A6"/>
|
<GradientStop Color="#FF9EA3A6"/>
|
||||||
@@ -56,6 +56,14 @@
|
|||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="30,193,0,-180.337" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="30,193,0,-180.337" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="当前热键:"/>
|
<TextBlock Text="当前热键:"/>
|
||||||
|
<hc:TextBox HorizontalAlignment="Left"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
IsReadOnly="True"
|
||||||
|
IsReadOnlyCaretVisible="True"
|
||||||
|
Width="80"
|
||||||
|
Text="{Binding HotkeyStr}"
|
||||||
|
KeyDown="HotKeyDown"
|
||||||
|
Margin="12.967,-7.38,-12.967,0"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
</hc:SimplePanel>
|
</hc:SimplePanel>
|
||||||
|
|
||||||
|
|||||||
@@ -23,16 +23,40 @@ namespace GeekDesk.Control.UserControls
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class MotionControl : UserControl
|
public partial class MotionControl : UserControl
|
||||||
{
|
{
|
||||||
|
private static bool controlKeyDown = false;
|
||||||
|
private static AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||||
|
|
||||||
public MotionControl()
|
public MotionControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckBox_Unchecked(object sender, RoutedEventArgs e)
|
|
||||||
|
/// <summary>
|
||||||
|
/// 热键按下
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void HotKeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (e.KeyboardDevice.Modifiers.HasFlag(ModifierKeys.Control)
|
||||||
|
|| e.KeyboardDevice.Modifiers.HasFlag(ModifierKeys.Windows)
|
||||||
|
|| e.KeyboardDevice.Modifiers.HasFlag(ModifierKeys.Alt)
|
||||||
|
|| (e.Key >= Key.A && e.Key <= Key.Z))
|
||||||
|
{
|
||||||
|
if (e.KeyboardDevice.Modifiers.HasFlag(ModifierKeys.Control)
|
||||||
|
|| e.KeyboardDevice.Modifiers.HasFlag(ModifierKeys.Windows)
|
||||||
|
|| e.KeyboardDevice.Modifiers.HasFlag(ModifierKeys.Alt))
|
||||||
|
{
|
||||||
|
appConfig.HotkeyStr = "Ctrl + ";
|
||||||
|
} else if (e.KeyboardDevice.Modifiers.HasFlag(ModifierKeys.Control)
|
||||||
|
|| e.KeyboardDevice.Modifiers.HasFlag(ModifierKeys.Windows)
|
||||||
|
|| e.KeyboardDevice.Modifiers.HasFlag(ModifierKeys.Alt)
|
||||||
|
&& (e.Key >= Key.A && e.Key <= Key.Z))
|
||||||
|
{
|
||||||
|
appConfig.HotkeyStr += e.Key.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,6 +53,9 @@
|
|||||||
<Reference Include="GalaSoft.MvvmLight.Platform, Version=5.4.1.0, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL">
|
<Reference Include="GalaSoft.MvvmLight.Platform, Version=5.4.1.0, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath>
|
<HintPath>packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="GlobalHotKey, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\GlobalHotKey.1.1.0\lib\GlobalHotKey.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="HandyControl, Version=3.1.0.0, Culture=neutral, PublicKeyToken=45be8712787a1e5b, processorArchitecture=MSIL">
|
<Reference Include="HandyControl, Version=3.1.0.0, Culture=neutral, PublicKeyToken=45be8712787a1e5b, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\HandyControl.3.1.0\lib\net452\HandyControl.dll</HintPath>
|
<HintPath>packages\HandyControl.3.1.0\lib\net452\HandyControl.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using GeekDesk.Constant;
|
|||||||
using GeekDesk.Control;
|
using GeekDesk.Control;
|
||||||
using GeekDesk.Util;
|
using GeekDesk.Util;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
|
using GlobalHotKey;
|
||||||
using SharpShell.SharpContextMenu;
|
using SharpShell.SharpContextMenu;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
@@ -53,7 +54,7 @@ namespace GeekDesk
|
|||||||
this.Visibility = Visibility.Collapsed;
|
this.Visibility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
//加载完毕注册热键
|
//加载完毕注册热键
|
||||||
Hotkey.Regist(this, HotkeyModifiers.MOD_CONTROL, Key.Y, ()=>
|
Hotkey.Regist(this, HotkeyModifiers.MOD_CONTROL | HotkeyModifiers.MOD_ALT, Key.Y, ()=>
|
||||||
{
|
{
|
||||||
if (this.Visibility == Visibility.Collapsed)
|
if (this.Visibility == Visibility.Collapsed)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ namespace GeekDesk.Util
|
|||||||
public delegate void HotKeyCallBackHanlder();
|
public delegate void HotKeyCallBackHanlder();
|
||||||
}
|
}
|
||||||
|
|
||||||
enum HotkeyModifiers
|
public enum HotkeyModifiers
|
||||||
{
|
{
|
||||||
MOD_ALT = 0x1,
|
MOD_ALT = 0x1,
|
||||||
MOD_CONTROL = 0x2,
|
MOD_CONTROL = 0x2,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using System;
|
|||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -36,8 +37,48 @@ namespace GeekDesk.ViewModel
|
|||||||
private int pannelCornerRadius = 4; //面板圆角 默认4
|
private int pannelCornerRadius = 4; //面板圆角 默认4
|
||||||
[field: NonSerialized]
|
[field: NonSerialized]
|
||||||
private ObservableCollection<IconInfo> selectedMenuIcons;
|
private ObservableCollection<IconInfo> selectedMenuIcons;
|
||||||
|
private string hotkeyStr;
|
||||||
|
private HotkeyModifiers hotkeyModifiers;
|
||||||
|
private Key hotkey;
|
||||||
|
|
||||||
#region GetSet
|
#region GetSet
|
||||||
|
public Key Hotkey
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return hotkey;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
hotkey = value;
|
||||||
|
OnPropertyChanged("Hotkey");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string HotkeyStr
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return hotkeyStr;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
hotkeyStr = value;
|
||||||
|
OnPropertyChanged("HotkeyStr");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public HotkeyModifiers HotkeyModifiers
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return hotkeyModifiers;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
hotkeyModifiers = value;
|
||||||
|
OnPropertyChanged("HotkeyModifiers");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ObservableCollection<IconInfo> SelectedMenuIcons
|
public ObservableCollection<IconInfo> SelectedMenuIcons
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="CommonServiceLocator" version="2.0.6" targetFramework="net452" requireReinstallation="true" />
|
<package id="CommonServiceLocator" version="2.0.6" targetFramework="net452" requireReinstallation="true" />
|
||||||
|
<package id="GlobalHotKey" version="1.1.0" targetFramework="net472" />
|
||||||
<package id="HandyControl" version="3.1.0" targetFramework="net452" requireReinstallation="true" />
|
<package id="HandyControl" version="3.1.0" targetFramework="net452" requireReinstallation="true" />
|
||||||
<package id="MvvmLightLibs" version="5.4.1.1" targetFramework="net472" />
|
<package id="MvvmLightLibs" version="5.4.1.1" targetFramework="net472" />
|
||||||
<package id="SharpShell" version="2.7.2" targetFramework="net472" />
|
<package id="SharpShell" version="2.7.2" targetFramework="net472" />
|
||||||
|
|||||||
Reference in New Issue
Block a user