Pārlūkot izejas kodu

综合-大纲bug,签名部分高保真与自测bug

zhuyi 2 gadi atpakaļ
vecāks
revīzija
5a7ed99c3a

+ 12 - 2
PDF Office/ViewModels/BOTA/OutLineControlViewModel.cs

@@ -92,6 +92,10 @@ namespace PDF_Office.ViewModels.BOTA
                     Outlinelist.Add(dto);
                 }
             }
+
+            //如果是第一条数据不允许点击降级
+            Outlinelist[0].CanDown = false;
+
             PDFViewer.GetCreateOutLineInfo();
         }
 
@@ -114,6 +118,9 @@ namespace PDF_Office.ViewModels.BOTA
                 }
             }
 
+            //如果是第一条数据不允许点击降级
+            list[0].CanDown = false;
+
             //清空绑定数组,并填充新数据
             Outlinelist.Clear();
             foreach (OutlineNode item in list)
@@ -409,7 +416,7 @@ namespace PDF_Office.ViewModels.BOTA
         }
 
         /// <summary>
-        /// 级当前大纲
+        /// 级当前大纲
         /// </summary>
         public void Downgrade(OutlineNode outline)
         {
@@ -425,7 +432,7 @@ namespace PDF_Office.ViewModels.BOTA
         }
 
         /// <summary>
-        /// 级当前大纲
+        /// 级当前大纲
         /// </summary>
         public void Upgrade(OutlineNode outline)
         {
@@ -611,11 +618,14 @@ namespace PDF_Office.ViewModels.BOTA
                     {
                         node.Chlidlist.Add(ConvertCPDFToOutlineNode(item, node, IsMoveData));
                     }
+                    //如果是第一条数据不允许点击降级
+                    node.Chlidlist[0].CanDown = false;
                 }
                 else
                 {
                     node.CanDown = false;
                 }
+
             }
             return node;
         }

+ 1 - 0
PDF Office/ViewModels/PropertyPanel/AnnotPanel/SignatureAnnotPropertyViewModel.cs

@@ -204,6 +204,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             BitmapEncoder encoder;
             if (FileType.ToUpper() == "JPG")
             {
+                //如果要导出JPG,并且要白色背景,https://social.msdn.microsoft.com/Forums/en-US/2d574827-7eb7-488e-a86b-861ccb4f0275/set-image-background-white-and-save-it?forum=wpf
                 encoder = new JpegBitmapEncoder();
             }
             else

+ 6 - 0
PDF Office/ViewModels/PropertyPanel/AnnotPanel/SignatureCreateDialogViewModel.cs

@@ -34,6 +34,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
         public DelegateCommand<object> CheckedCommnad { get; set; }
 
         public DelegateCommand OpenImageCommnad { get; set; }
+        public DelegateCommand ClearInkCanvasCommnad { get; set; }
         public ObservableCollection<string> FontNameList { get; set; }
         public ObservableCollection<string> ThicknessList { get; set; }
 
@@ -222,6 +223,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             CreateCommnad = new DelegateCommand(Create);
             CheckedCommnad = new DelegateCommand<object>(Checked);
             OpenImageCommnad = new DelegateCommand(OpenImage);
+            ClearInkCanvasCommnad = new DelegateCommand(ClearInkCanvas);
             DrawingAttributeObject.Color = Colors.Black;
             DrawingAttributeObject.Width = 1;
             DrawingAttributeObject.Height = 1;
@@ -331,6 +333,10 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                 SaveToPath = "";
             }
         }
+        private void ClearInkCanvas()
+        {
+            StrokesObject.Clear();
+        }
 
         /// <summary>
         /// 去除白底

+ 2 - 2
PDF Office/Views/Dialog/CustomCreateDialog.xaml

@@ -19,7 +19,7 @@
              >
 
     <UserControl.Resources>
-        <Style x:Key="MyToolTipStyle" TargetType="ToolTip">
+        <Style x:Key="TriangleToolTipStyle" TargetType="ToolTip">
             <Setter Property="Template">
                 <Setter.Value>
                     <ControlTemplate>
@@ -296,7 +296,7 @@
                                 IconPress="pack://application:,,,/PDF Office;component/Resources/Dialog/help.png"  
                                 IconMouseOver="pack://application:,,,/PDF Office;component/Resources/Dialog/help.png">
                                 <customcontrol:ImageButton.ToolTip >
