Explorar o código

签名-签名自测bug修复

zhuyi %!s(int64=2) %!d(string=hai) anos
pai
achega
69b61d9bc0

+ 1 - 0
PDF Office/PDF Office.csproj

@@ -1896,6 +1896,7 @@
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Resource>
     <Resource Include="Resources\BOTA\no_outline.png" />
+    <Resource Include="Resources\PropertyPanel\nosign.png" />
     <Content Include="source\AnalysisWord\Res\word\_rels\document.xml.rels">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>

BIN=BIN
PDF Office/Resources/PropertyPanel/nosign.png


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

@@ -28,6 +28,18 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
         private IDialogService dialogs;
         public DelegateCommand ShowDialogCommand { get; set; }
 
+
+        private int currentListboxIndex = -1;
+
+        public int CurrentListboxIndex
+        {
+            get { return currentListboxIndex; }
+            set
+            {
+                SetProperty(ref currentListboxIndex, value);
+            }
+        }
+
         public ObservableCollection<Signature> SignatureList { get; set; }
         public SignatureAnnotPropertyViewModel(IDialogService dialogService)
         {
@@ -171,6 +183,9 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             signature.Type = (PDFSettings.SignatureType)Signature.Type;
             stamps.Add(signature);
             Settings.Default.Save();
+
+            SetSignature(Signature);
+            CurrentListboxIndex = SignatureList.Count - 1;
         }
 
         /// <summary>

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

@@ -84,6 +84,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             }
         }
 
+
         private Visibility showImageButton = Visibility.Visible;
 
         public Visibility ShowImageButton
@@ -439,6 +440,11 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             {
                 case 0:
                     {
+                        if (string.IsNullOrEmpty(InputText))
+                        {
+                            Cancel();
+                            return;
+                        }
                         System.Drawing.Color fontcolor = System.Drawing.Color.Black;
                         switch (RadioButtonIndex)
                         {

+ 12 - 2
PDF Office/Views/PropertyPanel/AnnotPanel/SignatureAnnotProperty.xaml

@@ -3,10 +3,12 @@
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
-             xmlns:local="clr-namespace:PDF_Office.Views.PropertyPanel.AnnotPanel" xmlns:customcontrol="clr-namespace:PDF_Office.CustomControl" xmlns:annotpanel="clr-namespace:PDF_Office.ViewModels.PropertyPanel.AnnotPanel" d:DataContext="{d:DesignInstance Type=annotpanel:SignatureAnnotPropertyViewModel}"
+             xmlns:local="clr-namespace:PDF_Office.Views.PropertyPanel.AnnotPanel" xmlns:customcontrol="clr-namespace:PDF_Office.CustomControl" xmlns:annotpanel="clr-namespace:PDF_Office.ViewModels.PropertyPanel.AnnotPanel" xmlns:dataconvert="clr-namespace:PDF_Office.DataConvert" d:DataContext="{d:DesignInstance Type=annotpanel:SignatureAnnotPropertyViewModel}"
              mc:Ignorable="d" >
     <UserControl.Resources>
         <PathGeometry x:Key="Ic_AddButtonPath" Figures="M13.5 8C13.5 11.0376 11.0376 13.5 8 13.5C4.96243 13.5 2.5 11.0376 2.5 8C2.5 4.96243 4.96243 2.5 8 2.5C11.0376 2.5 13.5 4.96243 13.5 8ZM15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1C11.866 1 15 4.13401 15 8ZM7.25005 4.80003V7.25003H4.80005V8.75003H7.25005V11.2H8.75005V8.75003H11.2V7.25003H8.75005V4.80003H7.25005Z"  FillRule="EvenOdd" />
+        <dataconvert:ListCountToVisible x:Key="ListCountToVisible"/>
+        <dataconvert:UnVisivleConvert x:Key="UnVisivleConvert"/>
     </UserControl.Resources>
     <Grid  Background="Transparent">
         <Grid.RowDefinitions>
@@ -32,7 +34,15 @@
             IconMouseOver="{StaticResource Ic_AddButtonPath}" IconMouseOverFill="#C04CF8" />
         </Grid>
         <Grid Grid.Row="1">
-            <ListBox ItemsSource="{Binding SignatureList}" SelectionMode="Single" Width="256" Height="auto" VerticalAlignment="Top"  BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
+            <StackPanel VerticalAlignment="Center" x:Name="NoSignatureStackPanel" Visibility="{Binding SignatureList.Count, Converter={StaticResource ListCountToVisible}}">
+                <Image Source="pack://application:,,,/PDF Office;component/Resources/PropertyPanel/nosign.png" />
+                <TextBlock Text="No signature created" FontSize="14" FontFamily="Segoe UI" Height="22" HorizontalAlignment="Center"/>
+                <TextBlock Width="168" Text="Click the Add button in the upper right corner to create a new signature." FontSize="12" FontFamily="Segoe UI" TextWrapping="Wrap" Foreground="#94989C" HorizontalAlignment="Center"/>
+            </StackPanel>
+            <ListBox ItemsSource="{Binding SignatureList}" 
+                     SelectedIndex="{Binding CurrentListboxIndex,Mode=TwoWay}"
+                     Visibility="{Binding ElementName=NoSignatureStackPanel,Path=Visibility,Converter={StaticResource UnVisivleConvert}}"
+                     SelectionMode="Single" Width="256" Height="auto" VerticalAlignment="Top"  BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
                 <ListBox.ItemTemplate>
                     <DataTemplate >
                         <ListBoxItem >

+ 8 - 2
PDF Office/Views/PropertyPanel/AnnotPanel/SignatureAnnotProperty.xaml.cs

@@ -1,4 +1,5 @@
-using PDF_Office.Model.AnnotPanel;
+using PDF_Office.CustomControl;
+using PDF_Office.Model.AnnotPanel;
 using PDF_Office.ViewModels.PropertyPanel.AnnotPanel;
 using System;
 using System.Collections.Generic;
@@ -46,7 +47,12 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
 
         private void DeleteAll_Click(object sender, RoutedEventArgs e)
         {
-            (DataContext as SignatureAnnotPropertyViewModel).DeleteAll();
+            AlertsMessage alertsMessage = new AlertsMessage();
+            alertsMessage.ShowDialog("提示", "确定要全部删除吗?", "Cancel", "OK");
+            if (alertsMessage.result == ContentResult.Ok)
+            {
+                (DataContext as SignatureAnnotPropertyViewModel).DeleteAll();
+            }
         }
     }
 }

+ 1 - 0
PDF Office/Views/PropertyPanel/AnnotPanel/SignatureCreateDialog.xaml

@@ -189,6 +189,7 @@
                                 <RowDefinition Height="*"/>
                             </Grid.RowDefinitions>
                             <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}"/>
                     </Grid>