Explorar o código

文案-图片转PDF

zhuyi %!s(int64=2) %!d(string=hai) anos
pai
achega
01a3aea547

+ 55 - 0
PDF Office/MultilingualResources/PDF Office.en.xlf

@@ -940,6 +940,61 @@ Drag files to reorder as you need.</target>
           <source>Remove</source>
           <target state="new">Remove</target>
         </trans-unit>
+        <trans-unit id="ImageToPDF_AddFile" translate="yes" xml:space="preserve">
+          <source>Add File</source>
+          <target state="new">Add File</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_AddFolder" translate="yes" xml:space="preserve">
+          <source>Add Folder</source>
+          <target state="new">Add Folder</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_FileName" translate="yes" xml:space="preserve">
+          <source>File Name</source>
+          <target state="new">File Name</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">顶部标题</note>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_Size" translate="yes" xml:space="preserve">
+          <source>Size</source>
+          <target state="new">Size</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_Status" translate="yes" xml:space="preserve">
+          <source>Status</source>
+          <target state="new">Status</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_Title" translate="yes" xml:space="preserve">
+          <source>Image To PDF</source>
+          <target state="new">Image To PDF</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_Create" translate="yes" xml:space="preserve">
+          <source>Creat PDF for each image</source>
+          <target state="new">Creat PDF for each image</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_EmptyContext" translate="yes" xml:space="preserve">
+          <source>Select files
+Drop files here or Click “Add Files” in bottom right corner.</source>
+          <target state="new">Select files
+Drop files here or Click “Add Files” in bottom right corner.</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_ExportTitle" translate="yes" xml:space="preserve">
+          <source>Export</source>
+          <target state="new">Export</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_MenuDelete" translate="yes" xml:space="preserve">
+          <source>Delete</source>
+          <target state="new">Delete</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_MenuShowFolder" translate="yes" xml:space="preserve">
+          <source>Show in Folder</source>
+          <target state="new">Show in Folder</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_Merge" translate="yes" xml:space="preserve">
+          <source>Merge as one PDF document</source>
+          <target state="new">Merge as one PDF document</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_Settings" translate="yes" xml:space="preserve">
+          <source>Settings</source>
+          <target state="new">Settings</target>
+        </trans-unit>
       </group>
     </body>
   </file>

+ 55 - 0
PDF Office/MultilingualResources/PDF Office.zh-Hans.xlf

@@ -940,6 +940,61 @@ Drag files to reorder as you need.</target>
           <source>Remove</source>
           <target state="new">Remove</target>
         </trans-unit>
+        <trans-unit id="ImageToPDF_AddFile" translate="yes" xml:space="preserve">
+          <source>Add File</source>
+          <target state="new">Add File</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_AddFolder" translate="yes" xml:space="preserve">
+          <source>Add Folder</source>
+          <target state="new">Add Folder</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_FileName" translate="yes" xml:space="preserve">
+          <source>File Name</source>
+          <target state="new">File Name</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">顶部标题</note>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_Size" translate="yes" xml:space="preserve">
+          <source>Size</source>
+          <target state="new">Size</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_Status" translate="yes" xml:space="preserve">
+          <source>Status</source>
+          <target state="new">Status</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_Title" translate="yes" xml:space="preserve">
+          <source>Image To PDF</source>
+          <target state="new">Image To PDF</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_Create" translate="yes" xml:space="preserve">
+          <source>Creat PDF for each image</source>
+          <target state="new">Creat PDF for each image</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_EmptyContext" translate="yes" xml:space="preserve">
+          <source>Select files
+Drop files here or Click “Add Files” in bottom right corner.</source>
+          <target state="new">Select files
+Drop files here or Click “Add Files” in bottom right corner.</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_ExportTitle" translate="yes" xml:space="preserve">
+          <source>Export</source>
+          <target state="new">Export</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_MenuDelete" translate="yes" xml:space="preserve">
+          <source>Delete</source>
+          <target state="new">Delete</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_MenuShowFolder" translate="yes" xml:space="preserve">
+          <source>Show in Folder</source>
+          <target state="new">Show in Folder</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_Merge" translate="yes" xml:space="preserve">
+          <source>Merge as one PDF document</source>
+          <target state="new">Merge as one PDF document</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_Settings" translate="yes" xml:space="preserve">
+          <source>Settings</source>
+          <target state="new">Settings</target>
+        </trans-unit>
       </group>
     </body>
   </file>

