🥕 优化everything 搜索结果

This commit is contained in:
BookerLiu
2023-04-17 14:12:31 +08:00
parent 6072832654
commit 48fffa6da7
4 changed files with 35 additions and 19 deletions

View File

@@ -254,8 +254,7 @@ namespace GeekDesk.Control.Other
{ {
EveryThingRuning = true; EveryThingRuning = true;
MainWindow.mainWindow.RightCard.Loading_RightCard.Visibility = Visibility.Visible; MainWindow.mainWindow.RightCard.Loading_RightCard.Visibility = Visibility.Visible;
string[] split = MainWindow.mainWindow.SearchResText.Text.Split(' '); int everyThingCount = Convert.ToInt32(MainWindow.mainWindow.EverythingSearchCount.Text);
long count = Convert.ToInt64(split[0]);
ObservableCollection<IconInfo> resList = this.DataContext as ObservableCollection<IconInfo>; ObservableCollection<IconInfo> resList = this.DataContext as ObservableCollection<IconInfo>;
@@ -264,8 +263,8 @@ namespace GeekDesk.Control.Other
ObservableCollection<IconInfo> searchRes = EveryThingUtil.NextPage(); ObservableCollection<IconInfo> searchRes = EveryThingUtil.NextPage();
this.Dispatcher.Invoke(() => this.Dispatcher.Invoke(() =>
{ {
count += searchRes.Count; everyThingCount += searchRes.Count;
MainWindow.mainWindow.SearchResText.Text = count + " of " + split[split.Length - 1]; MainWindow.mainWindow.EverythingSearchCount.Text = Convert.ToString(everyThingCount);
foreach (IconInfo info in searchRes) foreach (IconInfo info in searchRes)
{ {
resList.Add(info); resList.Add(info);

View File

@@ -160,7 +160,15 @@
<Setter Property="MaxWidth" Value="300"/> <Setter Property="MaxWidth" Value="300"/>
</Style> </Style>
</Border.Style> </Border.Style>
<TextBlock Margin="8" FontSize="13" x:Name="SearchResText" Text="0 of 0" Opacity="0.6"/> <WrapPanel Margin="8">
<TextBlock Opacity="0.6" Text="g:"/>
<TextBlock x:Name="GeekDeskSearchTotal" Opacity="0.6" Text="0"/>
<TextBlock Opacity="0.6" Text="+"/>
<TextBlock Opacity="0.6" Text="e:"/>
<TextBlock x:Name="EverythingSearchCount" Opacity="0.6" Text="0"/>
<TextBlock Opacity="0.6" Text=" of "/>
<TextBlock x:Name="EverythingSearchTotal" Opacity="0.6" Text="0"/>
</WrapPanel>
</Border> </Border>
<!--搜索输入框--> <!--搜索输入框-->

View File

@@ -176,7 +176,11 @@ namespace GeekDesk
this.Dispatcher.Invoke(() => this.Dispatcher.Invoke(() =>
{ {
string inputText = SearchBox.Text.ToLower().Trim(); string inputText = SearchBox.Text.ToLower().Trim();
if (string.IsNullOrEmpty(inputText))
{
RightCard.Loading_RightCard.Visibility = Visibility.Collapsed;
return;
}
new Thread(() => new Thread(() =>
{ {
ObservableCollection<IconInfo> resList = new ObservableCollection<IconInfo>(); ObservableCollection<IconInfo> resList = new ObservableCollection<IconInfo>();
@@ -190,6 +194,7 @@ namespace GeekDesk
} }
} }
int geekDeskCount = 0;
//GeekDesk数据搜索 //GeekDesk数据搜索
ObservableCollection<MenuInfo> menuList = appData.MenuList; ObservableCollection<MenuInfo> menuList = appData.MenuList;
foreach (MenuInfo menu in menuList) foreach (MenuInfo menu in menuList)
@@ -201,6 +206,7 @@ namespace GeekDesk
string pyName = Pinyin.GetInitials(icon.Name).ToLower(); string pyName = Pinyin.GetInitials(icon.Name).ToLower();
if (icon.Name.Contains(inputText) || pyName.Contains(inputText)) if (icon.Name.Contains(inputText) || pyName.Contains(inputText))
{ {
geekDeskCount++;
resList.Add(icon); resList.Add(icon);
} }
} }
@@ -210,7 +216,10 @@ namespace GeekDesk
{ {
if (appData.AppConfig.EnableEveryThing == true) 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; SearchResContainer.Visibility = Visibility.Visible;
} }
SearchResControl control = new SearchResControl(resList); SearchResControl control = new SearchResControl(resList);
@@ -246,7 +255,6 @@ namespace GeekDesk
SearchBox.Clear(); SearchBox.Clear();
SearchBox.TextChanged += SearchBox_TextChanged; SearchBox.TextChanged += SearchBox_TextChanged;
SearchBox.Width = 0; SearchBox.Width = 0;
SearchResText.Text = "0 of 0";
SearchResContainer.Visibility = Visibility.Collapsed; SearchResContainer.Visibility = Visibility.Collapsed;
RightCard.VerticalCard.Content = null; RightCard.VerticalCard.Content = null;
RightCard.VisibilitySearchCard(Visibility.Collapsed); RightCard.VisibilitySearchCard(Visibility.Collapsed);

View File

@@ -185,9 +185,10 @@ namespace GeekDesk.Plugins.EveryThing
| EveryThingConst.EVERYTHING_REQUEST_DATE_MODIFIED | EveryThingConst.EVERYTHING_REQUEST_DATE_MODIFIED
| EveryThingConst.EVERYTHING_REQUEST_SIZE); | EveryThingConst.EVERYTHING_REQUEST_SIZE);
EveryThingUtil.Everything_SetSort( EveryThingUtil.Everything_SetSort(
EveryThingConst.EVERYTHING_SORT_DATE_MODIFIED_DESCENDING EveryThingConst.EVERYTHING_SORT_TYPE_NAME_DESCENDING
| EveryThingConst.EVERYTHING_SORT_TYPE_NAME_DESCENDING | EveryThingConst.EVERYTHING_SORT_RUN_COUNT_DESCENDING
| EveryThingConst.EVERYTHING_SORT_RUN_COUNT_DESCENDING); | EveryThingConst.EVERYTHING_SORT_DATE_MODIFIED_DESCENDING
);
EveryThingUtil.Everything_Query(true); EveryThingUtil.Everything_Query(true);
return NextPage(); return NextPage();
} }
@@ -220,15 +221,15 @@ namespace GeekDesk.Plugins.EveryThing
ext = System.IO.Path.GetExtension(filePath).ToLower(); ext = System.IO.Path.GetExtension(filePath).ToLower();
} }
if (".lnk".Equals(ext)) //if (".lnk".Equals(ext))
{ //{
string targetPath = FileUtil.GetTargetPathByLnk(filePath); // string targetPath = FileUtil.GetTargetPathByLnk(filePath);
if (targetPath != null) // if (targetPath != null)
{ // {
filePath = targetPath; // filePath = targetPath;
} // }
} //}
string name = System.IO.Path.GetFileNameWithoutExtension(tempPath); string name = System.IO.Path.GetFileNameWithoutExtension(tempPath);
if (string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(tempPath)) if (string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(tempPath))