Explorar el Código

综合-搜索自测bug修复

zhuyi hace 2 años
padre
commit
b90c5127b0

+ 3 - 13
PDF Office/ViewModels/BOTA/SearchContentViewModel.cs

@@ -65,6 +65,7 @@ namespace PDF_Office.ViewModels.BOTA
         private PDFTextSearch textSearch;
 
         private CPDFViewer PDFViewer;
+        private ViewContentViewModel viewContentViewModel;
 
         private string CurrentSearchText = "";
 
@@ -79,13 +80,6 @@ namespace PDF_Office.ViewModels.BOTA
             }
         }
 
-
-        /// <summary>
-        /// 历史记录数组
-        /// </summary>
-        List<string> HistorySearchText = new List<string>();
-        const int MaxHistoryCount = 10;
-
         private bool caseInsensitive = true;
 
         public bool CaseInsensitive
@@ -182,11 +176,6 @@ namespace PDF_Office.ViewModels.BOTA
                 textSearch.SearchText(Text, C_Search_Options.Search_Case_Sensitive);
             }
             CurrentSearchText = Text;
-            if (HistorySearchText.Count >= MaxHistoryCount)
-            {
-                HistorySearchText.RemoveAt(0);
-            }
-            HistorySearchText.Add(CurrentSearchText);
         }
 
         /// <summary>
@@ -275,7 +264,7 @@ namespace PDF_Office.ViewModels.BOTA
         private void clean()
         {
             SearchItemList.Clear();
-            HistorySearchText.Clear();
+            viewContentViewModel.OpenBOTA = false;
         }
 
         public bool IsNavigationTarget(NavigationContext navigationContext)
@@ -295,6 +284,7 @@ namespace PDF_Office.ViewModels.BOTA
             {
                 textSearch.TextSearchDocument = PDFViewer.Document;
             }
+            navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out viewContentViewModel);
         }
     }
 }

+ 1 - 1
PDF Office/Views/BOTA/OutLineControl.xaml

@@ -73,7 +73,7 @@
                     <customcontrol:PathButton.ContextMenu>
                         <ContextMenu Name="MenuMore">
                             <ContextMenu.ItemContainerStyle>
-                                <Style TargetType="MenuItem">
+                                <Style TargetType="MenuItem" BasedOn="{StaticResource GlobalMenuItem}">
                                     <Setter Property="Padding" Value="-25,7,-40,7" />
                                     <Setter Property="VerticalContentAlignment" Value="Center" />
                                 </Style>

+ 3 - 1
PDF Office/Views/BOTA/SearchContent.xaml

@@ -13,6 +13,8 @@
              xmlns:customControl="clr-namespace:PDF_Office.CustomControl"
              xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
              mc:Ignorable="d" 
+             Loaded="UserControl_Loaded"
+             KeyDown="UserControl_KeyDown"
              d:DesignHeight="450" d:DesignWidth="800">
 
     <UserControl.Resources>
@@ -343,7 +345,7 @@
                 <ListView.GroupStyle>
                     <GroupStyle >
                         <GroupStyle.HeaderTemplate>
-                            <DataTemplate >
+                            <DataTemplate>
                                 <Border Background="{StaticResource color.sys.layout.fg.light}" Height="32" Padding="16,5,5,5" VerticalAlignment="Center" >
                                     <Grid VerticalAlignment="Center">
                                     <TextBlock VerticalAlignment="Stretch" TextAlignment="Center" HorizontalAlignment="Left"  FontSize="14" Text="{Binding Name}"

+ 14 - 0
PDF Office/Views/BOTA/SearchContent.xaml.cs

@@ -154,5 +154,19 @@ namespace PDF_Office.Views.BOTA
             HistorySearchText.Clear();
             UpDataItem();
         }
+
+        private void UserControl_Loaded(object sender, RoutedEventArgs e)
+        {
+            SearchText.Focus();
+        }
+
+        private void UserControl_KeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.Escape)
+            {
+                SearchResultList.SelectedIndex = -1;
+            }
+            e.Handled = true;
+        }
     }
 }

+ 18 - 10
PDF Office/Views/Dialog/ToolsDialogs/MergeDialog.xaml

@@ -91,9 +91,14 @@
 
         <Border Grid.Column="1" Grid.Row="1"  Grid.RowSpan="2" Padding="50,6,50,6" Visibility="{Binding Visibility, Converter={StaticResource UnVisivleConvert}, ElementName=NoFileStackPanel}">
             <Grid>
