diff --git a/Control/UserControls/PannelCard/RightCardControl.xaml b/Control/UserControls/PannelCard/RightCardControl.xaml index 7ad0f49..09057f7 100644 --- a/Control/UserControls/PannelCard/RightCardControl.xaml +++ b/Control/UserControls/PannelCard/RightCardControl.xaml @@ -3,7 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard" + xmlns:temp="clr-namespace:GeekDesk.ViewModel.Temp" xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:cvt="clr-namespace:GeekDesk.Converts" xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel" @@ -12,6 +12,14 @@ > + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - + + + + + - - + + - - - - - - - - - - - + + + + + + + + + + + - - - - + + + - - - - - - - - - + + + + + + + + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Control/UserControls/PannelCard/RightCardControl.xaml.cs b/Control/UserControls/PannelCard/RightCardControl.xaml.cs index 04368aa..14a8b71 100644 --- a/Control/UserControls/PannelCard/RightCardControl.xaml.cs +++ b/Control/UserControls/PannelCard/RightCardControl.xaml.cs @@ -196,9 +196,9 @@ namespace GeekDesk.Control.UserControls.PannelCard case IconStartType.ADMIN_STARTUP: //p.StartInfo.Arguments = "1";//启动参数 p.StartInfo.Verb = "runas"; - p.StartInfo.CreateNoWindow = false; //设置显示窗口 - p.StartInfo.UseShellExecute = false;//不使用操作系统外壳程序启动进程 - p.StartInfo.ErrorDialog = false; + //p.StartInfo.CreateNoWindow = false; //设置显示窗口 + p.StartInfo.UseShellExecute = true;//不使用操作系统外壳程序启动进程 + //p.StartInfo.ErrorDialog = false; if (appData.AppConfig.AppHideType == AppHideType.START_EXE) { //如果开启了贴边隐藏 则窗体不贴边才隐藏窗口 @@ -571,5 +571,17 @@ namespace GeekDesk.Control.UserControls.PannelCard SystemItemWindow.Show(); } + public void VisibilitySearchCard(Visibility vb) + { + VerticalCard.Visibility = vb; + if (vb == Visibility.Visible) + { + WrapCard.Visibility = Visibility.Collapsed; + } else + { + WrapCard.Visibility = Visibility.Visible; + } + } + } } diff --git a/Converts/SearchResWidth.cs b/Converts/SearchResWidth.cs new file mode 100644 index 0000000..6e0b400 --- /dev/null +++ b/Converts/SearchResWidth.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; + +namespace GeekDesk.Converts +{ + class SearchResWidth : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + double menuLeftWidth = double.Parse(value.ToString()); + return MainWindow.mainWindow.Width - menuLeftWidth; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + } +} diff --git a/MainWindow.xaml b/MainWindow.xaml index 0a8aed8..f968c65 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -3,11 +3,9 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:local="clr-namespace:GeekDesk" xmlns:uc="clr-namespace:GeekDesk.Control.UserControls.PannelCard" mc:Ignorable="d" xmlns:cvt="clr-namespace:GeekDesk.Converts" - xmlns:DraggAnimatedPanel="clr-namespace:DraggAnimatedPanel" x:Name="window" xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:viewmodel="clr-namespace:GeekDesk.ViewModel" d:DataContext="{d:DesignInstance Type=viewmodel:AppData}" Title="GeekDesk" @@ -28,12 +26,19 @@ + + + + + + + + @@ -71,11 +77,13 @@ - + + + @@ -125,7 +133,21 @@ - + + + + + diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index e9ceca4..e55c326 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -1,6 +1,4 @@ -using DraggAnimatedPanelExample; -using GeekDesk.Constant; -using GeekDesk.Control; +using GeekDesk.Constant; using GeekDesk.Control.UserControls.Config; using GeekDesk.Control.Windows; using GeekDesk.Interface; @@ -8,21 +6,17 @@ using GeekDesk.Task; using GeekDesk.MyThread; using GeekDesk.Util; using GeekDesk.ViewModel; -using Gma.System.MouseKeyHook; -using HandyControl.Data; using System; -using System.Collections.ObjectModel; using System.Diagnostics; -using System.Drawing; -using System.IO; using System.Windows; using System.Windows.Controls; using System.Windows.Input; -using System.Windows.Interop; -using System.Windows.Media; using System.Windows.Media.Animation; using static GeekDesk.Util.ShowWindowFollowMouse; +using System.Collections.ObjectModel; +using NPinyin; +using GeekDesk.ViewModel.Temp; namespace GeekDesk { @@ -48,6 +42,7 @@ namespace GeekDesk this.SizeChanged += MainWindow_Resize; ToDoTask.BackLogCheck(); + ////实例化隐藏 Hide类,进行时间timer设置 MarginHide.ReadyHide(this); if (appData.AppConfig.MarginHide) @@ -56,6 +51,59 @@ namespace GeekDesk } } + /// + /// 显示搜索框 + /// + /// + /// + private void SearchItem(object sender, CanExecuteRoutedEventArgs e) + { + RightCard.VisibilitySearchCard(Visibility.Visible); + SearchBox.Visibility = Visibility.Visible; + SearchBox.Focus(); + } + /// + /// 搜索开始 + /// + /// + /// + private void SearchBox_TextChanged(object sender, TextChangedEventArgs e) + { + string inputText = SearchBox.Text.ToLower(); + if (!string.IsNullOrEmpty(inputText)) + { + SearchIconList.IconList.Clear(); + ObservableCollection menuList = appData.MenuList; + foreach (MenuInfo menu in menuList) + { + ObservableCollection iconList = menu.IconList; + foreach (IconInfo icon in iconList) + { + string pyName = Pinyin.GetInitials(icon.Name).ToLower(); + if (icon.Name.Contains(inputText) || pyName.Contains(inputText)) { + SearchIconList.IconList.Add(icon); + } + } + } + } else + { + SearchIconList.IconList.Clear(); + } + } + /// + /// 隐藏搜索框 + /// + /// + /// + private void SearchBox_LostFocus(object sender, RoutedEventArgs e) + { + SearchIconList.IconList.Clear(); + RightCard.VisibilitySearchCard(Visibility.Collapsed); + SearchBox.Visibility = Visibility.Collapsed; + SearchBox.Text = ""; + } + + /// /// 加载缓存数据 /// @@ -533,5 +581,6 @@ namespace GeekDesk { EmptyTextBox.Focus(); } + } } diff --git a/ViewModel/Temp/SearchIconList.cs b/ViewModel/Temp/SearchIconList.cs new file mode 100644 index 0000000..0bc800c --- /dev/null +++ b/ViewModel/Temp/SearchIconList.cs @@ -0,0 +1,31 @@ +using System.Collections.ObjectModel; +using System.ComponentModel; + +namespace GeekDesk.ViewModel.Temp +{ + public class SearchIconList + { + + private static ObservableCollection iconList = new ObservableCollection(); + + public static ObservableCollection IconList + { + get + { + return iconList; + } + set + { + iconList = value; + OnPropertyChanged("IconList"); + } + } + + + public static event PropertyChangedEventHandler PropertyChanged; + private static void OnPropertyChanged(string propertyName) + { + PropertyChanged?.Invoke(null, new PropertyChangedEventArgs(propertyName)); + } + } +}