Kaynağa Gözat

compdfkit(win) - 文件信息文案资源

weixiangjie 1 yıl önce
ebeveyn
işleme
0c086200f9

+ 2 - 1
Demo/Examples/Annotations/MainWindow.xaml

@@ -16,6 +16,7 @@
                 <ResourceDictionary Source="pack://application:,,,/Compdfkit_Tools;component/Asset/Styles/ButtonStyle.xaml"></ResourceDictionary>
                 <ResourceDictionary Source="pack://application:,,,/Compdfkit_Tools;component/Asset/Styles/ComboBoxStyle.xaml"></ResourceDictionary>
             </ResourceDictionary.MergedDictionaries>
+            <common:DocInfoResourceConverter x:Key="DocInfoResourceConverter"></common:DocInfoResourceConverter>
         </ResourceDictionary>
     </Window.Resources>
     <Grid>
@@ -250,7 +251,7 @@
                         <RowDefinition Height="*"></RowDefinition>
                     </Grid.RowDefinitions>
 
-                    <TextBlock Height="20" FontSize="14" LineHeight="16" Margin="12,6,0,0" HorizontalAlignment="Left">Document Info</TextBlock>
+                    <TextBlock Text="{Binding Converter={StaticResource DocInfoResourceConverter},ConverterParameter=Title_DocInfo}" Height="20" FontSize="14" LineHeight="16" Margin="12,6,0,0" HorizontalAlignment="Left"></TextBlock>
                     <Button Grid.Column="1" Width="16" Height="16" HorizontalAlignment="Right" Margin="0,8,8,0" BorderThickness="0" Click="FileInfoCloseBtn_Click">
                         <Button.Content>
                             <Path Fill="Black">

+ 36 - 0
Demo/Examples/Compdfkit_Tools/Common/Convert/LanguageResourceConverter.cs

@@ -97,4 +97,40 @@ namespace Compdfkit_Tools.Common
             throw new NotSupportedException();
         }
     }
+    
+    public class DocInfoResourceConverter : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if (parameter == null || string.IsNullOrEmpty(parameter.ToString()))
+            {
+                return string.Empty;
+            }
+
+            return LanguageHelper.DocInfoManager.GetString(parameter.ToString());
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            throw new NotSupportedException();
+        }
+    }
+    
+    public class SecurityResourceConverter : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if (parameter == null || string.IsNullOrEmpty(parameter.ToString()))
+            {
+                return string.Empty;
+            }
+
+            return LanguageHelper.SecurityManager.GetString(parameter.ToString());
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            throw new NotSupportedException();
+        }
+    }
 }

+ 2 - 0
Demo/Examples/Compdfkit_Tools/Common/Helper/LanguageHelper.cs

@@ -10,5 +10,7 @@ namespace Compdfkit_Tools.Helper
         public static ResourceManager PropertyPanelManager= new ResourceManager("Compdfkit_Tools.Strings.PropertyPanel", Assembly.GetExecutingAssembly());
         public static ResourceManager ToolBarManager= new ResourceManager("Compdfkit_Tools.Strings.ToolBar", Assembly.GetExecutingAssembly());
         public static ResourceManager SigManager= new ResourceManager("Compdfkit_Tools.Strings.Signature", Assembly.GetExecutingAssembly());
+        public static ResourceManager DocInfoManager= new ResourceManager("Compdfkit_Tools.Strings.DocInfo", Assembly.GetExecutingAssembly());
+        public static ResourceManager SecurityManager= new ResourceManager("Compdfkit_Tools.Strings.Security", Assembly.GetExecutingAssembly());
     }
 }

+ 14 - 9
Demo/Examples/Compdfkit_Tools/PDFView/PDFInfo/CPDFAbstractInfoControl.xaml

@@ -2,33 +2,38 @@
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              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:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:common="clr-namespace:Compdfkit_Tools.Common"
              mc:Ignorable="d">
-    <GroupBox Header="Abstract">
+    <UserControl.Resources>
+        <ResourceDictionary>
+            <common:DocInfoResourceConverter x:Key="DocInfoResourceConverter"/>
+        </ResourceDictionary>
+    </UserControl.Resources>
+    <GroupBox Header="{Binding Converter={StaticResource DocInfoResourceConverter},ConverterParameter=Subtitle_Abstract}">
         <StackPanel Orientation="Vertical" Margin="19,12,0,0">