-                                    <ToolTip Style ="{DynamicResource MyToolTipStyle}" Placement="Bottom" Content="Remove white background from images" >
+                                    <ToolTip Style ="{StaticResource TriangleToolTipStyle}" Placement="Bottom" Content="Remove white background from images" >
                                         <ToolTip.HorizontalOffset>
                                             <MultiBinding Converter="{StaticResource CenterToolTipConverter}">
                                                 <Binding RelativeSource="{RelativeSource Self}" Path="PlacementTarget.ActualWidth"/>

+ 98 - 18
PDF Office/Views/PropertyPanel/AnnotPanel/SignatureCreateDialog.xaml

@@ -16,6 +16,23 @@
         <dataconvert:UnVisivleConvert x:Key="UnVisivleConvert"/>
         <dataconvert:IntAndTagToBoolMultiBinding x:Key="IntAndTagToBoolMultiBinding"/>
         <dataconvert:IntToColorBrush x:Key="IntToColorBrush"/>
+        <dataconvert:ListCountToVisible x:Key="ListCountToVisible"/>
+        <dataconvert:CenterToolTipConverter x:Key="CenterToolTipConverter"/>
+
+        <Style x:Key="TriangleToolTipStyle" TargetType="ToolTip">
+            <Setter Property="Template">
+                <Setter.Value>
+                    <ControlTemplate>
+                        <StackPanel>
+                            <Path HorizontalAlignment="Center" VerticalAlignment="Center" Data="M 6 0 L 0 6 L 12 6 Z" Fill="#E6333333" Margin="0,0,10,0"/>
+                            <Border CornerRadius="8" Background="#E6333333" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
+                                <TextBlock  Text="{TemplateBinding ContentControl.Content}" Foreground="White"  LineHeight="20" Margin="6"/>
+                            </Border>
+                        </StackPanel>
+                    </ControlTemplate>
+                </Setter.Value>
+            </Setter>
+        </Style>
     </UserControl.Resources>
     <cus:DialogContent Header="新建签名">
         <cus:DialogContent.Content>
@@ -36,7 +53,12 @@
                         ItemsSource="{Binding FontNameList}"
                         SelectedIndex="{Binding FontNameIndex,Mode=TwoWay}"/>
                         <StackPanel Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal">
-                            <RadioButton Tag="1" Checked="TextRadioButton_Checked">
+                            <cus:PathRadioButton Tag="1" Checked="TextRadioButton_Checked" MouseOverBackground="#EDEEF0" MouseDownBackground="#CED0D4" MouseDownBackgroundOpacity="0.6">
+                                <cus:PathRadioButton.Content>
+                                    <Grid Width="32" Height="32">
+                                        <Ellipse Width="11" Height="11" Fill="Black"/>
+                                    </Grid>
+                                </cus:PathRadioButton.Content>
                                 <i:Interaction.Triggers>
                                     <i:EventTrigger EventName="Checked">
                                         <i:InvokeCommandAction Command="{Binding CheckedCommnad}" 
@@ -50,8 +72,13 @@
                                         <Binding Path="RadioButtonIndex"/>
                                     </MultiBinding>
                                 </RadioButton.IsChecked>
-                            </RadioButton>
-                            <RadioButton Tag="2" Checked="TextRadioButton_Checked">
+                            </cus:PathRadioButton>
+                            <cus:PathRadioButton Tag="2" Checked="TextRadioButton_Checked" MouseOverBackground="#EDEEF0" MouseDownBackground="#CED0D4" MouseDownBackgroundOpacity="0.6">
+                                <cus:PathRadioButton.Content>
+                                    <Grid Width="32" Height="32">
+                                        <Ellipse Width="11" Height="11"   Fill="#F66B7C"/>
+                                    </Grid>
+                                </cus:PathRadioButton.Content>
                                 <i:Interaction.Triggers>
                                     <i:EventTrigger EventName="Checked">
                                         <i:InvokeCommandAction Command="{Binding CheckedCommnad}" 
@@ -65,8 +92,13 @@
                                         <Binding Path="RadioButtonIndex"/>
                                     </MultiBinding>
                                 </RadioButton.IsChecked>
-                            </RadioButton>
-                            <RadioButton Tag="3" Checked="TextRadioButton_Checked">
+                            </cus:PathRadioButton>
+                            <cus:PathRadioButton Tag="3" Checked="TextRadioButton_Checked" MouseOverBackground="#EDEEF0" MouseDownBackground="#CED0D4" MouseDownBackgroundOpacity="0.6">
+                                <cus:PathRadioButton.Content>
+                                    <Grid Width="32" Height="32">
+                                        <Ellipse Width="11" Height="11"   Fill="#48DDAD"/>
+                                    </Grid>
+                                </cus:PathRadioButton.Content>
                                 <i:Interaction.Triggers>
                                     <i:EventTrigger EventName="Checked">
                                         <i:InvokeCommandAction Command="{Binding CheckedCommnad}" 