+ 55 - 0
PDF Office/MultilingualResources/PDF Office.zh-Hant.xlf

@@ -940,6 +940,61 @@ Drag files to reorder as you need.</target>
           <source>Remove</source>
           <target state="new">Remove</target>
         </trans-unit>
+        <trans-unit id="ImageToPDF_AddFile" translate="yes" xml:space="preserve">
+          <source>Add File</source>
+          <target state="new">Add File</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_AddFolder" translate="yes" xml:space="preserve">
+          <source>Add Folder</source>
+          <target state="new">Add Folder</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_FileName" translate="yes" xml:space="preserve">
+          <source>File Name</source>
+          <target state="new">File Name</target>
+          <note from="MultilingualBuild" annotates="source" priority="2">顶部标题</note>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_Size" translate="yes" xml:space="preserve">
+          <source>Size</source>
+          <target state="new">Size</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_Status" translate="yes" xml:space="preserve">
+          <source>Status</source>
+          <target state="new">Status</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_Title" translate="yes" xml:space="preserve">
+          <source>Image To PDF</source>
+          <target state="new">Image To PDF</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_Create" translate="yes" xml:space="preserve">
+          <source>Creat PDF for each image</source>
+          <target state="new">Creat PDF for each image</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_EmptyContext" translate="yes" xml:space="preserve">
+          <source>Select files
+Drop files here or Click “Add Files” in bottom right corner.</source>
+          <target state="new">Select files
+Drop files here or Click “Add Files” in bottom right corner.</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_ExportTitle" translate="yes" xml:space="preserve">
+          <source>Export</source>
+          <target state="new">Export</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_MenuDelete" translate="yes" xml:space="preserve">
+          <source>Delete</source>
+          <target state="new">Delete</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_MenuShowFolder" translate="yes" xml:space="preserve">
+          <source>Show in Folder</source>
+          <target state="new">Show in Folder</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_Merge" translate="yes" xml:space="preserve">
+          <source>Merge as one PDF document</source>
+          <target state="new">Merge as one PDF document</target>
+        </trans-unit>
+        <trans-unit id="ImageToPDF_Settings" translate="yes" xml:space="preserve">
+          <source>Settings</source>
+          <target state="new">Settings</target>
+        </trans-unit>
       </group>
     </body>
   </file>

+ 118 - 0
PDF Office/Strings/MainPage/MainPage.Designer.cs

@@ -447,6 +447,124 @@ namespace PDF_Office.Strings.MainPage {
             }
         }
         
