From 48fffa6da75b810c384902855c2051db1790be90 Mon Sep 17 00:00:00 2001 From: BookerLiu Date: Mon, 17 Apr 2023 14:12:31 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A5=95=20=E4=BC=98=E5=8C=96everything=20?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Control/Other/SearchResControl.xaml.cs | 7 +++---- MainWindow.xaml | 10 +++++++++- MainWindow.xaml.cs | 14 +++++++++++--- Plugins/EveryThing/EveryThingUtil.cs | 23 ++++++++++++----------- 4 files changed, 35 insertions(+), 19 deletions(-) diff --git a/Control/Other/SearchResControl.xaml.cs b/Control/Other/SearchResControl.xaml.cs index 14c32a4..ecdd3f6 100644 --- a/Control/Other/SearchResControl.xaml.cs +++ b/Control/Other/SearchResControl.xaml.cs @@ -254,8 +254,7 @@ namespace GeekDesk.Control.Other { EveryThingRuning = true; MainWindow.mainWindow.RightCard.Loading_RightCard.Visibility = Visibility.Visible; - string[] split = MainWindow.mainWindow.SearchResText.Text.Split(' '); - long count = Convert.ToInt64(split[0]); + int everyThingCount = Convert.ToInt32(MainWindow.mainWindow.EverythingSearchCount.Text); ObservableCollection resList = this.DataContext as ObservableCollection; @@ -264,8 +263,8 @@ namespace GeekDesk.Control.Other ObservableCollection searchRes = EveryThingUtil.NextPage(); this.Dispatcher.Invoke(() => { - count += searchRes.Count; - MainWindow.mainWindow.SearchResText.Text = count + " of " + split[split.Length - 1]; + everyThingCount += searchRes.Count; + MainWindow.mainWindow.EverythingSearchCount.Text = Convert.ToString(everyThingCount); foreach (IconInfo info in searchRes) { resList.Add(info); diff --git a/MainWindow.xaml b/MainWindow.xaml index 3b24513..00bc367 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -160,7 +160,15 @@ - + + + + + + + + + diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index 1a1033a..aa832d8 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -176,7 +176,11 @@ namespace GeekDesk this.Dispatcher.Invoke(() => { string inputText = SearchBox.Text.ToLower().Trim(); - + if (string.IsNullOrEmpty(inputText)) + { + RightCard.Loading_RightCard.Visibility = Visibility.Collapsed; + return; + } new Thread(() => { ObservableCollection resList = new ObservableCollection(); @@ -190,6 +194,7 @@ namespace GeekDesk } } + int geekDeskCount = 0; //GeekDesk数据搜索 ObservableCollection menuList = appData.MenuList; foreach (MenuInfo menu in menuList) @@ -201,6 +206,7 @@ namespace GeekDesk string pyName = Pinyin.GetInitials(icon.Name).ToLower(); if (icon.Name.Contains(inputText) || pyName.Contains(inputText)) { + geekDeskCount++; resList.Add(icon); } } @@ -210,7 +216,10 @@ namespace GeekDesk { if (appData.AppConfig.EnableEveryThing == true) { - SearchResText.Text = resList.Count + " of " + Convert.ToInt32(EveryThingUtil.Everything_GetNumResults()); + int everythingTotal = Convert.ToInt32(EveryThingUtil.Everything_GetNumResults()); + GeekDeskSearchTotal.Text = Convert.ToString(geekDeskCount); + EverythingSearchCount.Text = Convert.ToString(resList.Count - geekDeskCount); + EverythingSearchTotal.Text = Convert.ToString(everythingTotal + geekDeskCount); SearchResContainer.Visibility = Visibility.Visible; } SearchResControl control = new SearchResControl(resList); @@ -246,7 +255,6 @@ namespace GeekDesk SearchBox.Clear(); SearchBox.TextChanged += SearchBox_TextChanged; SearchBox.Width = 0; - SearchResText.Text = "0 of 0"; SearchResContainer.Visibility = Visibility.Collapsed; RightCard.VerticalCard.Content = null; RightCard.VisibilitySearchCard(Visibility.Collapsed); diff --git a/Plugins/EveryThing/EveryThingUtil.cs b/Plugins/EveryThing/EveryThingUtil.cs index d64995e..e524148 100644 --- a/Plugins/EveryThing/EveryThingUtil.cs +++ b/Plugins/EveryThing/EveryThingUtil.cs @@ -185,9 +185,10 @@ namespace GeekDesk.Plugins.EveryThing | EveryThingConst.EVERYTHING_REQUEST_DATE_MODIFIED | EveryThingConst.EVERYTHING_REQUEST_SIZE); EveryThingUtil.Everything_SetSort( - EveryThingConst.EVERYTHING_SORT_DATE_MODIFIED_DESCENDING - | EveryThingConst.EVERYTHING_SORT_TYPE_NAME_DESCENDING - | EveryThingConst.EVERYTHING_SORT_RUN_COUNT_DESCENDING); + EveryThingConst.EVERYTHING_SORT_TYPE_NAME_DESCENDING + | EveryThingConst.EVERYTHING_SORT_RUN_COUNT_DESCENDING + | EveryThingConst.EVERYTHING_SORT_DATE_MODIFIED_DESCENDING + ); EveryThingUtil.Everything_Query(true); return NextPage(); } @@ -220,15 +221,15 @@ namespace GeekDesk.Plugins.EveryThing ext = System.IO.Path.GetExtension(filePath).ToLower(); } - if (".lnk".Equals(ext)) - { + //if (".lnk".Equals(ext)) + //{ - string targetPath = FileUtil.GetTargetPathByLnk(filePath); - if (targetPath != null) - { - filePath = targetPath; - } - } + // string targetPath = FileUtil.GetTargetPathByLnk(filePath); + // if (targetPath != null) + // { + // filePath = targetPath; + // } + //} string name = System.IO.Path.GetFileNameWithoutExtension(tempPath); if (string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(tempPath))