-            
             <StackPanel Orientation="Horizontal"  Height="30">
-                <TextBlock Text="File Name:"></TextBlock>
+                <TextBlock Text="{Binding Converter={StaticResource DocInfoResourceConverter},ConverterParameter=Info_FileName}"></TextBlock>
                 <TextBlock x:Name="FileNameTextBlock" TextWrapping="NoWrap" Margin="4,0,0,0" Foreground="#999999"/>
             </StackPanel>
             <StackPanel Orientation="Horizontal"  Height="30">
-                <TextBlock Text="Size:"></TextBlock>
+                <TextBlock Text="{Binding Converter={StaticResource DocInfoResourceConverter},ConverterParameter=Info_Size}"></TextBlock>
                 <TextBlock x:Name="FileSizeTextBlock" Margin="4,0,0,0" Foreground="#999999"></TextBlock>
             </StackPanel>
             <StackPanel Orientation="Horizontal"  Height="30">
-                <TextBlock Text="Title:"></TextBlock>
+                <TextBlock Text="{Binding Converter={StaticResource DocInfoResourceConverter},ConverterParameter=Info_Title}"></TextBlock>
                 <TextBlock x:Name="TitleTextBlock" Margin="4,0,0,0" Foreground="#999999"></TextBlock>
             </StackPanel>
             <StackPanel Orientation="Horizontal"  Height="30">
-                <TextBlock Text="Author:"></TextBlock>
+                <TextBlock Text="{Binding Converter={StaticResource DocInfoResourceConverter},ConverterParameter=Info_Author}"></TextBlock>
                 <TextBlock x:Name="AuthorTextBlock" Margin="4,0,0,0" Foreground="#999999"></TextBlock>
             </StackPanel>
             <StackPanel Orientation="Horizontal"  Height="30">
-                <TextBlock Text="Subject:"></TextBlock>
+                <TextBlock Text="{Binding Converter={StaticResource DocInfoResourceConverter},ConverterParameter=Info_Subject}"></TextBlock>
                 <TextBlock x:Name="SubjectTextBlock" Margin="4,0,0,0" Foreground="#999999"></TextBlock>
             </StackPanel>
             <StackPanel Orientation="Horizontal"  Height="30">
-                <TextBlock Text="Keywords:"></TextBlock>
+                <TextBlock Text="{Binding Converter={StaticResource DocInfoResourceConverter},ConverterParameter=Info_Keywords}"></TextBlock>
                 <TextBlock x:Name="KeywordTextBlock" Margin="4,0,0,0" Foreground="#999999"></TextBlock>
             </StackPanel>
         </StackPanel>

+ 13 - 8
Demo/Examples/Compdfkit_Tools/PDFView/PDFInfo/CPDFCreateInfoControl.xaml

@@ -2,29 +2,34 @@
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              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:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:common="clr-namespace:Compdfkit_Tools.Common"
              mc:Ignorable="d">
-    <GroupBox Header="Create Information">
+    <UserControl.Resources>
+        <ResourceDictionary>
+            <common:DocInfoResourceConverter x:Key="DocInfoResourceConverter"/>
+        </ResourceDictionary>
+    </UserControl.Resources>
+    <GroupBox Header="{Binding Converter={StaticResource DocInfoResourceConverter},ConverterParameter=Subtitle_CreationInfo}">
         <StackPanel Orientation="Vertical" Margin="19,12,0,0">
-            
             <StackPanel Orientation="Horizontal"  Height="30">
-                <TextBlock Text="Version:"></TextBlock>
+                <TextBlock Text="{Binding Converter={StaticResource DocInfoResourceConverter},ConverterParameter=Info_Version}"></TextBlock>
                 <TextBlock x:Name="VersionTextBlock" Margin="4,0,0,0" Foreground="#999999"></TextBlock>
             </StackPanel>
             <StackPanel Orientation="Horizontal"  Height="30">
