瀏覽代碼

🥕 优化everything 搜索结果

BookerLiu 2 年之前
父節點
當前提交
48fffa6da7
共有 4 個文件被更改,包括 35 次插入19 次删除
  1. 3 4
      Control/Other/SearchResControl.xaml.cs
  2. 9 1
      MainWindow.xaml
  3. 11 3
      MainWindow.xaml.cs
  4. 12 11
      Plugins/EveryThing/EveryThingUtil.cs

+ 3 - 4
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<IconInfo> resList = this.DataContext as ObservableCollection<IconInfo>;
 
@@ -264,8 +263,8 @@ namespace GeekDesk.Control.Other
                         ObservableCollection<IconInfo> 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);

+ 9 - 1
MainWindow.xaml

@@ -160,7 +160,15 @@
                             <Setter Property="MaxWidth" Value="300"/>
                         </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>
                 
                 <!--搜索输入框-->

+ 11 - 3
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<IconInfo> resList = new ObservableCollection<IconInfo>();
@@ -190,6 +194,7 @@ namespace GeekDesk
                             }
                         }
 
+                        int geekDeskCount = 0;
                         //GeekDesk数据搜索
                         ObservableCollection<MenuInfo> 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);

+ 12 - 11
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))