增加Esc退出窗口
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<appSettings>
|
||||
<add key="Version" value="2.3.20" />
|
||||
<add key="Version" value="2.4.10" />
|
||||
<add key="GitHubUrl" value="https://github.com/Demo-Liu/GeekDesk" />
|
||||
<add key="GiteeUrl" value="https://gitee.com/demo_liu/GeekDesk/tree/master" />
|
||||
<add key="GitHubUpdateUrl" value="https://demo-liu.github.io/GeekDesk/Update.json" />
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace GeekDesk.Constant
|
||||
public static string APP_DIR = AppDomain.CurrentDomain.BaseDirectory.Trim();
|
||||
|
||||
// 是否为开发模式
|
||||
public static bool DEV = false;
|
||||
public static bool DEV = true;
|
||||
|
||||
public static string MY_NAME = DEV ? "GeekDesk-D" : "GeekDesk";
|
||||
|
||||
|
||||
@@ -28,11 +28,11 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
if (appData.AppConfig.SelectedMenuIndex >= appData.MenuList.Count || appData.AppConfig.SelectedMenuIndex == -1)
|
||||
{
|
||||
appData.AppConfig.SelectedMenuIcons = appData.MenuList[0].IconList;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
appData.AppConfig.SelectedMenuIcons = appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
DelegateCommand<int[]> _swap;
|
||||
@@ -207,8 +207,9 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
//设置对应菜单的图标列表
|
||||
if (MenuListBox.SelectedIndex == -1)
|
||||
{
|
||||
appData.AppConfig.SelectedMenuIcons = appData.MenuList[appData.MenuList.Count-1].IconList;
|
||||
} else
|
||||
appData.AppConfig.SelectedMenuIcons = appData.MenuList[appData.MenuList.Count - 1].IconList;
|
||||
}
|
||||
else
|
||||
{
|
||||
appData.AppConfig.SelectedMenuIcons = appData.MenuList[MenuListBox.SelectedIndex].IconList;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
AllowsTransparency="True"
|
||||
Background="#00FFFFFF" ShowInTaskbar="False"
|
||||
BorderThickness="0"
|
||||
Focusable="True"
|
||||
KeyDown="OnKeyDown"
|
||||
>
|
||||
|
||||
<Grid Margin="30">
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Control.UserControls;
|
||||
using GeekDesk.Control.UserControls.Config;
|
||||
using GeekDesk.Interface;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using HandyControl.Controls;
|
||||
@@ -15,7 +16,7 @@ namespace GeekDesk.Control.Windows
|
||||
/// <summary>
|
||||
/// ConfigDialog.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ConfigWindow
|
||||
public partial class ConfigWindow : IWindowCommon
|
||||
{
|
||||
private static readonly AboutControl about = new AboutControl();
|
||||
private static readonly ThemeControl theme = new ThemeControl();
|
||||
@@ -87,6 +88,15 @@ namespace GeekDesk.Control.Windows
|
||||
window = new ConfigWindow(appConfig, mainWindow);
|
||||
}
|
||||
window.Show();
|
||||
Keyboard.Focus(window);
|
||||
}
|
||||
|
||||
public void OnKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Escape)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
AllowsTransparency="True"
|
||||
Background="Transparent" ShowInTaskbar="False"
|
||||
BorderThickness="0"
|
||||
Focusable="True"
|
||||
KeyDown="OnKeyDown"
|
||||
>
|
||||
|
||||
<Window.Resources>
|
||||
@@ -39,7 +41,7 @@
|
||||
<DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray"
|
||||
RenderingBias="Quality" ShadowDepth="2"/>
|
||||
</Grid.Effect>
|
||||
<Border MouseDown="DragMove" Style="{StaticResource BorderBG}">
|
||||
<Border MouseDown="DragMove" Style="{StaticResource BorderBG}" hc:Dialog.Token="IconUrlDialog">
|
||||
<!--<Border.Background>
|
||||
--><!--<SolidColorBrush Color="AliceBlue" Opacity="0.9"/>--><!--
|
||||
<LinearGradientBrush Opacity="0.97">
|
||||
@@ -47,6 +49,7 @@
|
||||
<GradientStop Color="#97D282" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</Border.Background>-->
|
||||
<hc:DialogContainer>
|
||||
<Grid MouseDown="DragMove">
|
||||
<TextBox x:Name="CheckSettingUrl" Visibility="Collapsed" Text="{Binding IsSettingUrl}" TextChanged="CheckSettingUrl_TextChanged"/>
|
||||
<hc:TabControl x:Name="MyTabControl"
|
||||
@@ -76,6 +79,7 @@
|
||||
<Button Content="自定义设置" Click="CustomButton_Click" IsEnabled="False" Name="CustomButton" Style="{StaticResource Btn1}" Margin="447,397.5,71,22.5"/>
|
||||
<Button Content="确定" Click="Confirm_Click" Style="{StaticResource Btn1}" Margin="534,397.5,20,22.5" />
|
||||
</Grid>
|
||||
</hc:DialogContainer>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using GeekDesk.Control.Other;
|
||||
using GeekDesk.Interface;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
|
||||
@@ -17,7 +18,7 @@ namespace GeekDesk.Control.Windows
|
||||
/// <summary>
|
||||
/// IconfontWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class IconfontWindow : Window
|
||||
public partial class IconfontWindow : Window, IWindowCommon
|
||||
{
|
||||
private static AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||
private static MenuInfo menuInfo;
|
||||
@@ -71,7 +72,7 @@ namespace GeekDesk.Control.Windows
|
||||
{
|
||||
LoadingEle.Visibility = Visibility.Visible;
|
||||
CustomIcon.Visibility = Visibility.Collapsed;
|
||||
HandyControl.Controls.Dialog.Show(new CustomIconUrlDialog(appConfig));
|
||||
HandyControl.Controls.Dialog.Show(new CustomIconUrlDialog(appConfig), "IconUrlDialog");
|
||||
} else
|
||||
{
|
||||
if (customIcons == null)
|
||||
@@ -132,6 +133,7 @@ namespace GeekDesk.Control.Windows
|
||||
window = new IconfontWindow(listInfo, menuInfo);
|
||||
}
|
||||
window.Show();
|
||||
Keyboard.Focus(window);
|
||||
ShowWindowFollowMouse.Show(window, MousePosition.LEFT_CENTER, 0, 0, false);
|
||||
}
|
||||
|
||||
@@ -172,6 +174,13 @@ namespace GeekDesk.Control.Windows
|
||||
}
|
||||
}
|
||||
|
||||
public void OnKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Escape)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public class IconfontViewModel : INotifyPropertyChanged
|
||||
{
|
||||
|
||||
@@ -11,8 +11,11 @@
|
||||
Height="450"
|
||||
Width="510"
|
||||
WindowStyle="None"
|
||||
Title=""
|
||||
AllowsTransparency="True"
|
||||
Background="Transparent" ShowInTaskbar="False"
|
||||
Focusable="True"
|
||||
KeyDown="OnKeyDown"
|
||||
>
|
||||
<Window.Resources>
|
||||
<cvt:TodoTaskExecConvert x:Key="TodoTaskExecConvert"/>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Interface;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using HandyControl.Controls;
|
||||
@@ -22,7 +23,7 @@ namespace GeekDesk.Control.Windows
|
||||
/// <summary>
|
||||
/// BacklogInfoWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ToDoInfoWindow
|
||||
public partial class ToDoInfoWindow : IWindowCommon
|
||||
{
|
||||
|
||||
private static int windowType = -1;
|
||||
@@ -207,6 +208,7 @@ namespace GeekDesk.Control.Windows
|
||||
{
|
||||
window = new ToDoInfoWindow();
|
||||
window.Show();
|
||||
Keyboard.Focus(window);
|
||||
}
|
||||
window.Visibility = Visibility.Collapsed;
|
||||
windowType = NEW_TODO;
|
||||
@@ -222,6 +224,7 @@ namespace GeekDesk.Control.Windows
|
||||
}
|
||||
windowType = DETAIL_TODO;
|
||||
window2.Show();
|
||||
Keyboard.Focus(window2);
|
||||
}
|
||||
|
||||
private void ExecType_Checked(object sender, RoutedEventArgs e)
|
||||
@@ -239,5 +242,13 @@ namespace GeekDesk.Control.Windows
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Escape)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
WindowStyle="None"
|
||||
AllowsTransparency="True"
|
||||
Background="Transparent" ShowInTaskbar="False"
|
||||
Focusable="True"
|
||||
KeyDown="OnKeyDown"
|
||||
>
|
||||
|
||||
<Grid Margin="50">
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using GeekDesk.Control.UserControls.Backlog;
|
||||
using GeekDesk.Interface;
|
||||
using GeekDesk.ViewModel;
|
||||
using HandyControl.Controls;
|
||||
using System;
|
||||
@@ -21,7 +22,7 @@ namespace GeekDesk.Control.Windows
|
||||
/// <summary>
|
||||
/// BacklogWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ToDoWindow
|
||||
public partial class ToDoWindow : IWindowCommon
|
||||
{
|
||||
private static TodoControl backlog = new TodoControl();
|
||||
private AppData appData = MainWindow.appData;
|
||||
@@ -94,8 +95,15 @@ namespace GeekDesk.Control.Windows
|
||||
window = new ToDoWindow();
|
||||
}
|
||||
window.Show();
|
||||
Keyboard.Focus(window);
|
||||
}
|
||||
|
||||
|
||||
public void OnKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Escape)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,10 @@
|
||||
Height="460" Width="610"
|
||||
WindowStyle="None"
|
||||
AllowsTransparency="True"
|
||||
Background="Transparent" ShowInTaskbar="False">
|
||||
Title=""
|
||||
Background="Transparent" ShowInTaskbar="False"
|
||||
Focusable="True"
|
||||
KeyDown="OnKeyDown">
|
||||
<Grid Margin="20">
|
||||
<Grid.Effect>
|
||||
<DropShadowEffect BlurRadius="30" Direction="-90" Color="Gray"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Interface;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using Newtonsoft.Json.Linq;
|
||||
@@ -23,7 +24,7 @@ namespace GeekDesk.Control.Windows
|
||||
/// <summary>
|
||||
/// UpdateWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class UpdateWindow : Window
|
||||
public partial class UpdateWindow : Window, IWindowCommon
|
||||
{
|
||||
private static AppConfig appConfig = MainWindow.appData.AppConfig;
|
||||
private static string githubUrl = "";
|
||||
@@ -103,6 +104,15 @@ namespace GeekDesk.Control.Windows
|
||||
window = new UpdateWindow(jo);
|
||||
}
|
||||
window.Show();
|
||||
Keyboard.Focus(window);
|
||||
}
|
||||
|
||||
public void OnKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Escape)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,6 +189,7 @@
|
||||
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.cs" />
|
||||
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.Drag.cs" />
|
||||
<Compile Include="Converts\HideTypeConvert.cs" />
|
||||
<Compile Include="Interface\WindowCommon.cs" />
|
||||
<Compile Include="Task\ToDoTask.cs" />
|
||||
<Compile Include="Thread\MouseHookThread.cs" />
|
||||
<Compile Include="Thread\DispatcherBuild.cs" />
|
||||
|
||||
15
Interface/WindowCommon.cs
Normal file
15
Interface/WindowCommon.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace GeekDesk.Interface
|
||||
{
|
||||
public interface IWindowCommon
|
||||
{
|
||||
void OnKeyDown(object sender, KeyEventArgs e);
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
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" xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel" d:DataContext="{d:DesignInstance Type=viewmodel:AppData}"
|
||||
Title="GeekDesk"
|
||||
d:DesignHeight="500" d:DesignWidth="700"
|
||||
WindowStyle="None"
|
||||
@@ -19,6 +19,8 @@
|
||||
Opacity="0"
|
||||
Deactivated="Window_Deactivated"
|
||||
SizeChanged="Window_SizeChanged"
|
||||
KeyDown="OnKeyDown"
|
||||
Focusable="True"
|
||||
>
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome CaptionHeight="0" ResizeBorderThickness="15"/>
|
||||
@@ -114,6 +116,7 @@
|
||||
|
||||
|
||||
<uc:LeftCardControl Grid.Row="1" Grid.Column="0"/>
|
||||
|
||||
<!--分割线-->
|
||||
<GridSplitter Opacity="0" Grid.Row="1" Grid.Column="0" Width="1" VerticalAlignment="Stretch" HorizontalAlignment="Right"/>
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using GeekDesk.Constant;
|
||||
using GeekDesk.Control;
|
||||
using GeekDesk.Control.UserControls.Config;
|
||||
using GeekDesk.Control.Windows;
|
||||
using GeekDesk.Interface;
|
||||
using GeekDesk.Task;
|
||||
using GeekDesk.Thread;
|
||||
using GeekDesk.Util;
|
||||
@@ -29,13 +30,10 @@ namespace GeekDesk
|
||||
/// MainWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
///
|
||||
public partial class MainWindow : Window
|
||||
public partial class MainWindow : Window, IWindowCommon
|
||||
{
|
||||
|
||||
//public IKeyboardMouseEvents m_GlobalHook = Hook.GlobalEvents();
|
||||
|
||||
public static AppData appData = CommonCode.GetAppDataByFile();
|
||||
//public static ToDoInfoWindow toDoInfoWindow = (ToDoInfoWindow)ToDoInfoWindow.GetThis();
|
||||
public static ToDoInfoWindow toDoInfoWindow;
|
||||
public static int hotKeyId = -1;
|
||||
public static int toDoHotKeyId = -1;
|
||||
@@ -95,6 +93,7 @@ namespace GeekDesk
|
||||
ShowApp();
|
||||
}
|
||||
|
||||
//给任务栏图标一个名字
|
||||
BarIcon.Text = Constants.MY_NAME;
|
||||
|
||||
//注册热键
|
||||
@@ -108,36 +107,12 @@ namespace GeekDesk
|
||||
}
|
||||
|
||||
//注册鼠标中键监听事件
|
||||
//m_GlobalHook.MouseUpExt += M_GlobalHook_MouseUpExt;
|
||||
MouseHookThread.MiddleHook();
|
||||
|
||||
//更新线程开启 检测更新
|
||||
UpdateThread.Update();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 鼠标中键呼出
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
//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();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 注册当前窗口的热键
|
||||
/// </summary>
|
||||
@@ -283,10 +258,6 @@ namespace GeekDesk
|
||||
/// <param name="e"></param>
|
||||
private void DragMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
//if (e.LeftButton == MouseButtonState.Pressed)
|
||||
//{
|
||||
// this.DragMove();
|
||||
//}
|
||||
|
||||
if (e.LeftButton == MouseButtonState.Pressed)
|
||||
{
|
||||
@@ -303,7 +274,6 @@ namespace GeekDesk
|
||||
(When clicking the drag area, make the window follow) */
|
||||
DragMove();
|
||||
|
||||
|
||||
if (this.ResizeMode != windowMode)
|
||||
{
|
||||
this.ResizeMode = windowMode;
|
||||
@@ -526,6 +496,15 @@ namespace GeekDesk
|
||||
{
|
||||
appData.AppConfig.ShowBarIcon = false;
|
||||
}
|
||||
|
||||
|
||||
public void OnKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Escape)
|
||||
{
|
||||
HideApp();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -49,5 +49,5 @@ using System.Windows;
|
||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||
//通过使用 "*",如下所示:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.3.2.0")]
|
||||
[assembly: AssemblyFileVersion("2.3.2.0")]
|
||||
[assembly: AssemblyVersion("2.4.1.0")]
|
||||
[assembly: AssemblyFileVersion("2.4.1.0")]
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"title": "<22>汾<EFBFBD><E6B1BE><EFBFBD><EFBFBD>",
|
||||
"subTitle": "V2.3.20 <20><>ʽ<EFBFBD><CABD>",
|
||||
"subTitle": "V2.4.10",
|
||||
"msgTitle": "<22><><EFBFBD>θ<EFBFBD><CEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
|
||||
"msg": "['һ<EFBFBD><EFBFBD>С<EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><EFBFBD><DEB8><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>bug<75><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><CBB2>ֹ<EFBFBD><D6B9><EFBFBD>','<27><EFBFBD><DEB8><EFBFBD><DEB7>IJ˵<C4B2>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD>bug','<27><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״bug','<27><EFBFBD><DEB8>ȼ<EFBFBD><C8BC><EFBFBD>֧<EFBFBD><D6A7>Alt<6C><74>bug','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD>깦<EFBFBD><EAB9A6>','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>ȥ<EFBFBD><C8A5><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>star<61><EFBFBD>']",
|
||||
"msg": "['<EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD>ڿ<EFBFBD>Esc<EFBFBD>˳<EFBFBD>']",
|
||||
"githubUrl": "https://github.com/Demo-Liu/GeekDesk/releases",
|
||||
"giteeUrl": "https://gitee.com/demo_liu/GeekDesk/releases",
|
||||
"version": "2.3.20"
|
||||
"version": "2.4.10"
|
||||
}
|
||||
Reference in New Issue
Block a user