@@ -80,8 +112,13 @@
                                         <Binding Path="RadioButtonIndex"/>
                                     </MultiBinding>
                                 </RadioButton.IsChecked>
-                            </RadioButton>
-                            <RadioButton Tag="4" Checked="TextRadioButton_Checked">
+                            </cus:PathRadioButton>
+                            <cus:PathRadioButton Tag="4" Checked="TextRadioButton_Checked" MouseOverBackground="#EDEEF0" MouseDownBackground="#CED0D4" MouseDownBackgroundOpacity="0.6">
+                                <cus:PathRadioButton.Content>
+                                    <Grid Width="32" Height="32">
+                                        <Ellipse Width="11" Height="11"   Fill="#458DF6"/>
+                                    </Grid>
+                                </cus:PathRadioButton.Content>
                                 <i:Interaction.Triggers>
                                     <i:EventTrigger EventName="Checked">
                                         <i:InvokeCommandAction Command="{Binding CheckedCommnad}" 
@@ -95,7 +132,7 @@
                                         <Binding Path="RadioButtonIndex"/>
                                     </MultiBinding>
                                 </RadioButton.IsChecked>
-                            </RadioButton>
+                            </cus:PathRadioButton>
                         </StackPanel>
                     </Grid>
                 </TabItem>
@@ -106,14 +143,24 @@
                             <RowDefinition Height="32"/>
                         </Grid.RowDefinitions>
                         <InkCanvas x:Name="inkCanvas" Width="240" Height="240" DefaultDrawingAttributes="{Binding DrawingAttributeObject}" Strokes="{Binding StrokesObject}"/>
+
+                        <Grid Opacity="0.7" x:Name="PlanGrid" IsHitTestVisible="False" Background="#F3F3F3" Visibility="{Binding StrokesObject.Count,Converter={StaticResource ListCountToVisible}}">
+                            <TextBlock Text="此处绘制签名" VerticalAlignment="Center" HorizontalAlignment="Center"/>
+                        </Grid>
+                        <Button   Style="{StaticResource btn.sec}" Width="50" Height="50" HorizontalAlignment="Right" VerticalAlignment="Bottom" Content="Clear" Command="{Binding ClearInkCanvasCommnad}" Visibility="{Binding ElementName=PlanGrid,Path=Visibility}"/>
                         <ComboBox Grid.Row="1"
                         Width="80"
                         HorizontalAlignment="Left"
                         VerticalContentAlignment="Center" 
                         ItemsSource="{Binding ThicknessList}"
                         SelectedIndex="{Binding ThicknessListIndex,Mode=TwoWay}"/>
-                        <StackPanel Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal">
-                            <RadioButton Tag="1" Checked="ImageRadioButton_Checked">
+                        <StackPanel Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal" >
+                            <cus:PathRadioButton Tag="1" Checked="ImageRadioButton_Checked" MouseOverBackground="#EDEEF0" MouseDownBackground="#CED0D4" MouseDownBackgroundOpacity="0.6">
+                                <cus:PathRadioButton.Content>
+                                    <Grid Width="32" Height="32">
+                                        <Ellipse Width="11" Height="11" Fill="Black"/>
+                                    </Grid>
+                                </cus:PathRadioButton.Content>
                                 <i:Interaction.Triggers>
                                     <i:EventTrigger EventName="Checked">
                                         <i:InvokeCommandAction Command="{Binding CheckedCommnad}" 
@@ -127,8 +174,13 @@
                                         <Binding Path="ImageRadioButtonIndex"/>
                                     </MultiBinding>
                                 </RadioButton.IsChecked>
-                            </RadioButton>
-                            <RadioButton Tag="2" Checked="ImageRadioButton_Checked">
+                            </cus:PathRadioButton>
+                            <cus:PathRadioButton Tag="2" Checked="ImageRadioButton_Checked" MouseOverBackground="#EDEEF0" MouseDownBackground="#CED0D4" MouseDownBackgroundOpacity="0.6">
+                                <cus:PathRadioButton.Content>
+                                    <Grid Width="32" Height="32">
+                                        <Ellipse Width="11" Height="11"   Fill="#F66B7C"/>
+                                    </Grid>
+                                </cus:PathRadioButton.Content>
                                 <i:Interaction.Triggers>
                                     <i:EventTrigger EventName="Checked">
                                         <i:InvokeCommandAction Command="{Binding CheckedCommnad}" 
