From eec261ca4af23456e0003dc53eb368980bc3679a Mon Sep 17 00:00:00 2001 From: liufei Date: Fri, 8 Apr 2022 16:05:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=90=9C=E7=B4=A2Item=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Constant/RunTimeStatus.cs | 17 +++++++++++++++ .../PannelCard/LeftCardControl.xaml.cs | 8 +------ .../PannelCard/RightCardControl.xaml | 21 ++++++++++++++----- .../PannelCard/RightCardControl.xaml.cs | 21 ++++++++++++++++++- Converts/SearchResWidth.cs | 12 +++++++++-- GeekDesk.csproj | 1 + MainWindow.xaml | 1 - MainWindow.xaml.cs | 10 ++++----- MainWindow.xaml.rej | 9 ++++++++ 9 files changed, 78 insertions(+), 22 deletions(-) create mode 100644 Constant/RunTimeStatus.cs create mode 100644 MainWindow.xaml.rej diff --git a/Constant/RunTimeStatus.cs b/Constant/RunTimeStatus.cs new file mode 100644 index 0000000..ae58d12 --- /dev/null +++ b/Constant/RunTimeStatus.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace GeekDesk.Constant +{ + internal class RunTimeStatus + { + + /// + /// 查询框是否在工作 + /// + public static bool SEARCH_BOX_SHOW = false; + } +} diff --git a/Control/UserControls/PannelCard/LeftCardControl.xaml.cs b/Control/UserControls/PannelCard/LeftCardControl.xaml.cs index 3150af2..7ed41bd 100644 --- a/Control/UserControls/PannelCard/LeftCardControl.xaml.cs +++ b/Control/UserControls/PannelCard/LeftCardControl.xaml.cs @@ -1,4 +1,5 @@ using DraggAnimatedPanelExample; +using GeekDesk.Constant; using GeekDesk.Control.Windows; using GeekDesk.MyThread; using GeekDesk.Util; @@ -111,13 +112,6 @@ namespace GeekDesk.Control.UserControls.PannelCard } } - //////菜单点击事件 - //private void MenuClick(object sender, MouseButtonEventArgs e) - //{ - // //设置对应菜单的图标列表 - // MenuInfo mi = (MenuInfo)(((StackPanel)sender).Tag); - // appData.AppConfig.SelectedMenuIcons = mi.IconList; - //} /// /// 当修改菜单元素可见时 设置原菜单为不可见 并且不可选中 diff --git a/Control/UserControls/PannelCard/RightCardControl.xaml b/Control/UserControls/PannelCard/RightCardControl.xaml index 7912bd1..bbf1ca9 100644 --- a/Control/UserControls/PannelCard/RightCardControl.xaml +++ b/Control/UserControls/PannelCard/RightCardControl.xaml @@ -137,14 +137,17 @@ - + Margin="5,0,5,5" Grid.ColumnSpan="2" + MouseLeftButtonDown="VerticalCard_MouseLeftButtonDown" + > - + @@ -180,11 +183,19 @@ + + + + + + + /// 搜索Card点击事件 + /// + /// + /// + private void VerticalCard_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + //隐藏搜索框 + if (RunTimeStatus.SEARCH_BOX_SHOW) + { + MainWindow.mainWindow.HidedSearchBox(); + } + } } } diff --git a/Converts/SearchResWidth.cs b/Converts/SearchResWidth.cs index 6e0b400..55d8af5 100644 --- a/Converts/SearchResWidth.cs +++ b/Converts/SearchResWidth.cs @@ -13,8 +13,16 @@ namespace GeekDesk.Converts { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - double menuLeftWidth = double.Parse(value.ToString()); - return MainWindow.mainWindow.Width - menuLeftWidth; + string param = parameter as string; + if ("1".Equals(param)) + { + double menuLeftWidth = double.Parse(value.ToString()); + return MainWindow.mainWindow.Width - menuLeftWidth; + } else + { + double menuLeftWidth = double.Parse(value.ToString()); + return (MainWindow.mainWindow.Width - menuLeftWidth) / 2; + } } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/GeekDesk.csproj b/GeekDesk.csproj index eed90d7..f959d11 100644 --- a/GeekDesk.csproj +++ b/GeekDesk.csproj @@ -130,6 +130,7 @@ + diff --git a/MainWindow.xaml b/MainWindow.xaml index fc73cf5..76fe69f 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -137,7 +137,6 @@ private void SearchItem(object sender, CanExecuteRoutedEventArgs e) { + RunTimeStatus.SEARCH_BOX_SHOW = true; RightCard.VisibilitySearchCard(Visibility.Visible); SearchBox.Visibility = Visibility.Visible; SearchBox.Focus(); @@ -92,13 +93,10 @@ namespace GeekDesk SearchIconList.IconList.Clear(); } } - /// - /// 隐藏搜索框 - /// - /// - /// - private void SearchBox_LostFocus(object sender, RoutedEventArgs e) + + public void HidedSearchBox() { + RunTimeStatus.SEARCH_BOX_SHOW = false; SearchIconList.IconList.Clear(); RightCard.VisibilitySearchCard(Visibility.Collapsed); SearchBox.Visibility = Visibility.Collapsed; diff --git a/MainWindow.xaml.rej b/MainWindow.xaml.rej new file mode 100644 index 0000000..1b27959 --- /dev/null +++ b/MainWindow.xaml.rej @@ -0,0 +1,9 @@ +diff a/MainWindow.xaml b/MainWindow.xaml (rejected hunks) +@@ -20,6 +20,7 @@ + SizeChanged="Window_SizeChanged" + KeyDown="OnKeyDown" + Focusable="True" ++ GotFocus="MainWindow_GotFocus" + MouseDown="MainWindow_MouseDown" + > +