-                <TextBlock Text="File Name" HorizontalAlignment="Left" FontFamily="Segoe UI" FontSize="12" FontWeight="Bold" Foreground="{StaticResource color.sys.text.neutral.lv1}"/>
-                <TextBlock Text="Page Range" HorizontalAlignment="Center" FontFamily="Segoe UI" FontSize="12" FontWeight="Bold" Foreground="{StaticResource color.sys.text.neutral.lv1}"/>
-                <TextBlock Text="Size" HorizontalAlignment="Right" FontFamily="Segoe UI" FontSize="12" FontWeight="Bold" Foreground="{StaticResource color.sys.text.neutral.lv1}"/>
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="201"/>
+                    <ColumnDefinition Width="160"/>
+                    <ColumnDefinition Width="*"/>
+                </Grid.ColumnDefinitions>
+                <TextBlock Text="File Name"  FontFamily="Segoe UI" FontSize="12" FontWeight="Bold" Foreground="{StaticResource color.sys.text.neutral.lv1}"/>
+                <TextBlock Grid.Column="1"  Text="Page Range"  FontFamily="Segoe UI" FontSize="12" FontWeight="Bold" Foreground="{StaticResource color.sys.text.neutral.lv1}"/>
+                <TextBlock Grid.Column="2" Text="Size" HorizontalAlignment="Center"  FontFamily="Segoe UI" FontSize="12" FontWeight="Bold" Foreground="{StaticResource color.sys.text.neutral.lv1}"/>
             </Grid>
         </Border>
         <Border Grid.Column="1" Grid.Row="3">
@@ -133,11 +138,14 @@
                                         <Grid.ColumnDefinitions>
                                             <ColumnDefinition Width="40"/>
                                             <ColumnDefinition Width="60"/>
-                                            <ColumnDefinition Width="141"/>
+                                            <ColumnDefinition Width="8"/>
+                                            <ColumnDefinition Width="133"/>
                                             <ColumnDefinition Width="auto"/>
-                                            <ColumnDefinition Width="*"/>
-                                            <ColumnDefinition Width="16"/>
                                             <ColumnDefinition Width="16"/>
+                                            <ColumnDefinition Width="56"/>
+                                            <ColumnDefinition Width="17"/>
+                                            <ColumnDefinition Width="*"/>
+                                            <ColumnDefinition Width="17"/>
                                         </Grid.ColumnDefinitions>
                                         <Line   Margin="0,0,0,0" Grid.ColumnSpan="6" Visibility="{Binding IsForward, Converter={StaticResource BoolToVisible}}" X1="0"  X2="{Binding ActualWidth, ElementName=ContentPanel}" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" StrokeThickness="1" Stroke="{StaticResource color.sys.layout.accent}" />
 
@@ -146,15 +154,15 @@
                                         <TextBlock Text="{Binding Converter={StaticResource IndexConverter}, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListViewItem}}}"
                                  VerticalAlignment="Center"  HorizontalAlignment="Center"/>
                                         <Image Margin="8" Grid.Column="1"  HorizontalAlignment="Stretch" VerticalAlignment="Center" Source="{Binding DocThumbnail}"  Stretch="Uniform"  />
-                                        <StackPanel Grid.Column="2" Margin="16,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Center">
+                                        <StackPanel Grid.Column="3" HorizontalAlignment="Stretch" VerticalAlignment="Center">
                                             <TextBlock Text="{Binding DocName}" FontFamily="Segoe UI" FontSize="14" FontWeight="Regular" Foreground="{StaticResource color.sys.text.neutral.lv1}"  TextTrimming="CharacterEllipsis"/>
                                             <TextBlock Text="{Binding DocPageCount}"  FontFamily="Segoe UI" FontSize="14" FontWeight="Regular" Foreground="{StaticResource color.sys.text.neutral.lv3}"/>
                                         </StackPanel>
-                                        <StackPanel Grid.Column="3" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="16,0,0,0">
+                                        <StackPanel Grid.Column="4" HorizontalAlignment="Stretch" VerticalAlignment="Center">
                                             <customcontrol:WritableComboBox SelectedIndex="0" Width="150" Height="30" MaxPageRange="{Binding SDKPageCount}" Text="{Binding SetPageRange, Mode=TwoWay}"/>
                                         </StackPanel>
-                                        <TextBlock Grid.Column="4" Text="{Binding DocSize}"  HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="16,0,0,0"/>
-                                        <StackPanel Grid.Column="5" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="0,0">
+                                        <TextBlock Grid.Column="6" Text="{Binding DocSize}"  HorizontalAlignment="Center" VerticalAlignment="Center" TextTrimming="CharacterEllipsis"/>
+                                        <StackPanel Grid.Column="8" VerticalAlignment="Center" HorizontalAlignment="Stretch">
 
                                             <customcontrol:PathButton
             Visibility="Collapsed"