+        /// <summary>
+        ///   查找类似 Add File 的本地化字符串。
+        /// </summary>
+        public static string ImageToPDF_AddFile {
+            get {
+                return ResourceManager.GetString("ImageToPDF_AddFile", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 Add Folder 的本地化字符串。
+        /// </summary>
+        public static string ImageToPDF_AddFolder {
+            get {
+                return ResourceManager.GetString("ImageToPDF_AddFolder", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 Creat PDF for each image 的本地化字符串。
+        /// </summary>
+        public static string ImageToPDF_Create {
+            get {
+                return ResourceManager.GetString("ImageToPDF_Create", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 Select files
+        ///Drop files here or Click “Add Files” in bottom right corner. 的本地化字符串。
+        /// </summary>
+        public static string ImageToPDF_EmptyContext {
+            get {
+                return ResourceManager.GetString("ImageToPDF_EmptyContext", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 Export 的本地化字符串。
+        /// </summary>
+        public static string ImageToPDF_ExportTitle {
+            get {
+                return ResourceManager.GetString("ImageToPDF_ExportTitle", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 File Name 的本地化字符串。
+        /// </summary>
+        public static string ImageToPDF_FileName {
+            get {
+                return ResourceManager.GetString("ImageToPDF_FileName", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 Delete 的本地化字符串。
+        /// </summary>
+        public static string ImageToPDF_MenuDelete {
+            get {
+                return ResourceManager.GetString("ImageToPDF_MenuDelete", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 Show in Folder 的本地化字符串。
+        /// </summary>
+        public static string ImageToPDF_MenuShowFolder {
+            get {
+                return ResourceManager.GetString("ImageToPDF_MenuShowFolder", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 Merge as one PDF document 的本地化字符串。
+        /// </summary>
+        public static string ImageToPDF_Merge {
+            get {
+                return ResourceManager.GetString("ImageToPDF_Merge", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 Settings 的本地化字符串。
+        /// </summary>
+        public static string ImageToPDF_Settings {
+            get {
+                return ResourceManager.GetString("ImageToPDF_Settings", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 Size 的本地化字符串。
+        /// </summary>
+        public static string ImageToPDF_Size {
+            get {
+                return ResourceManager.GetString("ImageToPDF_Size", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 Status 的本地化字符串。
+        /// </summary>
+        public static string ImageToPDF_Status {
+            get {
+                return ResourceManager.GetString("ImageToPDF_Status", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   查找类似 Image To PDF 的本地化字符串。
+        /// </summary>
+        public static string ImageToPDF_Title {
+            get {
+                return ResourceManager.GetString("ImageToPDF_Title", resourceCulture);
+            }
+        }
+        
         /// <summary>
         ///   查找类似 Page 的本地化字符串。
         /// </summary>

+ 41 - 0
PDF Office/Strings/MainPage/MainPage.resx

@@ -251,6 +251,47 @@
   <data name="Highlight_Title" xml:space="preserve">
     <value>Highlight</value>
   </data>
+  <data name="ImageToPDF_AddFile" xml:space="preserve">
+    <value>Add File</value>
+  </data>
+  <data name="ImageToPDF_AddFolder" xml:space="preserve">
+    <value>Add Folder</value>
+  </data>
+  <data name="ImageToPDF_Create" xml:space="preserve">
+    <value>Creat PDF for each image</value>
+  </data>
+  <data name="ImageToPDF_EmptyContext" xml:space="preserve">
+    <value>Select files
+Drop files here or Click “Add Files” in bottom right corner.</value>
+  </data>
+  <data name="ImageToPDF_ExportTitle" xml:space="preserve">
+    <value>Export</value>
+  </data>
+  <data name="ImageToPDF_FileName" xml:space="preserve">
+    <value>File Name</value>
+    <comment>顶部标题</comment>
+  </data>
+  <data name="ImageToPDF_MenuDelete" xml:space="preserve">
+    <value>Delete</value>
+  </data>
+  <data name="ImageToPDF_MenuShowFolder" xml:space="preserve">
+    <value>Show in Folder</value>
+  </data>
+  <data name="ImageToPDF_Merge" xml:space="preserve">
+    <value>Merge as one PDF document</value>
+  </data>
+  <data name="ImageToPDF_Settings" xml:space="preserve">
+    <value>Settings</value>
+  </data>
+  <data name="ImageToPDF_Size" xml:space="preserve">
+    <value>Size</value>
+  </data>
+  <data name="ImageToPDF_Status" xml:space="preserve">
+    <value>Status</value>
+  </data>
+  <data name="ImageToPDF_Title" xml:space="preserve">
+    <value>Image To PDF</value>
+  </data>
   <data name="Link_Page" xml:space="preserve">
     <value>Page</value>
   </data>

+ 149 - 37
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePictureToPDFDialogViewModel.cs

@@ -21,6 +21,110 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
 {
     public class HomePagePictureToPDFDialogViewModel : BindableBase, IDialogAware
     {
+        #region 文案
+
+        private string T_title;
+
+        public string T_Title
+        {
+            get { return T_title; }
+            set
+            {
+                SetProperty(ref T_title, value);
+            }
+        }
+
+        private string T_addFolder;
+
+        public string T_AddFolder
+        {
+            get { return T_addFolder; }
+            set
+            {
+                SetProperty(ref T_addFolder, value);
+            }
+        }
+
+        private string T_addFile;
+
+        public string T_AddFile
+        {
+            get { return T_addFile; }
+            set
+            {
+                SetProperty(ref T_addFile, value);
+            }
+        }
+
+        private string T_emptyContext;
+
+        public string T_EmptyContext
+        {
+            get { return T_emptyContext; }
+            set
+            {
+                SetProperty(ref T_emptyContext, value);
+            }
+        }
+
+        private string T_settings;
+
+        public string T_Settings
+        {
+            get { return T_settings; }
+            set
+            {
+                SetProperty(ref T_settings, value);
+            }
+        }
+
+        private string T_exportTitle;
+
+        public string T_ExportTitle
+        {
+            get { return T_exportTitle; }
+            set
+            {
+                SetProperty(ref T_exportTitle, value);
+            }
+        }
+
+        private string T_create;
+
+        public string T_Create
+        {
+            get { return T_create; }
+            set
+            {
+                SetProperty(ref T_create, value);
+            }
+        }
+
+        private string T_merge;
+
+        public string T_Merge
+        {
+            get { return T_merge; }
+            set
+            {
+                SetProperty(ref T_merge, value);
+            }
+        }
+
+        private void InitString()
+        {
+            T_Title = App.MainPageLoader.GetString("ImageToPDF_Title");
+            T_AddFolder = App.MainPageLoader.GetString("ImageToPDF_AddFolder");
+            T_AddFile = App.MainPageLoader.GetString("ImageToPDF_AddFile");
+            T_EmptyContext = App.MainPageLoader.GetString("ImageToPDF_EmptyContext");
+            T_Settings = App.MainPageLoader.GetString("ImageToPDF_Settings");
+            T_ExportTitle = App.MainPageLoader.GetString("ImageToPDF_ExportTitle");
+            T_Create = App.MainPageLoader.GetString("ImageToPDF_Create");
+            T_Merge = App.MainPageLoader.GetString("ImageToPDF_Merge");
+        }
+
+        #endregion
+
         #region 参数和属性
         private List<string> fileNames;
 
@@ -31,7 +135,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
 
         public List<int> fileNamesView = new List<int>();
 
-        public HomePagePictureToPDFDialogModel pictureToPDFModel=new HomePagePictureToPDFDialogModel();
+        public HomePagePictureToPDFDialogModel pictureToPDFModel = new HomePagePictureToPDFDialogModel();
 
         private string pictureToPDFGridIsEnabled = "True";
         public string PictureToPDFGridIsEnabled
@@ -139,6 +243,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
         #endregion
         public HomePagePictureToPDFDialogViewModel(IDialogService dialogs)
         {
+            InitString();
             this.dialogs = dialogs;
             ToPDFCommand = new DelegateCommand(topdf);
             ADDPictureCommand = new DelegateCommand(addpicture);
@@ -152,7 +257,8 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
             this.dialogs = dialogs;
         }
         #region 逻辑函数
-        private void topdf() {
+        private void topdf()
+        {
             PictureToPDFGridIsEnabled = "False";
             if (pictureToPDFModel.Mode == HomePagePictureToPDFDialogModel.ToPDFFileMode.NewFiles)
             {
@@ -164,7 +270,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
                     SaveSelectedPath = dlg.SelectedPath.Trim();
                     saveSelectedPath = SaveSelectedPath + "\\";
                 }
-                else { PictureToPDFGridIsEnabled = "True"; return;  }
+                else { PictureToPDFGridIsEnabled = "True"; return; }
                 fileNamesIndex = 0;
                 string fileName = "";
                 foreach (var filename in fileNames)
@@ -180,9 +286,9 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
                     }
                     CPDFDocument topdfdoc = CPDFDocument.CreateDocument();
                     FileInfo fileinfo = new FileInfo(filename);
-                    JpegInsertPage(ref topdfdoc, filename, fileinfo,img.Width,img.Height);
+                    JpegInsertPage(ref topdfdoc, filename, fileinfo, img.Width, img.Height);
                     Trace.WriteLine("Path.GetTempPath():" + Path.GetTempPath());
-                    fileName = savefilename(filename,saveSelectedPath);
+                    fileName = savefilename(filename, saveSelectedPath);
                     topdfdoc.WriteToFilePath(fileName);
                     topdfdoc.Release();
                     string file_size = (((float)fileinfo.Length) / 1024).ToString() + " K";
@@ -195,7 +301,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
             }
             if (pictureToPDFModel.Mode == HomePagePictureToPDFDialogModel.ToPDFFileMode.OneNewFile)
             {
-                
+
                 CPDFDocument topdfdoc = CPDFDocument.CreateDocument();
                 int pageindex = 0;
                 FolderBrowserDialog folderDialog = new FolderBrowserDialog();
@@ -205,10 +311,11 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
                 string NewFileName = "";
                 if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                 {
-                    NewFileName=sfd.FileName;
+                    NewFileName = sfd.FileName;
                 }
                 else { PictureToPDFGridIsEnabled = "True"; return; }
-                    foreach (var filename in fileNames) {
+                foreach (var filename in fileNames)
+                {
                     ImagesDataTable.Rows[fileNamesIndex]["FileState"] = "wait";
                     ImagesCurrentDataTable.Rows[fileNamesIndex]["FileState"] = "wait";
                     Image img = Image.FromFile(filename);
@@ -219,7 +326,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
                         continue;
                     }
                     FileInfo fileinfo = new FileInfo(filename);
-                    JpegInsertPage(ref topdfdoc, filename, fileinfo,img.Width, img.Height, pageindex);
+                    JpegInsertPage(ref topdfdoc, filename, fileinfo, img.Width, img.Height, pageindex);
                     pageindex++;
                     string file_size = (((float)fileinfo.Length) / 1024).ToString() + " K";
                     ImagesDataTable.Rows[fileNamesIndex]["FileState"] = "complete";
@@ -239,7 +346,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
                     saveSelectedPath = dlg.SelectedPath.Trim();
                     saveSelectedPath = saveSelectedPath + "\\";
                 }
-                else {PictureToPDFGridIsEnabled = "True"; return; }
+                else { PictureToPDFGridIsEnabled = "True"; return; }
                 CPDFDocument topdfdoc = CPDFDocument.InitWithFilePath(pictureToPDFModel.FilePath);
                 if (topdfdoc == null)
                 {
@@ -295,22 +402,22 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
                     ImagesCurrentDataTable.Rows[fileNamesIndex]["FileState"] = "complete";
                     fileNamesIndex++;
                 }
-                string saveselectedpath = CommonHelper.CreateFilePath(saveSelectedPath + topdfdoc.FileName+".pdf");
+                string saveselectedpath = CommonHelper.CreateFilePath(saveSelectedPath + topdfdoc.FileName + ".pdf");
                 topdfdoc.WriteToFilePath(saveselectedpath);
                 System.Diagnostics.Process.Start("Explorer", "/select," + saveselectedpath);
                 topdfdoc.Release();
             }
             PictureToPDFGridIsEnabled = "True";
-            fileNamesIndex=0;
+            fileNamesIndex = 0;
         }
 
         /// <summary>
         /// 设置保存后的文件名
         /// </summary>
-        public string savefilename(string filename,string filepath)
+        public string savefilename(string filename, string filepath)
         {
             FileInfo file = new FileInfo(filename);
-            return CommonHelper.CreateFilePath(filepath + pictureToPDFModel.FrontFileNameLabel + file.Name.Replace(file.Extension,".pdf") + pictureToPDFModel.RearFileNameLabel);
+            return CommonHelper.CreateFilePath(filepath + pictureToPDFModel.FrontFileNameLabel + file.Name.Replace(file.Extension, ".pdf") + pictureToPDFModel.RearFileNameLabel);
         }
         #endregion
 
@@ -325,7 +432,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
             dlg.Filter = "PDF|*.pdf;*.PDF;";
             if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
-                SelectFileName=dlg.FileName;
+                SelectFileName = dlg.FileName;
                 pictureToPDFModel.FilePath = dlg.FileName;
                 ImageToPDFBtnIsEnable = "True";
             }
@@ -376,7 +483,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
                 foreach (string app in apps)
                 {
                     var fi = new FileInfo(app);
-                    if (fi.Extension == ".png" || fi.Extension == ".jpg" || fi.Extension == ".jpeg" || fi.Extension ==".bmp"|| fi.Extension == ".gif"|| fi.Extension == ".tiff")
+                    if (fi.Extension == ".png" || fi.Extension == ".jpg" || fi.Extension == ".jpeg" || fi.Extension == ".bmp" || fi.Extension == ".gif" || fi.Extension == ".tiff")
                     {
                         fileNames.Add(app);
                     }
@@ -396,10 +503,10 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
         public void removepicturefiles()
         {
             FileNameNumber = fileNames.Count;
-            
-                //Trace.WriteLine(filenamesview);
-                fileNames.Clear();
-            
+
+            //Trace.WriteLine(filenamesview);
+            fileNames.Clear();
+
             if (fileNames.Count < 1)
             {
                 SetPictureToPDFGridIsEnabled = "False";
@@ -409,7 +516,8 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
             updateListview("wait");
         }
 
-        public void removepicturefile() {
+        public void removepicturefile()
+        {
             FileNameNumber = fileNames.Count;
             Reverseorder(ref fileNamesView);
             foreach (int filenamesview in fileNamesView)
@@ -443,18 +551,20 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
         /// <summary>
         /// 打开文件图片
         /// </summary>
-        public void openfiledialog(){
+        public void openfiledialog()
+        {
 
             foreach (int filenamesview in fileNamesView)
             {
-              System.Diagnostics.Process.Start("Explorer", "/select," + fileNames[filenamesview]);
+                System.Diagnostics.Process.Start("Explorer", "/select," + fileNames[filenamesview]);
             }
         }
 
         /// <summary>
         /// 删除重复的文件
         /// </summary>
-        public void RemoveExcess(ref List<string> Filenames) {
+        public void RemoveExcess(ref List<string> Filenames)
+        {
             List<string> filenames = new List<string>();
             foreach (var fileName in Filenames)
             {
@@ -472,7 +582,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
         /// </summary>
         public void Reverseorder(ref List<int> Numbers)
         {
-            Numbers=Numbers.OrderBy(a=>a).ToList();
+            Numbers = Numbers.OrderBy(a => a).ToList();
             Numbers.Reverse();
         }
 
@@ -480,7 +590,8 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
         /// 更新listview显示
         /// state 状态显示字符串
         /// </summary>
-        public void updateListview(string state) {
+        public void updateListview(string state)
+        {
             updateCurrentListview();
             DataTable imagesdatatable = new DataTable();
             imagesdatatable.Columns.Add("FileName");
@@ -492,7 +603,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
                 string file_all = fileName;
                 FileInfo f = new FileInfo(file_all);
                 if (!f.Exists) { continue; }
-                string file_size = (((float)f.Length)/1024).ToString()+" K";
+                string file_size = (((float)f.Length) / 1024).ToString() + " K";
                 imagesdatatable.Rows.Add(f.Name, file_size, ImagesCurrentDataTable.Rows[datatableindex]["FileState"]);
                 datatableindex++;
             }
@@ -503,7 +614,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
         /// 更新Currentlistview显示
         /// pagerangetext 自定义页面范围字符串  pagerangeselectindex combobox下拉索引(0全部页面 1奇数页 2偶数页 3自定义页面)isevenpageisenabled 偶数页状态 state 状态显示字符串
         /// </summary>
-        public void updateCurrentListview( string state = "wait")
+        public void updateCurrentListview(string state = "wait")
         {
             if (fileNames.Count >= FileNameNumber)
             {
@@ -592,25 +703,26 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
         /// height page高
         /// index 插入位置
         /// </summary>
-        private void JpegInsertPage(ref CPDFDocument topdfdoc,string filename, FileInfo fileinfo,int width,int height,int index=0) {
+        private void JpegInsertPage(ref CPDFDocument topdfdoc, string filename, FileInfo fileinfo, int width, int height, int index = 0)
+        {
 
             string tempFileName = "";
-            if (fileinfo.Extension == ".jpg"|| fileinfo.Extension == ".jpeg")
+            if (fileinfo.Extension == ".jpg" || fileinfo.Extension == ".jpeg")
             {
                 topdfdoc.InsertPage(index, width, height, filename);
             }
-            else 
+            else
             {
                 tempFileName = Path.GetTempPath() + "pngtemp.jpg";
                 if (!PictureConverter.SaveJpeg(filename, tempFileName))
-                { 
+                {
                     MessageBoxEx.Show("图片格式有问题");
                 }
                 topdfdoc.InsertPage(index, width, height, tempFileName);
             }
         }
 
-        public void CloseDialoge() { RequestClose?.Invoke(new DialogResult(ButtonResult.OK));}
+        public void CloseDialoge() { RequestClose?.Invoke(new DialogResult(ButtonResult.OK)); }
         #endregion
 
         #region 构架行为
@@ -629,12 +741,12 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
 
         public void OnDialogOpened(IDialogParameters parameters)
         {
-            string[] filepath=null;
+            string[] filepath = null;
             parameters.TryGetValue<string[]>(ParameterNames.FilePath, out filepath);
-            if (filepath!=null)
+            if (filepath != null)
             {
-                fileNames=filepath.ToList();
-                
+                fileNames = filepath.ToList();
+
                 updateListview("wait");
             }
         }

+ 15 - 14
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePictureToPDFDialog.xaml

@@ -8,6 +8,7 @@
     xmlns:homepagetoolsdialogs="clr-namespace:PDF_Office.ViewModels.Dialog.HomePageToolsDialogs"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:prism="http://prismlibrary.com/"
+    xmlns:mainpage="clr-namespace:PDF_Office.Strings.MainPage"
     x:Name="userControl"
     d:DataContext="{d:DesignInstance Type=homepagetoolsdialogs:HomePagePictureToPDFDialogViewModel}"
     prism:Dialog.WindowStyle="{StaticResource stlWindowEx}"
@@ -155,7 +156,7 @@
             <RowDefinition Height="*" />
         </Grid.RowDefinitions>
         <Grid Background="{StaticResource color.sys.layout.bg.tabbar}" >
-            <TextBlock Text="Image to PDF" Foreground="{StaticResource color.sys.text.neutral.lv1}" FontSize="16" FontFamily="Segoe UI" VerticalAlignment="Center" FontWeight="DemiBold" Margin="16,8,0,8" HorizontalAlignment="Left"></TextBlock>
+            <TextBlock Text="{Binding T_Title}" Foreground="{StaticResource color.sys.text.neutral.lv1}" FontSize="16" FontFamily="Segoe UI" VerticalAlignment="Center" FontWeight="DemiBold" Margin="16,8,0,8" HorizontalAlignment="Left"></TextBlock>
             <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" WindowChrome.IsHitTestVisibleInChrome="True">
                 <Button
                 Name="BtnMiniSize"
@@ -260,7 +261,7 @@
                                 Margin="0,2,0,0"
                                 FontSize="12"
                                 Style="{StaticResource PropertyHeaderLv2}"
-                                Text="Click the button below to select the file."
+                                Text="{Binding T_EmptyContext}"
                                 TextAlignment="Center"
                                 TextBlock.Foreground="{StaticResource color.sys.text.neutral.lv3}" />
                             </StackPanel>
@@ -305,16 +306,16 @@
                                     <MenuItem
                                 Name="OpenFileMenuItem"
                                 Click="OpenFileMenuItem_Click"
-                                Header="打开文件" />
+                                Header="{x:Static mainpage:MainPage.ImageToPDF_MenuShowFolder}" />
                                     <MenuItem
                                 Name="RemoveFileMenuItem"
                                 Click="RemoveFileMenuItem_Click"
-                                Header="移除" />
+                                Header="{x:Static mainpage:MainPage.ImageToPDF_MenuDelete}" />
                                 </ContextMenu>
                             </ListView.ContextMenu>
                             <ListView.View>
                                 <GridView ColumnHeaderContainerStyle="{StaticResource HeadStyle}">
-                                    <GridViewColumn Width="{Binding ElementName=col1, Path=ActualWidth}" Header="文档名">
+                                    <GridViewColumn Width="{Binding ElementName=col1, Path=ActualWidth}" Header="{x:Static mainpage:MainPage.ImageToPDF_FileName}">
                                         <GridViewColumn.CellTemplate>
                                             <DataTemplate>
                                                 <StackPanel Orientation="Horizontal">
@@ -341,8 +342,8 @@
                                             </DataTemplate>
                                         </GridViewColumn.CellTemplate>
                                     </GridViewColumn>
-                                    <GridViewColumn DisplayMemberBinding="{Binding FileSize}" Width="{Binding ElementName=col2, Path=ActualWidth}" Header="大小" />
-                                    <GridViewColumn Header="状态" Width="{Binding ElementName=col3, Path=ActualWidth}">
+                                    <GridViewColumn DisplayMemberBinding="{Binding FileSize}" Width="{Binding ElementName=col2, Path=ActualWidth}" Header="{x:Static mainpage:MainPage.ImageToPDF_Size}" />
+                                    <GridViewColumn Header="{x:Static mainpage:MainPage.ImageToPDF_Status}" Width="{Binding ElementName=col3, Path=ActualWidth}">
                                         <GridViewColumn.CellTemplate>
                                             <DataTemplate>
                                                 <StackPanel Orientation="Horizontal">
@@ -427,7 +428,7 @@
                                 Height="22"
                                 FontSize="14"
                                 Foreground="Black"
-                                Text="Add Files" />
+                                Text="{Binding T_AddFile}" />
                             </Border>
                             <Border
                             Width="12"
@@ -463,11 +464,11 @@
                                     <MenuItem
                                     x:Name="添加文件"
                                     Command="{Binding ADDPictureCommand}"
-                                    Header="添加文件" />
+                                    Header="{Binding T_AddFile}" />
                                     <MenuItem
                                     x:Name="添加文件夹"
                                     Command="{Binding ADDPictureFilesCommand}"
-                                    Header="添加文件夹" />
+                                    Header="{Binding T_AddFolder}" />
                                 </StackPanel>
                             </Border>
                         </Grid>
@@ -504,12 +505,12 @@
                 </Grid.RowDefinitions>
                 <Grid Grid.Row="0" Margin="16,14,0,0">
                     <StackPanel>
-                        <TextBlock Style="{StaticResource PagesView_titleContext}" Text="Setting" />
+                        <TextBlock Style="{StaticResource PagesView_titleContext}" Text="{Binding T_Settings}" />
                         <TextBlock
                         Height="20"
                         Margin="0,16,0,0"
                         Style="{StaticResource PropertyHeaderLv2}"
-                        Text="Export" />
+                        Text="{Binding T_ExportTitle}" />
 
                         <StackPanel Margin="0,8,0,0">
                             <RadioButton
@@ -518,7 +519,7 @@
                             Click="RadioButton_Click"
                             IsChecked="True"
                             Style="{StaticResource RadioButtonStyleText}">
-                                <TextBlock Text="新建文档" />
+                                <TextBlock Text="{Binding T_Create}" />
                             </RadioButton>
                             <RadioButton
                             Name="OneNewFileNameRadioButtom"
@@ -526,7 +527,7 @@
                             Padding="9,0,0,0"
                             Click="RadioButton_Click"
                             Style="{StaticResource RadioButtonStyleText}">
-                                <TextBlock Text="合并为同一份PDF文档" />
+                                <TextBlock Text="{Binding T_Merge}" />
                             </RadioButton>
                             <RadioButton
                             Name="SelectFileNameRadioButton"