@@ -142,8 +194,13 @@
                                         <Binding Path="ImageRadioButtonIndex"/>
                                     </MultiBinding>
                                 </RadioButton.IsChecked>
-                            </RadioButton>
-                            <RadioButton Tag="3" Checked="ImageRadioButton_Checked">
+                            </cus:PathRadioButton>
+                            <cus:PathRadioButton Tag="3" Checked="ImageRadioButton_Checked" MouseOverBackground="#EDEEF0" MouseDownBackground="#CED0D4" MouseDownBackgroundOpacity="0.6">
+                                <cus:PathRadioButton.Content>
+                                    <Grid Width="32" Height="32">
+                                        <Ellipse Width="11" Height="11" Fill="#48DDAD"/>
+                                    </Grid>
+                                </cus:PathRadioButton.Content>
                                 <i:Interaction.Triggers>
                                     <i:EventTrigger EventName="Checked">
                                         <i:InvokeCommandAction Command="{Binding CheckedCommnad}" 
@@ -157,8 +214,13 @@
                                         <Binding Path="ImageRadioButtonIndex"/>
                                     </MultiBinding>
                                 </RadioButton.IsChecked>
-                            </RadioButton>
-                            <RadioButton Tag="4" Checked="ImageRadioButton_Checked">
+                            </cus:PathRadioButton>
+                            <cus:PathRadioButton Tag="4" Checked="ImageRadioButton_Checked" MouseOverBackground="#EDEEF0" MouseDownBackground="#CED0D4" MouseDownBackgroundOpacity="0.6">
+                                <cus:PathRadioButton.Content>
+                                    <Grid Width="32" Height="32">
+                                        <Ellipse Width="11" Height="11" Fill="#458DF6"/>
+                                    </Grid>
+                                </cus:PathRadioButton.Content>
                                 <i:Interaction.Triggers>
                                     <i:EventTrigger EventName="Checked">
                                         <i:InvokeCommandAction Command="{Binding CheckedCommnad}" 
@@ -172,7 +234,7 @@
                                         <Binding Path="ImageRadioButtonIndex"/>
                                     </MultiBinding>
                                 </RadioButton.IsChecked>
-                            </RadioButton>
+                            </cus:PathRadioButton>
                         </StackPanel>
                     </Grid>
                 </TabItem>
@@ -191,7 +253,25 @@
                             <Image Grid.RowSpan="2" Width="200" Height="200" Source="{Binding ImagePreviewSource}" />
                             <Button Grid.Row="1" Width="50" Height="50" HorizontalAlignment="Right" VerticalAlignment="Bottom" Content="重新选择" Command="{Binding OpenImageCommnad}"/>
                         </Grid>
-                        <CheckBox Grid.Row="1" Width="20" Height="20" IsChecked="{Binding IsRemoveBackground}"/>
+                        <StackPanel  Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center">
+                        <CheckBox Width="20" Height="20" IsChecked="{Binding IsRemoveBackground}"/>
+                        <cus:ImageButton Margin="8,0,0,0"
+                                Height="16" Width="16" IconHeight="16" IconWidth="16"  
+                                Icon="pack://application:,,,/PDF Office;component/Resources/Dialog/help.png"  
+                                IconPress="pack://application:,,,/PDF Office;component/Resources/Dialog/help.png"  
+                                IconMouseOver="pack://application:,,,/PDF Office;component/Resources/Dialog/help.png">
+                            <cus:ImageButton.ToolTip >
+                                    <ToolTip Style ="{StaticResource TriangleToolTipStyle}" Placement="Bottom" Content="Remove white background from images" >
+                                    <ToolTip.HorizontalOffset>
+                                        <MultiBinding Converter="{StaticResource CenterToolTipConverter}">
+                                            <Binding RelativeSource="{RelativeSource Self}" Path="PlacementTarget.ActualWidth"/>
+                                            <Binding RelativeSource="{RelativeSource Self}" Path="ActualWidth"/>
+                                        </MultiBinding>
+                                    </ToolTip.HorizontalOffset>
+                                </ToolTip>
+                            </cus:ImageButton.ToolTip>
+                            </cus:ImageButton>
+                        </StackPanel>
                     </Grid>
                 </TabItem>
             </TabControl>