From e6a95c4668ac436a08c8d544bc1d5d7dc9cd954e Mon Sep 17 00:00:00 2001 From: liufei Date: Mon, 20 Dec 2021 09:39:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0Esc=E9=80=80=E5=87=BA?= =?UTF-8?q?=E7=AA=97=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.config | 2 +- Constant/Constants.cs | 2 +- .../PannelCard/LeftCardControl.xaml.cs | 9 ++-- Control/Windows/ConfigWindow.xaml | 2 + Control/Windows/ConfigWindow.xaml.cs | 12 ++++- Control/Windows/IconfontWindow.xaml | 44 +++++++++--------- Control/Windows/IconfontWindow.xaml.cs | 13 +++++- Control/Windows/ToDoInfoWindow.xaml | 5 ++- Control/Windows/ToDoInfoWindow.xaml.cs | 13 +++++- Control/Windows/ToDoWindow.xaml | 2 + Control/Windows/ToDoWindow.xaml.cs | 12 ++++- Control/Windows/UpdateWindow.xaml | 5 ++- Control/Windows/UpdateWindow.xaml.cs | 12 ++++- GeekDesk.csproj | 1 + Interface/WindowCommon.cs | 15 +++++++ MainWindow.xaml | 7 ++- MainWindow.xaml.cs | 45 +++++-------------- Properties/AssemblyInfo.cs | 4 +- Update.json | 6 +-- 19 files changed, 136 insertions(+), 75 deletions(-) create mode 100644 Interface/WindowCommon.cs diff --git a/App.config b/App.config index 544efdc..8705f81 100644 --- a/App.config +++ b/App.config @@ -28,7 +28,7 @@ - + diff --git a/Constant/Constants.cs b/Constant/Constants.cs index eae0885..1cda463 100644 --- a/Constant/Constants.cs +++ b/Constant/Constants.cs @@ -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"; diff --git a/Control/UserControls/PannelCard/LeftCardControl.xaml.cs b/Control/UserControls/PannelCard/LeftCardControl.xaml.cs index ec537e4..dbe4646 100644 --- a/Control/UserControls/PannelCard/LeftCardControl.xaml.cs +++ b/Control/UserControls/PannelCard/LeftCardControl.xaml.cs @@ -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 _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; } diff --git a/Control/Windows/ConfigWindow.xaml b/Control/Windows/ConfigWindow.xaml index 73cd8ad..dc063f5 100644 --- a/Control/Windows/ConfigWindow.xaml +++ b/Control/Windows/ConfigWindow.xaml @@ -15,6 +15,8 @@ AllowsTransparency="True" Background="#00FFFFFF" ShowInTaskbar="False" BorderThickness="0" + Focusable="True" + KeyDown="OnKeyDown" > diff --git a/Control/Windows/ConfigWindow.xaml.cs b/Control/Windows/ConfigWindow.xaml.cs index 915754e..6d334d9 100644 --- a/Control/Windows/ConfigWindow.xaml.cs +++ b/Control/Windows/ConfigWindow.xaml.cs @@ -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 /// /// ConfigDialog.xaml 的交互逻辑 /// - 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(); + } } } } diff --git a/Control/Windows/IconfontWindow.xaml b/Control/Windows/IconfontWindow.xaml index a6efc33..bb9803f 100644 --- a/Control/Windows/IconfontWindow.xaml +++ b/Control/Windows/IconfontWindow.xaml @@ -14,6 +14,8 @@ AllowsTransparency="True" Background="Transparent" ShowInTaskbar="False" BorderThickness="0" + Focusable="True" + KeyDown="OnKeyDown" > @@ -39,7 +41,7 @@ - + - - - + + + - - - - - - - - - - - - + + + + + + + + + + + + -