-                <TextBlock Text="Pages:"></TextBlock>
+                <TextBlock Text="{Binding Converter={StaticResource DocInfoResourceConverter},ConverterParameter=Info_Pages}"></TextBlock>
                 <TextBlock x:Name="PageCountTextBlock" Margin="4,0,0,0" Foreground="#999999"></TextBlock>
             </StackPanel>
             <StackPanel Orientation="Horizontal"  Height="30">
-                <TextBlock Text="Creator:"></TextBlock>
+                <TextBlock Text="{Binding Converter={StaticResource DocInfoResourceConverter},ConverterParameter=Info_Creator}"></TextBlock>
                 <TextBlock x:Name="CreatorTextBlock" Margin="4,0,0,0" Foreground="#999999"></TextBlock>
             </StackPanel>
             <StackPanel Orientation="Horizontal"  Height="30">
-                <TextBlock Text="Creation Date:"></TextBlock>
+                <TextBlock Text="{Binding Converter={StaticResource DocInfoResourceConverter},ConverterParameter=Info_CreationDate}"></TextBlock>
                 <TextBlock x:Name="CreationDateTextBlock" Margin="4,0,0,0" Foreground="#999999"></TextBlock>
             </StackPanel>
             <StackPanel Orientation="Horizontal"  Height="30">
-                <TextBlock Text="Modification Date:"></TextBlock>
+                <TextBlock Text="{Binding Converter={StaticResource DocInfoResourceConverter},ConverterParameter=Info_ModDate}"></TextBlock>
                 <TextBlock x:Name="ModificationDateTextBlock" Margin="4,0,0,0" Foreground="#999999"></TextBlock>
             </StackPanel>
         </StackPanel>

+ 13 - 7
Demo/Examples/Compdfkit_Tools/PDFView/PDFInfo/CPDFSecurityInfoControl.xaml

@@ -3,31 +3,37 @@
              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:common="clr-namespace:Compdfkit_Tools.Common"
              mc:Ignorable="d">
-    <GroupBox Header="Access Permissions">
+    <UserControl.Resources>
+        <ResourceDictionary>
+            <common:DocInfoResourceConverter x:Key="DocInfoResourceConverter"></common:DocInfoResourceConverter>
+        </ResourceDictionary>
+    </UserControl.Resources>
+    <GroupBox Header="{Binding Converter={StaticResource DocInfoResourceConverter},ConverterParameter=Subtitle_Permissions}">
         <StackPanel Orientation="Vertical" Margin="19,12,0,0">
             <StackPanel Orientation="Horizontal"  Height="30">
-                <TextBlock Text="Printing:"></TextBlock>
+                <TextBlock Text="{Binding Converter={StaticResource DocInfoResourceConverter},ConverterParameter=Info_Print}"></TextBlock>
                 <TextBlock x:Name="AllowsPrintingTextBlock" Margin="4,0,0,0" Foreground="#999999"></TextBlock>
             </StackPanel>
             <StackPanel Orientation="Horizontal"  Height="30">
-                <TextBlock Text="Content Copying:" ></TextBlock>
+                <TextBlock Text="{Binding Converter={StaticResource DocInfoResourceConverter},ConverterParameter=Info_Copy}" ></TextBlock>
                 <TextBlock x:Name="AllowsCopyingTextBlock" Margin="4,0,0,0" Foreground="#999999"></TextBlock>
             </StackPanel>
             <StackPanel Orientation="Horizontal"  Height="30">
-                <TextBlock Text="Document Change:"></TextBlock>
+                <TextBlock Text="{Binding Converter={StaticResource DocInfoResourceConverter},ConverterParameter=Info_Mod}"></TextBlock>
                 <TextBlock x:Name="AllowsDocumentChangesTextBlock" Margin="4,0,0,0" Foreground="#999999"></TextBlock>
             </StackPanel>
             <StackPanel Orientation="Horizontal"  Height="30">
-                <TextBlock Text="Document Assembly:"></TextBlock>
+                <TextBlock Text="{Binding Converter={StaticResource DocInfoResourceConverter},ConverterParameter=Info_Assembly}"></TextBlock>
                 <TextBlock x:Name="AllowsDocumentAssemblyTextBlock" Margin="4,0,0,0" Foreground="#999999"></TextBlock>
             </StackPanel>
             <StackPanel Orientation="Horizontal"  Height="30">
-                <TextBlock Text="Commenting:"></TextBlock>
+                <TextBlock Text="{Binding Converter={StaticResource DocInfoResourceConverter},ConverterParameter=Info_Comment}"></TextBlock>
                 <TextBlock x:Name="AllowsCommentingTextBlock" Margin="4,0,0,0" Foreground="#999999"></TextBlock>
             </StackPanel>
             <StackPanel Orientation="Horizontal"  Height="30">
-                <TextBlock Text="Filling of Form Field:"></TextBlock>
+                <TextBlock Text="{Binding Converter={StaticResource DocInfoResourceConverter},ConverterParameter=Info_Form}"></TextBlock>
                 <TextBlock x:Name="AllowsFormFieldEntryTextBlock" Margin="4,0,0,0" Foreground="#999999"></TextBlock>
             </StackPanel>
         </StackPanel>

+ 3 - 2
Demo/Examples/Compdfkit_Tools/PDFView/PDFInfo/CPDFSecurityInfoControl.xaml.cs

@@ -1,13 +1,14 @@
 using ComPDFKit.PDFDocument;
 using ComPDFKitViewer.PdfViewer;
 using System.Windows.Controls;
+using Compdfkit_Tools.Helper;
 
 namespace Compdfkit_Tools.PDFControl
 {
     public partial class CPDFSecurityInfoControl : UserControl
     {
-        private string T_Allowed = "Allowed";
-        private string T_NotAllowed = "Not Allowed";
+        private string T_Allowed = LanguageHelper.DocInfoManager.GetString("Allow_True");
+        private string T_NotAllowed = LanguageHelper.DocInfoManager.GetString("Allow_False");
 
         public CPDFViewer pdfViewer;
         public void InitWithPDFViewer(CPDFViewer pdfViewer)

+ 2 - 1
Demo/Examples/ContentEditor/MainWindow.xaml

@@ -16,6 +16,7 @@
                 <ResourceDictionary Source="pack://application:,,,/Compdfkit_Tools;component/Asset/Styles/ButtonStyle.xaml"></ResourceDictionary>
                 <ResourceDictionary Source="pack://application:,,,/Compdfkit_Tools;component/Asset/Styles/ComboBoxStyle.xaml"></ResourceDictionary>
             </ResourceDictionary.MergedDictionaries>
+            <cpdfcommon:DocInfoResourceConverter x:Key="DocInfoResourceConverter"></cpdfcommon:DocInfoResourceConverter>
         </ResourceDictionary>
     </Window.Resources>
 
@@ -266,7 +267,7 @@
                         <RowDefinition Height="*"></RowDefinition>
                     </Grid.RowDefinitions>
 
-                    <TextBlock Height="20" FontSize="14" LineHeight="16" Margin="12,6,0,0" HorizontalAlignment="Left">Document Info</TextBlock>
+                    <TextBlock Text="{Binding Converter={StaticResource DocInfoResourceConverter},ConverterParameter=Title_DocInfo}" Height="20" FontSize="14" LineHeight="16" Margin="12,6,0,0" HorizontalAlignment="Left"></TextBlock>
                     <Button Grid.Column="1" Width="16" Height="16" HorizontalAlignment="Right" Margin="0,8,8,0" BorderThickness="0" Click="FileInfoCloseBtn_Click">
                         <Button.Content>
                             <Path Fill="Black">

+ 2 - 1
Demo/Examples/DigitalSignature/MainWindow.xaml

@@ -17,6 +17,7 @@
                 <ResourceDictionary Source="pack://application:,,,/Compdfkit_Tools;component/Asset/Styles/ButtonStyle.xaml"></ResourceDictionary>
                 <ResourceDictionary Source="pack://application:,,,/Compdfkit_Tools;component/Asset/Styles/ComboBoxStyle.xaml"></ResourceDictionary>
             </ResourceDictionary.MergedDictionaries>
+            <cpdfcommon:DocInfoResourceConverter x:Key="DocInfoResourceConverter"></cpdfcommon:DocInfoResourceConverter>
         </ResourceDictionary>
     </Window.Resources>
     <Grid>
@@ -245,7 +246,7 @@
                         <RowDefinition Height="*"></RowDefinition>
                     </Grid.RowDefinitions>
 
-                    <TextBlock Height="20" FontSize="14" LineHeight="16" Margin="12,6,0,0" HorizontalAlignment="Left">Document Info</TextBlock>
+                    <TextBlock Text="{Binding Converter={StaticResource DocInfoResourceConverter},ConverterParameter=Title_DocInfo}" Height="20" FontSize="14" LineHeight="16" Margin="12,6,0,0" HorizontalAlignment="Left"></TextBlock>
                     <Button Grid.Column="1" Width="16" Height="16" HorizontalAlignment="Right" Margin="0,8,8,0" BorderThickness="0" Click="FileInfoCloseBtn_Click">
                         <Button.Content>
                             <Path Fill="Black">

+ 2 - 1
Demo/Examples/DocsEditor/MainWindow.xaml

@@ -15,6 +15,7 @@
                 <ResourceDictionary Source="pack://application:,,,/Compdfkit_Tools;component/Asset/Styles/ButtonStyle.xaml"></ResourceDictionary>
                 <ResourceDictionary Source="pack://application:,,,/Compdfkit_Tools;component/Asset/Styles/ComboBoxStyle.xaml"></ResourceDictionary>
             </ResourceDictionary.MergedDictionaries>
+            <cpdfcommon:DocInfoResourceConverter x:Key="DocInfoResourceConverter"></cpdfcommon:DocInfoResourceConverter>
             <!-- Shortcut -->
             <RoutedUICommand x:Key="Open" Text="Open"/>
             <RoutedUICommand x:Key="Save" Text="Right rotate"/>
@@ -299,7 +300,7 @@
                                     <RowDefinition Height="*"></RowDefinition>
                                 </Grid.RowDefinitions>
 
-                                <TextBlock Height="20" FontSize="14" LineHeight="16" Margin="12,6,0,0" HorizontalAlignment="Left">Document Info</TextBlock>
+                                <TextBlock Text="{Binding Converter={StaticResource DocInfoResourceConverter},ConverterParameter=Title_DocInfo}" Height="20" FontSize="14" LineHeight="16" Margin="12,6,0,0" HorizontalAlignment="Left"></TextBlock>
                                 <Button Grid.Column="1" Width="16" Height="16" HorizontalAlignment="Right" Margin="0,8,8,0" BorderThickness="0" Click="FileInfoCloseBtn_Click">
                                     <Button.Content>
                                         <Path Fill="Black">

+ 2 - 1
Demo/Examples/PDFViewer/MainPage.xaml

@@ -15,6 +15,7 @@
                 <ResourceDictionary Source="pack://application:,,,/Compdfkit_Tools;component/Asset/Styles/ButtonStyle.xaml"></ResourceDictionary>
                 <ResourceDictionary Source="pack://application:,,,/Compdfkit_Tools;component/Asset/Styles/ComboBoxStyle.xaml"></ResourceDictionary>
             </ResourceDictionary.MergedDictionaries>
+            <cpdfcommon:DocInfoResourceConverter x:Key="DocInfoResourceConverter"/>
             <!-- Shortcut -->
             <RoutedUICommand x:Key="Open" Text="Open"/>
             <RoutedUICommand x:Key="Save" Text="Right rotate"/>
@@ -309,7 +310,7 @@
                         <RowDefinition Height="*"></RowDefinition>
                     </Grid.RowDefinitions>
 
-                    <TextBlock Height="20" FontSize="14" LineHeight="16" Margin="12,6,0,0" HorizontalAlignment="Left">Document Info</TextBlock>
+                    <TextBlock Text="{Binding Converter={StaticResource DocInfoResourceConverter},ConverterParameter=Title_DocInfo}" Height="20" FontSize="14" LineHeight="16" Margin="12,6,0,0" HorizontalAlignment="Left"></TextBlock>
                     <Button Grid.Column="1" Width="16" Height="16" HorizontalAlignment="Right" Margin="0,8,8,0" BorderThickness="0" Click="FileInfoCloseBtn_Click">
                         <Button.Content>
                             <Path Fill="Black">