浏览代码

图片转PDF-除OCR基本功能

liyijie 2 年之前
父节点
当前提交
d3774c80fe

+ 191 - 188
PDF Office/App.xaml.cs

@@ -1,201 +1,204 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Data;
-using System.IO;
-using System.Linq;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using ComPDFKit.NativeMethod;
-using ComPDFKit_Conversion.Converter;
-using PDF_Office.CustomControl;
-using PDF_Office.CustomControl.SystemControl;
-using PDF_Office.ViewModels;
-using PDF_Office.Views;
-using PDF_Office.Views.BOTA;
-using PDF_Office.Views.Dialog;
-using PDF_Office.Views.HomePanel;
-using Prism.DryIoc;
-using Prism.Ioc;
-using Prism.Regions;
-using PDF_Office.Model;
-using PDF_Office.Views.PageEdit;
-using PDF_Office.Properties;
-using PDFSettings.Settings;
-using PDF_Office.Views.Tools; 
-using PDF_Office.Views.Dialog.ToolsDialogs.SaftyDialogs;
-using PDF_Office.Views.Dialog.ToolsDialogs.CompressDialogs;
-using PDF_Office.Views.Dialog.PageEditDialogs;
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using ComPDFKit.NativeMethod;
+using ComPDFKit_Conversion.Converter;
+using PDF_Office.CustomControl;
+using PDF_Office.CustomControl.SystemControl;
+using PDF_Office.ViewModels;
+using PDF_Office.Views;
+using PDF_Office.Views.BOTA;
+using PDF_Office.Views.Dialog;
+using PDF_Office.Views.HomePanel;
+using Prism.DryIoc;
+using Prism.Ioc;
+using Prism.Regions;
+using PDF_Office.Model;
+using PDF_Office.Views.PageEdit;
+using PDF_Office.Properties;
+using PDFSettings.Settings;
+using PDF_Office.Views.Tools; 
+using PDF_Office.Views.Dialog.ToolsDialogs.SaftyDialogs;
+using PDF_Office.Views.Dialog.ToolsDialogs.CompressDialogs;
+using PDF_Office.Views.Dialog.PageEditDialogs;
 using PDF_Office.Views.Dialog.HomePageToolsDialogs ;
 using PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePagePrinter;
 
 
-namespace PDF_Office
-{
-    /// <summary>
-    /// App.xaml 的交互逻辑
-    /// </summary>
-    public partial class App : PrismApplication
-    {
-        public static string CurrentPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "PDF Office");
-
-        public static MainWindowViewModel mainWindowViewModel;
-
-        public static List<string> OpenedFileList = new List<string>();
-
-        public static bool IsFirstOpen = true;
-
-        public App()
-        {
-
-#if !DEBUG
-            //接入Appcenter后台数据检测
-            string appkey = "b099dccc-1ca5-4ea1-a2fa-afd4a6e1f8bb"
-            AppCenter.Start(appkey, typeof(Analytics), typeof(Crashes));
-            var countryCode = RegionInfo.CurrentRegion.TwoLetterISORegionName;//上传国家信息
-            AppCenter.SetCountryCode(countryCode);
-#endif
-            LicenseVerify();
-
-
-            if (Settings.Default.RecentOpenFiles == null)
-                Settings.Default.RecentOpenFiles = new RecentOpenFiles();
-
-            try
-            {
-                DirectoryInfo info = new DirectoryInfo(CurrentPath);
-                if (File.Exists(CurrentPath))
-                    File.Delete(CurrentPath);
-                if (!info.Exists)
-                {
-                    info.Create();
-                }
-            }
-            catch (Exception ex)
-            {
-
-            }
-        }
-
-        /// <summary>
-        /// 创建启动窗口
-        /// </summary>
-        /// <returns></returns>
-        protected override Window CreateShell()
-        {
- 
-            return Container.Resolve<MainWindow>();
-        }
-
-
-        protected override void RegisterTypes(IContainerRegistry containerRegistry)
-        {
-            //注册内容组件
-            containerRegistry.RegisterForNavigation<HomeContent>();
-            containerRegistry.RegisterForNavigation<ViewContent>();
-            containerRegistry.RegisterForNavigation<MainContent>();
-            containerRegistry.RegisterForNavigation<HomeCloudContent>("Cloud");
-            containerRegistry.RegisterForNavigation<HomeToolsContent>("Tools");
-            containerRegistry.RegisterForNavigation<HomeGuidContent>("Guid");
-            containerRegistry.RegisterForNavigation<BOTAContent>();
-            containerRegistry.RegisterForNavigation<PageEditContent>();
-            containerRegistry.RegisterForNavigation<ToolsBarContent>();
+namespace PDF_Office
+{
+    /// <summary>
+    /// App.xaml 的交互逻辑
+    /// </summary>
+    public partial class App : PrismApplication
+    {
+        public static string CurrentPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "PDF Office");
+
+        public static MainWindowViewModel mainWindowViewModel;
+
+        public static List<string> OpenedFileList = new List<string>();
+
+        public static bool IsFirstOpen = true;
+
+        public App()
+        {
+
+#if !DEBUG
+            //接入Appcenter后台数据检测
+            string appkey = "b099dccc-1ca5-4ea1-a2fa-afd4a6e1f8bb"
+            AppCenter.Start(appkey, typeof(Analytics), typeof(Crashes));
+            var countryCode = RegionInfo.CurrentRegion.TwoLetterISORegionName;//上传国家信息
+            AppCenter.SetCountryCode(countryCode);
+#endif
+            LicenseVerify();
+
+
+            if (Settings.Default.RecentOpenFiles == null)
+                Settings.Default.RecentOpenFiles = new RecentOpenFiles();
+
+            try
+            {
+                DirectoryInfo info = new DirectoryInfo(CurrentPath);
+                if (File.Exists(CurrentPath))
+                    File.Delete(CurrentPath);
+                if (!info.Exists)
+                {
+                    info.Create();
+                }
+            }
+            catch (Exception ex)
+            {
+
+            }
+        }
+
+        /// <summary>
+        /// 创建启动窗口
+        /// </summary>
+        /// <returns></returns>
+        protected override Window CreateShell()
+        {
+ 
+            return Container.Resolve<MainWindow>();
+        }
+
+
+        protected override void RegisterTypes(IContainerRegistry containerRegistry)
+        {
+            //注册内容组件
+            containerRegistry.RegisterForNavigation<HomeContent>();
+            containerRegistry.RegisterForNavigation<ViewContent>();
+            containerRegistry.RegisterForNavigation<MainContent>();
+            containerRegistry.RegisterForNavigation<HomeCloudContent>("Cloud");
+            containerRegistry.RegisterForNavigation<HomeToolsContent>("Tools");
+            containerRegistry.RegisterForNavigation<HomeGuidContent>("Guid");
+            containerRegistry.RegisterForNavigation<BOTAContent>();
+            containerRegistry.RegisterForNavigation<PageEditContent>();
+            containerRegistry.RegisterForNavigation<ToolsBarContent>();
             containerRegistry.RegisterForNavigation<HomePagePrinterModSizeContent>();
             containerRegistry.RegisterForNavigation<HomePagePrinterModPosterContent>();
             containerRegistry.RegisterForNavigation<HomePagePrinterModMutipleContent>();
             containerRegistry.RegisterForNavigation<HomePagePrinterModBookletContent>();
-            //注册弹窗
-            containerRegistry.RegisterDialog<VerifyPassWordDialog>(DialogNames.VerifyPassWordDialog);
-            containerRegistry.RegisterDialog<FullScreenWindow>(DialogNames.FullScreenDialog);
-            containerRegistry.RegisterDialog<CompressDialog>(DialogNames.CompressDialog);
-            containerRegistry.RegisterDialog<SetPasswordDialog>(DialogNames.SetPasswordDialog);
-            containerRegistry.RegisterDialog<CheckPasswordDialog>(DialogNames.CheckPasswordDialog);
-            containerRegistry.RegisterDialog<DeleteSafetySettingsDialog>(DialogNames.DeleteSafetySettingsDialog);
-            containerRegistry.RegisterDialog<CompressProgressBarDialog, PDF_Office.ViewModels.Dialog.ToolsDialogs.CompressDialogs.CompresProgressBarDialogViewModel>(DialogNames.CompressProgressBarDialog);
-            containerRegistry.RegisterDialog<InsertDialog>(DialogNames.InsertDialog);
-            containerRegistry.RegisterDialog<SplitDialog>(DialogNames.SplitDialog);
-            containerRegistry.RegisterDialog<ExtractDialog>(DialogNames.ExtractDialog);
+
+            //注册弹窗
+            containerRegistry.RegisterDialog<VerifyPassWordDialog>(DialogNames.VerifyPassWordDialog);
+            containerRegistry.RegisterDialog<FullScreenWindow>(DialogNames.FullScreenDialog);
+            containerRegistry.RegisterDialog<CompressDialog>(DialogNames.CompressDialog);
+            containerRegistry.RegisterDialog<SetPasswordDialog>(DialogNames.SetPasswordDialog);
+            containerRegistry.RegisterDialog<CheckPasswordDialog>(DialogNames.CheckPasswordDialog);
+            containerRegistry.RegisterDialog<DeleteSafetySettingsDialog>(DialogNames.DeleteSafetySettingsDialog);
+            containerRegistry.RegisterDialog<CompressProgressBarDialog, PDF_Office.ViewModels.Dialog.ToolsDialogs.CompressDialogs.CompresProgressBarDialogViewModel>(DialogNames.CompressProgressBarDialog);
+            containerRegistry.RegisterDialog<InsertDialog>(DialogNames.InsertDialog);
+            containerRegistry.RegisterDialog<SplitDialog>(DialogNames.SplitDialog);
+            containerRegistry.RegisterDialog<ExtractDialog>(DialogNames.ExtractDialog);
             containerRegistry.RegisterDialog<HomePageExtractDialog>(DialogNames.HomePageExtractDialog);
             containerRegistry.RegisterDialog<HomePageInsertDialog>(DialogNames.HomePageInsertDialog);
             containerRegistry.RegisterDialog<HomePageSplitDialog>(DialogNames.HomePageSplitDialog);
             containerRegistry.RegisterDialog<HomePagePrinterDialog>(DialogNames.HomePagePrinterDialog);
             containerRegistry.RegisterDialog<HomePagePrinterPageSetDialog>(DialogNames.HomePagePrinterPageSetDialog);
-
-        }
-
-        protected override void ConfigureRegionAdapterMappings(RegionAdapterMappings regionAdapterMappings)
-        {
-            var region = new SingleActiveRegion() { Name = RegionNames.MainRegion };
-
-            region.Behaviors.Add(DragablzWindowBehavior.BehaviorKey, new DragablzWindowBehavior());
-
-            Container.Resolve<IRegionManager>().Regions.Add(region);
-
-            base.ConfigureRegionAdapterMappings(regionAdapterMappings);
-        }
-
-        private static bool LicenseVerify()
-        {
-            bool result = false;
-            try
-            {
-                result = CPDFSDKVerifier.LoadNativeLibrary();
-                if (!result)
-                    return false;
-            }
-            catch{ }
-            string devKey = "";
-            string devSecret = "";
-#if DEBUG
-            devKey = "sTHSivIW4YnZQavIYDLVw4vaFcN5DQTUtRGrVyv5p9aeaHX3GirG/MBxl6Wy9TJbNOwR4CU6LPjHmGe3Po3OtBCPqIRheam9+LomScw3AvoUTHFlG1134e2J4enF43WJQ6PyOnjwZqsG1kUdlBPNztkoPzDAE2pQKgZWf6V2i34=";
-            devSecret = "mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4gQurxTxGuBlGAhs0P1mD3X3bHT+AHfcLiymaqE4DY7kTFHoPs9I3tl5ErS+BHdzHRhrp9sGpqfp0B228KI+IMTu4aGVjtYuk+Uxs/kosIBw1367/WkJ00tM7U7tttD6cfaiHpW8pgW2aur3AxuQIBBLuJD5gcmNxTYW3KA32JLG8alfyXjKFVS3gka9bngvwfZ7GuNXybjKlmz1tnN6iVHpnbSj+xOHhWEperY4HHrSg==";
-#endif
-
-            string userKey = "iBPRM/Tz8b6Z1G2GQt52X7hiNCGfVYXztnPjalgrgARvqfKV6lFNH8QeScTzBRYI8GGFpwelfgh790Kd9JmL7V4adI1jCiFHUT2DLT7QucxY5Nkgys2aJItQS482Ck2G2Xf8gNgojxYxRt65o/MEzkj93foj8qIdfHagXsSorSs=";
-            string userSecret = "mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4ivEHOmPIqbfhpDnKKj+7Ymj2rXQvfZRmke06HMV+3tt064G64WjPW8+EbGCNZaAh1hrp9sGpqfp0B228KI+IMTu4aGVjtYuk+Uxs/kosIBw1FKJi6HYB+DuugQyaqI2prfej861QnJrU4s2T/npZK/";
-
-            try
-            {
-                CPDFSDKVerifier.LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify(devKey, devSecret, userKey, userSecret);
-                if (verifyResult != CPDFSDKVerifier.LicenseErrorCode.LICENSE_ERR_SUCCESS)
-                    return false;
-            }
-            catch{ }
-
-
-
-            string ConverterDevKey = "mDDCTNY5rV2+FUj2JESUBruJ0643Tv7rNuxACu6g3L/0guIw1r8zZB+o3aw3rs4rrOThmxBXpEDcItvyGx096mF/3Ixg7aD6QZk5HvBEScIPerdM3KnhgwMwCjE0DYOSMCRwAhbA2xjXfXgT5VVo7JZroKOGQB5Qmf2kLl5nQuU=";
-            string ConverterDevSecret = "mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4g3S5AixMY+3TX1FpQaugG9sTsnCq4QxIEDzyAI3s3dWjNe3wDsMrmFq51HtjPa2tSFAoV6NtcUJC8skonXVk7kMv7C2jvq4o0q6sQtN3jR42k0n/LkN5UfbQ5Lfel4OfZrk7dh2/DUR87Ps4vBX1hrYkwcNWVMyYvggPV2rTFvfawopGIC034QzjthmhwwX90=";
-            string ConverterUserkey = "WLUHzXhndQKyrTJVzvZ+dvPXDQDZeJpcSvklX3GJwRX4+urd8eQskYgbeCf0NXLZ/qJkS/k10x+qGad34i4v5rI/ASFIx901c/Nw5C0YJMH7X87dib141tdAmSmQhnKLO5TBi4FiAidboyvnLFLrYGMmS2kLQOXFPwPj5zQUv5A=";
-            string ConverterUserSecret = "mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4iK16EcneqBPRe2eKQLuJXpA79IONX9GVI/Ap3uWzMcNWaitc2UB6gDeexJXFPVaXOFAoV6NtcUJC8skonXVk7k/oKTJGcYKLPGdXenrzHolQ==";
-
-            try
-            {
-                /*LicenseError licenseerror = CPDFConverter.SDKLicenseVerify(ConverterDevKey, ConverterDevSecret, ConverterUserkey, ConverterUserSecret);
-            string resPath = Path.GetDirectoryName(typeof(MainWindow).Assembly.Location) + "\\";
-            if (licenseerror != LicenseError.ERR_SUCCESS)
-            {
-                return false;
-            }
-                CPDFConverter.Init(resPath);*/
-                string resPath = Path.GetDirectoryName(typeof(MainWindow).Assembly.Location) + "\\";
-                LicenseError licenseerror = CPDFConverter.LicenseVerify(ConverterDevKey, ConverterDevSecret, ConverterUserkey, ConverterUserSecret);
-                if (licenseerror != LicenseError.ERR_SUCCESS)
-                {
-                    //MessageBox.Show("ComPDFKit Conversion SDK Load Failed!");
-                    return false;
-                }
-                CPDFConverter.Init(resPath);
-            }
-            catch{ }
-            return result;
-        }
-
-        protected override void OnExit(ExitEventArgs e)
-        {
-            Environment.Exit(1);
-            base.OnExit(e);
-        }
-    }
-}
+            containerRegistry.RegisterDialog<HomePagePictureToPDFDialog>(DialogNames.HomePagePictureToPDFDialog);
+
+
+        }
+
+        protected override void ConfigureRegionAdapterMappings(RegionAdapterMappings regionAdapterMappings)
+        {
+            var region = new SingleActiveRegion() { Name = RegionNames.MainRegion };
+
+            region.Behaviors.Add(DragablzWindowBehavior.BehaviorKey, new DragablzWindowBehavior());
+
+            Container.Resolve<IRegionManager>().Regions.Add(region);
+
+            base.ConfigureRegionAdapterMappings(regionAdapterMappings);
+        }
+
+        private static bool LicenseVerify()
+        {
+            bool result = false;
+            try
+            {
+                result = CPDFSDKVerifier.LoadNativeLibrary();
+                if (!result)
+                    return false;
+            }
+            catch{ }
+            string devKey = "";
+            string devSecret = "";
+#if DEBUG
+            devKey = "sTHSivIW4YnZQavIYDLVw4vaFcN5DQTUtRGrVyv5p9aeaHX3GirG/MBxl6Wy9TJbNOwR4CU6LPjHmGe3Po3OtBCPqIRheam9+LomScw3AvoUTHFlG1134e2J4enF43WJQ6PyOnjwZqsG1kUdlBPNztkoPzDAE2pQKgZWf6V2i34=";
+            devSecret = "mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4gQurxTxGuBlGAhs0P1mD3X3bHT+AHfcLiymaqE4DY7kTFHoPs9I3tl5ErS+BHdzHRhrp9sGpqfp0B228KI+IMTu4aGVjtYuk+Uxs/kosIBw1367/WkJ00tM7U7tttD6cfaiHpW8pgW2aur3AxuQIBBLuJD5gcmNxTYW3KA32JLG8alfyXjKFVS3gka9bngvwfZ7GuNXybjKlmz1tnN6iVHpnbSj+xOHhWEperY4HHrSg==";
+#endif
+
+            string userKey = "iBPRM/Tz8b6Z1G2GQt52X7hiNCGfVYXztnPjalgrgARvqfKV6lFNH8QeScTzBRYI8GGFpwelfgh790Kd9JmL7V4adI1jCiFHUT2DLT7QucxY5Nkgys2aJItQS482Ck2G2Xf8gNgojxYxRt65o/MEzkj93foj8qIdfHagXsSorSs=";
+            string userSecret = "mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4ivEHOmPIqbfhpDnKKj+7Ymj2rXQvfZRmke06HMV+3tt064G64WjPW8+EbGCNZaAh1hrp9sGpqfp0B228KI+IMTu4aGVjtYuk+Uxs/kosIBw1FKJi6HYB+DuugQyaqI2prfej861QnJrU4s2T/npZK/";
+
+            try
+            {
+                CPDFSDKVerifier.LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify(devKey, devSecret, userKey, userSecret);
+                if (verifyResult != CPDFSDKVerifier.LicenseErrorCode.LICENSE_ERR_SUCCESS)
+                    return false;
+            }
+            catch{ }
+
+
+
+            string ConverterDevKey = "mDDCTNY5rV2+FUj2JESUBruJ0643Tv7rNuxACu6g3L/0guIw1r8zZB+o3aw3rs4rrOThmxBXpEDcItvyGx096mF/3Ixg7aD6QZk5HvBEScIPerdM3KnhgwMwCjE0DYOSMCRwAhbA2xjXfXgT5VVo7JZroKOGQB5Qmf2kLl5nQuU=";
+            string ConverterDevSecret = "mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4g3S5AixMY+3TX1FpQaugG9sTsnCq4QxIEDzyAI3s3dWjNe3wDsMrmFq51HtjPa2tSFAoV6NtcUJC8skonXVk7kMv7C2jvq4o0q6sQtN3jR42k0n/LkN5UfbQ5Lfel4OfZrk7dh2/DUR87Ps4vBX1hrYkwcNWVMyYvggPV2rTFvfawopGIC034QzjthmhwwX90=";
+            string ConverterUserkey = "WLUHzXhndQKyrTJVzvZ+dvPXDQDZeJpcSvklX3GJwRX4+urd8eQskYgbeCf0NXLZ/qJkS/k10x+qGad34i4v5rI/ASFIx901c/Nw5C0YJMH7X87dib141tdAmSmQhnKLO5TBi4FiAidboyvnLFLrYGMmS2kLQOXFPwPj5zQUv5A=";
+            string ConverterUserSecret = "mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4iK16EcneqBPRe2eKQLuJXpA79IONX9GVI/Ap3uWzMcNWaitc2UB6gDeexJXFPVaXOFAoV6NtcUJC8skonXVk7k/oKTJGcYKLPGdXenrzHolQ==";
+
+            try
+            {
+                /*LicenseError licenseerror = CPDFConverter.SDKLicenseVerify(ConverterDevKey, ConverterDevSecret, ConverterUserkey, ConverterUserSecret);
+            string resPath = Path.GetDirectoryName(typeof(MainWindow).Assembly.Location) + "\\";
+            if (licenseerror != LicenseError.ERR_SUCCESS)
+            {
+                return false;
+            }
+                CPDFConverter.Init(resPath);*/
+                string resPath = Path.GetDirectoryName(typeof(MainWindow).Assembly.Location) + "\\";
+                LicenseError licenseerror = CPDFConverter.LicenseVerify(ConverterDevKey, ConverterDevSecret, ConverterUserkey, ConverterUserSecret);
+                if (licenseerror != LicenseError.ERR_SUCCESS)
+                {
+                    //MessageBox.Show("ComPDFKit Conversion SDK Load Failed!");
+                    return false;
+                }
+                CPDFConverter.Init(resPath);
+            }
+            catch{ }
+            return result;
+        }
+
+        protected override void OnExit(ExitEventArgs e)
+        {
+            Environment.Exit(1);
+            base.OnExit(e);
+        }
+    }
+}

+ 1 - 1
PDF Office/CustomControl/PageTurningPreview.xaml

@@ -13,7 +13,7 @@
             </Viewbox>
         </Border>
         <StackPanel Orientation="Horizontal"  Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Bottom">
-            <Button Name="PrePage" Width="20" Click="PrePage_Click" Height="20" HorizontalAlignment="Left" FontSize="16" Background="WhiteSmoke" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
+            <Button IsEnabled="False" Name="PrePage" Width="20" Click="PrePage_Click" Height="20" HorizontalAlignment="Left" FontSize="16" Background="WhiteSmoke" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
                 <TextBlock Text="&lt;" VerticalAlignment="Center" ></TextBlock>
             </Button>
             <TextBox x:Name="CurrentPage" Width="30" Height="25" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="10,0,5,0" Text="1" InputMethod.IsInputMethodEnabled="False"   PreviewTextInput="CountTextBox_PreviewTextInput" KeyDown="CurrentPage_KeyDown"></TextBox>

+ 28 - 2
PDF Office/CustomControl/PageTurningPreview.xaml.cs

@@ -49,7 +49,11 @@ namespace PDF_Office.CustomControl
 
         private void PrePage_Click(object sender, RoutedEventArgs e)
         {
-            if (int.Parse(this.CurrentPage.Text) > 1)
+            if (this.CurrentPage.Text == "" || !int.TryParse(this.CurrentPage.Text, out int _))
+            {
+                this.CurrentPage.Text = "1";
+            }
+            if (int.Parse(this.CurrentPage.Text) > 1 && int.Parse(this.CurrentPage.Text) <= document.PageCount)
             {
                 int Page = int.Parse(this.CurrentPage.Text);
                 this.CurrentPage.Text = (--Page).ToString();
@@ -58,10 +62,23 @@ namespace PDF_Office.CustomControl
                     AwaitRenderBitmap(document);
                 }
             }
+            else if (int.Parse(this.CurrentPage.Text) <= 1) { this.CurrentPage.Text = "1"; }
+            else { this.CurrentPage.Text = document.PageCount.ToString(); }
+            NextPage.IsEnabled = true;
+            if (this.CurrentPage.Text == "1")
+            {
+                PrePage.IsEnabled = false;
+            }
+
         }
 
         private void NextPage_Click(object sender, RoutedEventArgs e)
         {
+
+            if (this.CurrentPage.Text == ""|| !int.TryParse(this.CurrentPage.Text,out int _))
+            {
+                this.CurrentPage.Text = "1";
+            }
             if (int.Parse(this.CurrentPage.Text) < document.PageCount)
             {
                 int Page = int.Parse(this.CurrentPage.Text);
@@ -71,10 +88,19 @@ namespace PDF_Office.CustomControl
                     AwaitRenderBitmap(document);
                 }
             }
+            PrePage.IsEnabled= true;
+            if (this.CurrentPage.Text == document.PageCount.ToString())
+            {
+                 NextPage.IsEnabled = false;
+            }
         }
 
-        private async void CurrentPage_KeyDown(object sender, KeyEventArgs e)
+        private void CurrentPage_KeyDown(object sender, KeyEventArgs e)
         {
+            if (this.CurrentPage.Text == ""|| !int.TryParse(this.CurrentPage.Text, out int _))
+            {
+                this.CurrentPage.Text = "1";
+            }
             if (e.Key == Key.Enter)
             {
                 if (this.CurrentPage.Text == "" || int.Parse(this.CurrentPage.Text) < 1)

+ 29 - 0
PDF Office/DataConvert/UnVisivleConvert.cs

@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+using System.Windows;
+
+namespace PDF_Office.DataConvert
+{
+    public class UnVisivleConvert : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if ((Visibility)value == Visibility.Visible)
+            {
+                return Visibility.Collapsed;
+            }
+            else
+                return Visibility.Visible;
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

+ 134 - 0
PDF Office/Helper/PictureConverter.cs

@@ -0,0 +1,134 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Helper
+{
+    public class PictureConverter
+    {
+        /// <summary>
+        /// 图片转PNG(其他图片先转为PNG在转JPG)
+        /// picturefile 图片文件名
+        /// filePath 保存路径例如//filePath.png
+        /// </summary>
+        public static bool  SavePng(string picturefile, string filePath)
+        {
+            Image img = Image.FromFile(picturefile);
+            try
+            {
+                using (var bmp = new Bitmap(img.Width, img.Height))
+                {
+                    bmp.SetResolution(img.HorizontalResolution, img.VerticalResolution);
+
+                    using (var g = Graphics.FromImage(bmp))
+                    {
+                        g.Clear(Color.White);
+                        g.DrawImageUnscaled(img, 0, 0);
+                    }
+                    bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
+                }
+                return true;
+            }
+            catch
+            {
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// 图片转PNG(其他图片先转为PNG在转JPG)
+        /// picturefile 图片image
+        /// filePath 保存路径例如//filePath.png
+        /// </summary>
+        public static bool SavePng(Image img, string filePath)
+        {
+            try
+            {
+                using (var bmp = new Bitmap(img.Width, img.Height))
+                {
+                    bmp.SetResolution(img.HorizontalResolution, img.VerticalResolution);
+
+                    using (var g = Graphics.FromImage(bmp))
+                    {
+                        g.Clear(Color.White);
+                        g.DrawImageUnscaled(img, 0, 0);
+                    }
+                    bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
+                }
+                return true;
+            }
+            catch
+            {
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// 图片转JPeG
+        /// picturefile 图片文件名
+        /// filePath 保存路径例如//filePath.jpg
+        /// </summary>
+        public static bool SaveJpeg(string picturefile, string filePath)
+        {
+            Image img = Image.FromFile(picturefile);
+            try
+            {
+                using (var bmp = new Bitmap(img.Width, img.Height))
+                {
+                    bmp.SetResolution(img.HorizontalResolution, img.VerticalResolution);
+
+                    using (var g = Graphics.FromImage(bmp))
+                    {
+                        g.Clear(Color.White);
+                        g.DrawImageUnscaled(img, 0, 0);
+                    }
+                    //存储各种格式
+                    //bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Gif);
+                    //bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
+                    bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Jpeg);
+                }
+                return true;
+            }
+            catch
+            {
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// 图片转JPeG
+        /// img 图片Image
+        /// filePath 保存路径例如//filePath.jpg
+        /// </summary>
+        public static bool SaveJpeg(Image img, string filePath)
+        {
+            
+            try
+            {
+                using (var bmp = new Bitmap(img.Width, img.Height))
+                {
+                    bmp.SetResolution(img.HorizontalResolution, img.VerticalResolution);
+
+                    using (var g = Graphics.FromImage(bmp))
+                    {
+                        g.Clear(Color.White);
+                        g.DrawImageUnscaled(img, 0, 0);
+                    }
+                    //存储各种格式
+                    //bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Gif);
+                    //bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
+                    bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Jpeg);
+                }
+                return true;
+            }
+            catch
+            {
+                return false;
+            }
+        }
+
+    }
+}

+ 58 - 0
PDF Office/Model/Dialog/HomePageToolsDialogs/HomePagePictureToPDFDialogModel.cs

@@ -0,0 +1,58 @@
+using ComPDFKit.PDFDocument;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.Dialog.HomePageToolsDialogs
+{
+    public class HomePagePictureToPDFDialogModel
+    {
+
+        /// <summary>
+        /// 拆分模式
+        /// </summary>
+        public ToPDFFileMode Mode = ToPDFFileMode.NewFiles;
+
+        /// <summary>
+        /// 文件名标签
+        /// </summary>
+        public string RearFileNameLabel = "down";
+
+        /// <summary>
+        /// 文件名标签
+        /// </summary>
+        public string FrontFileNameLabel = "part";
+
+        /// <summary>
+        /// 当前文件路径
+        /// </summary>
+        public string FilePath = "";
+
+        /// <summary>
+        /// 文件密码
+        /// </summary>
+        public string Password = "";
+
+        /// <summary>
+        /// 保存逻辑
+        /// </summary>
+        public enum ToPDFFileMode
+        {
+            /// <summary>
+            /// 单独为一个文档
+            /// </summary>
+            NewFiles,
+            /// <summary>
+            /// 保存为一个文档
+            /// </summary>
+            OneNewFile,
+            /// <summary>
+            /// 当前文档
+            /// </summary>
+            SelectFileName
+
+        }
+    }
+}

+ 5 - 0
PDF Office/Model/DialogNames.cs

@@ -85,5 +85,10 @@ namespace PDF_Office.Model
         /// </summary>
         public static string HomePagePrinterPageSetDialog = "HomePagePrinterPageSetDialog";
 
+        ///<summary>
+        ///主页工具-图片转PDF弹窗
+        /// </summary>
+        public static string HomePagePictureToPDFDialog = "HomePagePictureToPDFDialog";
+
     }
 }

+ 11 - 0
PDF Office/PDF Office.csproj

@@ -171,10 +171,12 @@
       <DependentUpon>WritableComboBox.xaml</DependentUpon>
     </Compile>
     <Compile Include="DataConvert\FileFormatToIconConvert.cs" />
+    <Compile Include="DataConvert\UnVisivleConvert.cs" />
     <Compile Include="EventAggregators\PageEditNotifyEvent.cs" />
     <Compile Include="EventAggregators\PageEditRefreshEvent.cs" />
     <Compile Include="Helper\HomePageEditHelper.cs" />
     <Compile Include="Helper\PasswordBoxHelper.cs" />
+    <Compile Include="Helper\PictureConverter.cs" />
     <Compile Include="Helper\SettingHelper.cs" />
     <Compile Include="Helper\ToolMethod.cs" />
     <Compile Include="Model\DialogNames.cs" />
@@ -182,6 +184,7 @@
     <Compile Include="CustomControl\LoadingControl.xaml.cs">
       <DependentUpon>LoadingControl.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Model\Dialog\HomePageToolsDialogs\HomePagePictureToPDFDialogModel.cs" />
     <Compile Include="Model\Dialog\ToolsDialogs\CompressDialogModel\CompressDialogModel.cs" />
     <Compile Include="Model\Dialog\ToolsDialogs\SaftyDialogs\CheckPasswordDialogModel.cs" />
     <Compile Include="Model\Dialog\ToolsDialogs\SaftyDialogs\DeleteSafetySettintgsModel.cs" />
@@ -222,6 +225,7 @@
     <Compile Include="ViewModels\Dialog\ToolsDialogs\SaftyDialogs\CheckPasswordDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\ToolsDialogs\SaftyDialogs\SetPasswordDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\VerifyPassWordDialogViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePagePictureToPDFDialogViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\HomeCloudContentViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\HomeGuidContentViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\HomeToolsContentViewModel.cs" />
@@ -245,6 +249,9 @@
     <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePageInsertDialog.xaml.cs">
       <DependentUpon>HomePageInsertDialog.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePagePictureToPDFDialog.xaml.cs">
+      <DependentUpon>HomePagePictureToPDFDialog.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterModBookletContent.xaml.cs">
       <DependentUpon>HomePagePrinterModBookletContent.xaml</DependentUpon>
     </Compile>
@@ -426,6 +433,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Views\Dialog\HomePageToolsDialogs\HomePagePictureToPDFDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Views\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterModBookletContent.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>

+ 4 - 38
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageExtractDialogViewModel.cs

@@ -29,45 +29,13 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
 
 
 
-        private string extractToSingleFileIsCheck = "False";
-        public string ExtractToSingleFileIsCheck
-        {
-            get { return extractToSingleFileIsCheck; }
-            set
-            {
-                extractToSingleFileIsCheck = value;
-            }
-        }
+        public string ExtractToSingleFileIsCheck {get;set;} = "False";
 
-        private string deleteAfterExtractIsCheck = "Fales";
-        public string DeleteAfterExtractIsCheck
-        {
-            get { return deleteAfterExtractIsCheck; }
-            set
-            {
-                deleteAfterExtractIsCheck = value;
-            }
-        }
+        public string DeleteAfterExtractIsCheck { get; set; } = "Fales";
 
-        private string pageRangeText = "";
-        public string PageRangeText
-        {
-            get { return pageRangeText; }
-            set
-            {
-                pageRangeText = value;
-            }
-        }
+        public string PageRangeText { get; set; } = "";
 
-        private string pageRangeSelectIndex = "";
-        public string PageRangeSelectIndex
-        {
-            get { return pageRangeSelectIndex; }
-            set
-            {
-                pageRangeSelectIndex = value;
-            }
-        }
+        public string PageRangeSelectIndex { get; set; } = "";
         #endregion
 
         #region 委托声明
@@ -194,8 +162,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
                 currentViewer = viewer;
                 savefilepath = filepath.Replace(currentViewer.Document.FileName + ".pdf", "");
                 document = currentViewer.Document;
-
-
             }
         }
         #endregion

+ 2 - 32
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageInsertDialogViewModel.cs

@@ -5,17 +5,10 @@ using Prism.Commands;
 using Prism.Mvvm;
 using Prism.Services.Dialogs;
 using System;
-using System.Collections.Generic;
-using System.Linq;
 using PDF_Office.Model.HomePageToolsDialogs;
 using System.Diagnostics;
-using System.Globalization;
-using System.Windows;
-using static PDF_Office.Model.Dialog.ToolsDialogs.SaftyDialogs.SetPasswordDialogModel;
-using System.Windows.Forms;
 using DialogResult = Prism.Services.Dialogs.DialogResult;
 using PDF_Office.CustomControl;
-using PDF_Office.Model.Dialog.HomePageToolsDialogs;
 
 namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
 {
@@ -26,8 +19,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
 
         private CPDFViewer currentViewer;
 
-        private string saveFilePath { get; set; }
-
         private HomePageInsertDialogModel insertModel = new HomePageInsertDialogModel();
 
         private string selectFilePath = "选择文件";
@@ -40,15 +31,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
             }
         }
 
-        private string pageLocation = "0";
-        public string PageLocation
-        {
-            get { return pageLocation; }
-            set
-            {
-                pageLocation = value;
-            }
-        }
+        public string PageLocation { get; set; } = "0";
 
         private string pageNumber = "1";
         public string PageNumber
@@ -60,19 +43,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
             }
         }
 
-        private string pageInsertIndex = "1";
-        public string PageInsertIndex
-        {
-            get
-            {
-                return pageInsertIndex;
-            }
-            set
-            {
-
-                pageInsertIndex = value;
-            }
-        }
+        public string PageInsertIndex { get; set; } = "1";
 
         private string firstIsCheck = "True";
         public string FirstIsCheck
@@ -238,7 +209,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
             if (viewer != null && viewer.Document != null)
             {
                 currentViewer = viewer;
-                saveFilePath = filepath;
                 document = currentViewer.Document;
                 PageNumber = currentViewer.Document.PageCount.ToString();
             }

+ 425 - 0
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePictureToPDFDialogViewModel.cs

@@ -0,0 +1,425 @@
+using PDF_Office.Model;
+using Prism.Commands;
+using System.Data;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using System.IO;
+using System.Diagnostics;
+using PDF_Office.CustomControl;
+using System.Windows;
+using PDF_Office.Helper;
+using PDF_Office.Model.Dialog.HomePageToolsDialogs;
+using ComPDFKit.PDFDocument;
+using System.Drawing;
+using DialogResult = Prism.Services.Dialogs.DialogResult;
+
+namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
+{
+    public class HomePagePictureToPDFDialogViewModel : BindableBase, IDialogAware
+    {
+        #region 参数和属性
+        private List<string> fileNames;
+        
+        public List<int> fileNamesView = new List<int>();
+        public HomePagePictureToPDFDialogModel pictureToPDFModel=new HomePagePictureToPDFDialogModel();
+        private DataTable imagesDataTable = new DataTable();
+        public DataTable ImagesDataTable
+        {
+            get { return imagesDataTable; }
+            set
+            {
+                SetProperty(ref imagesDataTable, value);
+            }
+        }
+        private string removeIsEnable = "False";
+        public string RemoveIsEnable
+        {
+            get { return removeIsEnable; }
+            set
+            {
+                SetProperty(ref removeIsEnable, value);
+            }
+        }
+
+        private string selectFileName = "False";
+        public string SelectFileName
+        {
+            get { return selectFileName; }
+            set
+            {
+                SetProperty(ref selectFileName, value);
+            }
+        }
+
+        private Visibility addFileVisibility = Visibility.Hidden;
+        public Visibility AddFileVisibility
+        {
+            get { return addFileVisibility; }
+            set
+            {
+                SetProperty(ref addFileVisibility, value);
+                RaisePropertyChanged();
+
+            }
+        }
+
+        #endregion
+        #region 委托声明
+
+        public DelegateCommand ToPDFCommand { get; set; }
+
+        public DelegateCommand ADDPictureCommand { get; set; }
+
+        public DelegateCommand ADDPictureFilesCommand { get; set; }
+
+        public DelegateCommand RemovePictureFileCommand { get; set; }
+
+        public DelegateCommand SelectFileCommand { get; set; }
+
+        #endregion
+        public HomePagePictureToPDFDialogViewModel()
+        {
+            ToPDFCommand = new DelegateCommand(topdf);
+            ADDPictureCommand = new DelegateCommand(addpicture);
+            ADDPictureFilesCommand = new DelegateCommand(addpicturefiles);
+            RemovePictureFileCommand = new DelegateCommand(removepicturefile);
+            SelectFileCommand = new DelegateCommand(selectFile);
+
+        }
+        #region 逻辑函数
+        private void topdf() {
+            updateListview("正在转换");
+            DataTable imagesdatayable = new DataTable();
+            imagesdatayable.Columns.Add("FileName");
+            imagesdatayable.Columns.Add("FileSize");
+            imagesdatayable.Columns.Add("FileState");
+            if (pictureToPDFModel.Mode == HomePagePictureToPDFDialogModel.ToPDFFileMode.NewFiles)
+            {
+                foreach (var filename in fileNames)
+                {
+                    Image img = Image.FromFile(filename);
+                    CPDFDocument topdfdoc = CPDFDocument.CreateDocument();
+                    FileInfo fileinfo = new FileInfo(filename);
+                    JpegInsertPage(ref topdfdoc, filename, fileinfo,img.Width,img.Height);
+                    Trace.WriteLine("Path.GetTempPath():" + Path.GetTempPath());
+                    topdfdoc.WriteToFilePath(savefilename(filename));
+                    topdfdoc.Release();
+                    string file_size = (((float)fileinfo.Length) / 1024).ToString() + " K";
+                    imagesdatayable.Rows.Add(fileinfo.Name, file_size, "确认");
+                    ImagesDataTable = imagesdatayable;
+                }
+                System.Diagnostics.Process.Start("Explorer", "/select," + savefilename(fileNames[0]));
+            }
+            if (pictureToPDFModel.Mode == HomePagePictureToPDFDialogModel.ToPDFFileMode.OneNewFile)
+            {
+                CPDFDocument topdfdoc = CPDFDocument.CreateDocument();
+                int pageindex = 0;
+                foreach (var filename in fileNames) {
+                    Image img = Image.FromFile(filename);
+                    FileInfo fileinfo = new FileInfo(filename);
+                    JpegInsertPage(ref topdfdoc, filename, fileinfo,img.Width, img.Height);
+                    pageindex++;
+                    string file_size = (((float)fileinfo.Length) / 1024).ToString() + " K";
+                    imagesdatayable.Rows.Add(fileinfo.Name, file_size, "确认");
+                    ImagesDataTable = imagesdatayable;
+                }
+                System.Diagnostics.Process.Start("Explorer", "/select," + savefilename(fileNames[0]));
+                topdfdoc.WriteToFilePath(savefilename(fileNames[0]));
+                topdfdoc.Release();
+            }
+            if (pictureToPDFModel.Mode == HomePagePictureToPDFDialogModel.ToPDFFileMode.SelectFileName)
+            {
+                CPDFDocument topdfdoc =CPDFDocument.InitWithFilePath(pictureToPDFModel.FilePath);
+                if (topdfdoc == null)
+                {
+                    Trace.WriteLine("Document==null");
+                    //TODO
+                    MessageBoxEx.Show("文档为空");
+                    return;
+                }
+                if (topdfdoc.IsEncrypted)
+                {
+                    Trace.WriteLine("youmima");
+                    MessageBoxEx.Show("文档加密");
+                    //TODO
+                    return;
+                }
+                int pageindex = topdfdoc.PageCount;
+                foreach (var filename in fileNames)
+                {
+                    Image img = Image.FromFile(filename);
+                    FileInfo fileinfo = new FileInfo(filename);
+                    JpegInsertPage(ref topdfdoc, filename, fileinfo, img.Width, img.Height, pageindex);
+                    pageindex++;
+                    string file_size = (((float)fileinfo.Length) / 1024).ToString() + " K";
+                    imagesdatayable.Rows.Add(fileinfo.Name, file_size, "确认");
+                    ImagesDataTable = imagesdatayable;
+                }
+                topdfdoc.WriteToLoadedPath();
+                System.Diagnostics.Process.Start("Explorer", "/select," + topdfdoc.FilePath);
+                topdfdoc.Release();
+            }
+            RequestClose.Invoke(new DialogResult(ButtonResult.OK));
+        }
+
+        /// <summary>
+        /// 设置保存后的文件名
+        /// </summary>
+        public string savefilename(string filename)
+        {
+            FileInfo file = new FileInfo(filename);
+            return filename.Replace(file.Name, "") +pictureToPDFModel.FrontFileNameLabel+file.Name+pictureToPDFModel.RearFileNameLabel+".pdf";
+        }
+
+        /// <summary>
+        /// 选择PDF文件
+        /// </summary>
+        private void selectFile()
+        {
+            System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
+            dlg.Multiselect = false;
+            dlg.Filter = "PDF|*.pdf;*.PDF;";
+            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+                SelectFileName=dlg.FileName;
+                pictureToPDFModel.FilePath = dlg.FileName;
+            }
+        }
+
+        /// <summary>
+        /// 添加图片文件
+        /// </summary>
+        private void addpicture()
+        {
+            System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
+            dlg.Multiselect = true;
+            dlg.Filter = "Picture|*.png;*.PNG;*.jpg;*.JPG;*.bmp;*.gif;*tiff;";
+            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+                fileNames.AddRange(dlg.FileNames.ToList());
+                RemoveExcess(ref fileNames);
+                AddFileVisibility = Visibility.Collapsed;
+                updateListview("待确定");
+            }
+        }
+
+        /// <summary>
+        /// 添加图片文件夹
+        /// </summary>
+        private void addpicturefiles()
+        {
+            FolderBrowserDialog dialog = new FolderBrowserDialog();
+            dialog.Description = "请选择文件路径";
+            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+
+                string foldPath = dialog.SelectedPath;
+                var apps = System.IO.Directory.GetFiles(foldPath);
+                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")
+                    {
+                        fileNames.Add(app);
+                    }
+                }
+                RemoveExcess(ref fileNames);
+                updateListview("待确定");
+                AddFileVisibility = Visibility.Collapsed;
+            }
+        }
+
+        /// <summary>
+        /// 删除图片文件
+        /// </summary>
+        public void removepicturefile() {
+            Reverseorder(ref fileNamesView);
+            foreach (int filenamesview in fileNamesView)
+            {
+                //Trace.WriteLine(filenamesview);
+                fileNames.Remove(fileNames[filenamesview]);
+            }
+            if (fileNames.Count < 1)
+            {
+                AddFileVisibility = Visibility.Visible;
+            }
+            updateListview("待确定");
+        }
+
+        /// <summary>
+        /// 打开文件图片
+        /// </summary>
+        public void openfiledialog(){
+
+            foreach (int filenamesview in fileNamesView)
+            {
+                System.Diagnostics.Process.Start(fileNames[filenamesview]);
+            }
+        }
+
+        /// <summary>
+        /// 删除重复的文件
+        /// </summary>
+        public void RemoveExcess(ref List<string> Filenames) {
+            List<string> filenames = new List<string>();
+            foreach (var fileName in Filenames)
+            {
+                if (!filenames.Contains(fileName))
+                {
+                    filenames.Add(fileName);
+                }
+            }
+            Filenames.Clear();
+            Filenames = filenames;
+        }
+
+        /// <summary>
+        /// 逆序int类型集合
+        /// </summary>
+        public void Reverseorder(ref List<int> Numbers)
+        {
+            Numbers=Numbers.OrderBy(a=>a).ToList();
+            Numbers.Reverse();
+        }
+
+        /// <summary>
+        /// 更新listview显示
+        /// state 状态显示字符串
+        /// </summary>
+        public void updateListview( string state) {
+            DataTable imagesdatayable = new DataTable();
+            imagesdatayable.Columns.Add("FileName");
+            imagesdatayable.Columns.Add("FileSize");
+            imagesdatayable.Columns.Add("FileState");
+            foreach (var fileName in fileNames)
+            {
+                string file_all = fileName;
+                FileInfo f = new FileInfo(file_all);
+                string file_size = (((float)f.Length)/1024).ToString()+" K";
+                imagesdatayable.Rows.Add(f.Name, file_size, state);
+            }
+            ImagesDataTable = imagesdatayable;
+
+        }
+
+        /// <summary>
+        /// 图片转PNG
+        /// picturefile 图片文件名
+        /// filePath 保存路径
+        /// </summary>
+        public bool SavePng(string picturefile, string filePath)
+        {
+            Image img = Image.FromFile(picturefile);
+            try
+            {
+                using (var bmp = new Bitmap(img.Width, img.Height))
+                {
+                    bmp.SetResolution(img.HorizontalResolution, img.VerticalResolution);
+
+                    using (var g = Graphics.FromImage(bmp))
+                    {
+                        g.Clear(Color.White);
+                        g.DrawImageUnscaled(img, 0, 0);
+                    }
+                    bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
+                }
+                return true;
+            }
+            catch
+            {
+                return false;
+            }
+        }
+        /// <summary>
+        /// 图片转JPeG
+        /// picturefile 图片文件名
+        /// filePath 保存路径
+        /// </summary>
+        public bool SaveJpeg(string picturefile, string filePath)
+        {
+            Image img = Image.FromFile(picturefile);
+            try
+            {
+                using (var bmp = new Bitmap(img.Width, img.Height))
+                {
+                    bmp.SetResolution(img.HorizontalResolution, img.VerticalResolution);
+
+                    using (var g = Graphics.FromImage(bmp))
+                    {
+                        g.Clear(Color.White);
+                        g.DrawImageUnscaled(img, 0, 0);
+                    }
+                    //存储各种格式
+                    //bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Gif);
+                    //bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
+                    bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Jpeg);
+                }
+                return true;
+            }
+            catch
+            {
+                return false;
+            }
+        }
+        /// <summary>
+        /// 插入JPeG图片
+        /// topdfdoc 所要插入的文档
+        /// filename 图片文件名
+        /// fileinfo 文件信息
+        /// width page宽
+        /// height page高
+        /// index 插入位置
+        /// </summary>
+        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")
+            {
+                topdfdoc.InsertPage(index, width, height, filename);
+            }
+            else 
+            {
+                tempFileName = Path.GetTempPath() + "pngtemp.jpg";
+                if (!PictureConverter.SaveJpeg(filename, tempFileName))
+                { 
+                    MessageBoxEx.Show("图片格式有问题");
+                }
+                topdfdoc.InsertPage(index, width, height, tempFileName);
+            }
+        }
+        #endregion
+
+        #region 构架行为
+        public string Title => "图片转PDF";
+
+        public event Action<IDialogResult> RequestClose;
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            string[] filepath=null;
+            parameters.TryGetValue<string[]>(ParameterNames.FilePath, out filepath);
+            if (filepath!=null)
+            {
+                fileNames=filepath.ToList();
+                ImagesDataTable.Columns.Add("FileName");
+                ImagesDataTable.Columns.Add("FileSize");
+                ImagesDataTable.Columns.Add("FileState");
+                updateListview("待确定");
+            }
+        }
+        #endregion
+    }
+}

+ 28 - 28
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModSizeContentViewModel.cs

@@ -1,29 +1,29 @@
-using Prism.Commands;
-using Prism.Mvvm;
-using Prism.Regions;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
-{
-    public class HomePagePrinterModSizeContentViewModel : BindableBase, INavigationAware
-    {
-        public HomePagePrinterModSizeContentViewModel()
-        {
-        }
-
-        public bool IsNavigationTarget(NavigationContext navigationContext)
-        {
-            return true;
-        }
-
-        public void OnNavigatedFrom(NavigationContext navigationContext)
-        {
-        }
-
-        public void OnNavigatedTo(NavigationContext navigationContext)
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Regions;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
+{
+    public class HomePagePrinterModSizeContentViewModel : BindableBase, INavigationAware
+    {
+        public HomePagePrinterModSizeContentViewModel()
         {
-        }
-    }
-}
+        }
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+        }
+    }
+}

+ 14 - 93
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageSplitDialogViewModel.cs

@@ -6,17 +6,8 @@ using Prism.Mvvm;
 using Prism.Services.Dialogs;
 using System;
 using PDF_Office.Helper;
-using System.Collections.Generic;
 using System.Diagnostics;
-using System.Linq;
-using ImTools;
-using PDF_Office.Model.PageEdit;
-using ComPDFKit.PDFPage;
-using System.Threading.Tasks;
-using System.Windows.Media.Imaging;
-using System.Windows.Media;
 using PDF_Office.CustomControl;
-using PDF_Office.Model.Dialog.HomePageToolsDialogs;
 using PDF_Office.Model.HomePageToolsDialogs;
 
 namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
@@ -35,24 +26,9 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
         private string savefilename { get; set; }
 
         private string pageRangeText = "0";
-        public string PageRangeText
-        {
-            get { return pageRangeText; }
-            set
-            {
-                pageRangeText = value;
-            }
-        }
-
-        private string pageRangeSelectIndex = "0";
-        public string PageRangeSelectIndex
-        {
-            get { return pageRangeSelectIndex; }
-            set
-            {
-                pageRangeSelectIndex = value;
-            }
-        }
+        public string PageRangeText { set; get; } = "0";
+        
+        public string PageRangeSelectIndex { set; get; } = "0";
 
         private string averagePagesIsCheck = "True";
         public string AveragePagesIsCheck
@@ -114,25 +90,10 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
             }
         }
 
-        private string averagePagesText = "";
-        public string AveragePagesText
-        {
-            get { return averagePagesText; }
-            set
-            {
-                averagePagesText = value;
-            }
-        }
+        public string AveragePagesText { set; get; } = "";
 
-        private string averageFilesText = "";
-        public string AverageFilesText
-        {
-            get { return averageFilesText; }
-            set
-            {
-                averageFilesText = value;
-            }
-        }
+        public string AverageFilesText { set; get; } = "";
+        
 
         private string filePathName = "";
         public string FilePathName
@@ -144,55 +105,17 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
             }
         }
 
-        private string fileNameLabelText = "part";
-        public string FileNameLabelText
-        {
-            get { return fileNameLabelText; }
-            set
-            {
-                fileNameLabelText = value;
-            }
-        }
-
-        private string fileNameDeimiterText = "-";
-        public string FileNameDeimiterText
-        {
-            get { return fileNameDeimiterText; }
-            set
-            {
-                fileNameDeimiterText = value;
-            }
-        }
+        public string FileNameLabelText{ set; get; } = "part";
+        
 
-        private string frontFileIsCheck = "True";
-        public string FrontFileIsCheck
-        {
-            get { return frontFileIsCheck; }
-            set
-            {
-                frontFileIsCheck = value;
-            }
-        }
+        public string FileNameDeimiterText{ set; get; } = "-";
+        
 
-        private string fileNameLabelIsCheck = "True";
-        public string FileNameLabelIsCheck
-        {
-            get { return fileNameLabelIsCheck; }
-            set
-            {
-                fileNameLabelIsCheck = value;
-            }
-        }
+        public string FrontFileIsCheck { set; get; } = "True";
+       
+        public string FileNameLabelIsCheck { set; get; } = "True";
 
-        private string fileNameDeimiterIsCheck = "True";
-        public string FileNameDeimiterIsCheck
-        {
-            get { return fileNameDeimiterIsCheck; }
-            set
-            {
-                fileNameDeimiterIsCheck = value;
-            }
-        }
+        public string FileNameDeimiterIsCheck { set; get; } = "True";
 
         private string fileNameLabelIsEnabled = "False";
         public string FileNameLabelIsEnabled
@@ -383,7 +306,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
             AverageFilesIsEnabled = "False";
             AveragePagesIsEnabled = "True";
             splitModel.Mode = HomePageSplitDialogModel.SplitMode.AveragePages;
-
         }
 
         private void averageFiles()
@@ -396,7 +318,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
             AverageFilesIsEnabled = "True";
             AveragePagesIsEnabled = "False";
             splitModel.Mode = HomePageSplitDialogModel.SplitMode.AverageFiles;
-
         }
 
         private void customPageRange()

+ 8 - 8
PDF Office/ViewModels/HomePanel/HomeGuidContentViewModel.cs

@@ -29,14 +29,17 @@ namespace PDF_Office.ViewModels.HomePanel
 
         public void QuickTools_Click(ToolItem toolItem)
         {
-
-
             /*
              *设置这个对话框的起始保存路径
              */
             System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
             dlg.Multiselect = false;
             dlg.Filter = "PDF|*.pdf;*.PDF;";
+            if (toolItem.Tag == PDFToolType.Merge)
+            {
+                dlg.Multiselect = true;
+                dlg.Filter = "Picture|*.png;*.PNG;*.jpg;*.JPG;*bmp;*jpeg;*gif;*tiff;*webp;";
+            }
             if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 CPDFViewer viewer = new CPDFViewer();
@@ -44,7 +47,6 @@ namespace PDF_Office.ViewModels.HomePanel
                 switch (toolItem.Tag)
                 {
                     case PDFToolType.Split:
-                        Split_Click();
                         DialogParameters splitvalue = new DialogParameters();
                         splitvalue.Add(ParameterNames.PDFViewer, viewer);
                         splitvalue.Add(ParameterNames.FilePath, dlg.FileName);
@@ -69,6 +71,9 @@ namespace PDF_Office.ViewModels.HomePanel
                         break;
 
                     case PDFToolType.Merge:
+                        DialogParameters picturetopdf = new DialogParameters();
+                        picturetopdf.Add(ParameterNames.FilePath, dlg.FileNames);
+                        dialogs.ShowDialog(DialogNames.HomePagePictureToPDFDialog, picturetopdf, e => { });
                         break;
 
                     case PDFToolType.Print:
@@ -85,10 +90,5 @@ namespace PDF_Office.ViewModels.HomePanel
             }
         }
 
-        private void Split_Click()
-        {
-
-        }
-
     }
 }

+ 156 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePictureToPDFDialog.xaml

@@ -0,0 +1,156 @@
+<UserControl x:Class="PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePagePictureToPDFDialog"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:prism="http://prismlibrary.com/" 
+             xmlns:homepagetoolsdialogs="clr-namespace:PDF_Office.ViewModels.Dialog.HomePageToolsDialogs" 
+             d:DataContext="{d:DesignInstance Type=homepagetoolsdialogs:HomePagePictureToPDFDialogViewModel}"
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             xmlns:convert="clr-namespace:PDF_Office.DataConvert"
+             d:DesignHeight="554"
+             d:DesignWidth="892"
+             mc:Ignorable="d">
+    <UserControl.Resources>
+        <ResourceDictionary>
+            <convert:UnVisivleConvert x:Key="unVisibleConvert"/>
+        </ResourceDictionary>
+    </UserControl.Resources>
+
+    <Grid>
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition Width="632"/>
+            <ColumnDefinition Width="260"/>
+        </Grid.ColumnDefinitions>
+        <Grid Grid.Column="0">
+            <Grid.RowDefinitions>
+                <RowDefinition Height="482"/>
+                <RowDefinition Height="72"/>
+            </Grid.RowDefinitions>
+            <Button Name="BtnBlank" Grid.Row="0" Background="Green" Height="400" Width="400" Visibility="{Binding AddFileVisibility}" Command="{Binding ADDPictureCommand}">
+            </Button>
+            <ListView x:Name="listView" DataContext="{Binding ImagesDataTable}" Grid.Row="0" Background="White"  ItemsSource="{Binding}" SelectionChanged="listView_SelectionChanged" Visibility="{Binding ElementName=BtnBlank, Path=Visibility, Converter={StaticResource unVisibleConvert}}">
+                <ListView.ContextMenu>
+                    <ContextMenu  StaysOpen="True" >
+                        <MenuItem Header="打开文件" Name="OpenFileMenuItem"  Click="OpenFileMenuItem_Click"/>
+                        <MenuItem Header="移除" Name="RemoveFileMenuItem" Click="RemoveFileMenuItem_Click"/>
+                    </ContextMenu>
+                </ListView.ContextMenu>
+                <ListView.View>
+                    <GridView>
+                        <GridViewColumn  Header="文档名"  Width="400" DisplayMemberBinding="{Binding FileName}"/>
+                        <GridViewColumn Header="大小" Width="100" DisplayMemberBinding="{Binding FileSize}"/>
+                        <GridViewColumn Header="状态" Width="80" >
+                            <GridViewColumn.CellTemplate>
+                                <DataTemplate>
+                                    <TextBlock Text="{Binding FileState}" TextDecorations="Underline" Foreground="Black"/>
+                                </DataTemplate>
+                            </GridViewColumn.CellTemplate>
+                        </GridViewColumn>
+                    </GridView>
+                </ListView.View>
+                <ListView.ItemContainerStyle>
+                    <Style TargetType="ListViewItem">
+                        <Setter Property="Height" Value="42"/>
+                        <Style.Triggers>
+                            <Trigger Property="ListView.AlternationIndex" Value="1">
+                                <Setter Property="Background" Value="LightGray"/>
+                            </Trigger>
+                        </Style.Triggers>
+                    </Style>
+                </ListView.ItemContainerStyle>
+            </ListView>
+            <Grid Grid.Row="1">
+                <Button x:Name="MenuBtn"  Width="113"
+                    Height="40"
+                    Margin="25,0,0,0"
+                    HorizontalAlignment="Left" Click="Menu_Click">
+                    <StackPanel Orientation="Horizontal" >
+                        <Border HorizontalAlignment="Right">
+                            <TextBlock Text="添加文件" FontSize="18" Foreground="Black"></TextBlock>
+                        </Border>
+                        <Border  Margin="12,0,0,0">
+                            <Path  VerticalAlignment="Center" HorizontalAlignment="Right" Stroke="Black"  Data="M0 0L8 4 L16 0" Height="10" Stretch="Fill" />
+                        </Border>
+                    </StackPanel>
+                </Button>
+                <Popup x:Name="menuPop1" StaysOpen="False"  AllowsTransparency="True" PlacementTarget="{Binding ElementName=MenuBtn}">
+                    <Grid Height="auto" Width="auto" HorizontalAlignment="Left">
+                        <Border BorderThickness="0" CornerRadius="3" Background="White" Margin="3">
+                            <Border.Effect>
+                                <DropShadowEffect ShadowDepth="0" Color="#FFB6B6B6"/>
+                            </Border.Effect>
+                            <StackPanel Margin="0">
+                                <MenuItem x:Name="添加文件" Header="添加文件" Command="{Binding ADDPictureCommand}"></MenuItem>
+                                <MenuItem x:Name="添加文件夹" Header="添加文件夹" Command="{Binding ADDPictureFilesCommand}"></MenuItem>
+                            </StackPanel>
+                        </Border>
+                    </Grid>
+                </Popup>
+
+                <Button
+                    Width="40"
+                    Height="40"
+                    Margin="0,0,90,0"
+                    HorizontalAlignment="Right">
+
+                </Button>
+                <Button
+                    Width="40"
+                    Height="40"
+                    Margin="25,0"
+                    HorizontalAlignment="Right"
+                    IsEnabled="{Binding RemoveIsEnable}"
+                    Command="{Binding RemovePictureFileCommand}">
+
+                </Button>
+            </Grid>
+        </Grid>
+        <Grid Grid.Column="1" Background="WhiteSmoke">
+            <Grid.RowDefinitions>
+                <RowDefinition Height="*"/>
+                <RowDefinition Height="2*"/>
+                <RowDefinition Height="72"/>
+            </Grid.RowDefinitions>
+            <Grid Grid.Row="0">
+                <StackPanel Margin="15,23,0,0">
+                    <TextBlock Text="导出"/>
+                    <StackPanel Margin="0,8,0,0">
+                        <RadioButton Name="NewFilesRadioButtom" Click="RadioButton_Click" IsChecked="True">
+                            <TextBlock Text="新建文档"/>
+                        </RadioButton>
+                        <RadioButton Name="OneNewFileNameRadioButtom" Margin="0,8,0,0" Click="RadioButton_Click">
+                            <TextBlock Text="合并为同一份PDF文档"/>
+                        </RadioButton>
+                        <RadioButton Name="SelectFileNameRadioButton" Margin="0,8,0,0" Click="RadioButton_Click">
+                            <TextBlock Text="插入现有PDF文档"/>
+                        </RadioButton>
+                    </StackPanel>
+                    <StackPanel Orientation="Horizontal" Margin="0,4,0,0">
+                        <TextBox IsEnabled="False" Text="{Binding SelectFileName}" VerticalContentAlignment="Center" Height="32" Width="190"/>
+                        <Button Width="32" Command="{Binding SelectFileCommand}" IsEnabled="{Binding ElementName=SelectFileNameRadioButton,Path=IsChecked}">
+
+                        </Button>
+                    </StackPanel>
+                </StackPanel>
+            </Grid>
+            <Grid Grid.Row="1">
+                <StackPanel Margin="15,0,0,0">
+                    <TextBlock Text="OCR"/>
+                    <CheckBox Name="NeedOCRCheckBox" Margin="0,7,0,0">
+                        <TextBlock Text="在需要时识别文本"/>
+                    </CheckBox>
+                    <ComboBox Height="28.55" Width="228" HorizontalAlignment="Left" Margin="0,4,0,0" IsEnabled="{Binding ElementName=NeedOCRCheckBox,Path=IsChecked}"></ComboBox>
+                    <CheckBox  Margin="0,16,0,0" IsEnabled="{Binding ElementName=NeedOCRCheckBox,Path=IsChecked}">
+                        <TextBlock Text="识别为TXT"/>
+                    </CheckBox>
+                </StackPanel>
+            </Grid>
+            <Grid Grid.Row="2">
+                <Button Height="40" Width="228" Background="Black" Command="{Binding ToPDFCommand}">
+                    <TextBlock Text="导出文档" FontSize="18" Foreground="White"/>
+                </Button>
+            </Grid>
+        </Grid>
+    </Grid>
+</UserControl>

+ 90 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePictureToPDFDialog.xaml.cs

@@ -0,0 +1,90 @@
+using DryIoc;
+using ImTools;
+using PDF_Office.Model.Dialog.HomePageToolsDialogs;
+using PDF_Office.ViewModels.Dialog.HomePageToolsDialogs;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Windows.Controls;
+using System.Windows.Input;
+using System.Xml.Linq;
+
+namespace PDF_Office.Views.Dialog.HomePageToolsDialogs
+{
+    /// <summary>
+    /// Interaction logic for HomePagePictureToPDFDialogs
+    /// </summary>
+    public partial class HomePagePictureToPDFDialog : UserControl
+    {
+        public HomePagePictureToPDFDialog()
+        {
+            InitializeComponent();
+        }
+
+        private void Menu_Click(object sender, System.Windows.RoutedEventArgs e)
+        {
+            menuPop1.IsOpen = true;
+        }
+
+        private void listView_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            IList list = listView.SelectedItems;
+            var lists = listView.Items;
+            System.Data.DataRowView a;
+            ((HomePagePictureToPDFDialogViewModel)this.DataContext).fileNamesView.Clear();
+            foreach (var item in list)
+            {
+                a = (System.Data.DataRowView)item;
+                ((HomePagePictureToPDFDialogViewModel)this.DataContext).fileNamesView.Add(lists.IndexOf(a));
+            }
+            if (((HomePagePictureToPDFDialogViewModel)this.DataContext).fileNamesView.Count > 0)
+            {
+                ((HomePagePictureToPDFDialogViewModel)this.DataContext).RemoveIsEnable = "True";
+            }
+            else
+            {
+                ((HomePagePictureToPDFDialogViewModel)this.DataContext).RemoveIsEnable = "False";
+            }
+
+        }
+
+        private void RemoveFileMenuItem_Click(object sender, System.Windows.RoutedEventArgs e)
+        {
+            ((HomePagePictureToPDFDialogViewModel)this.DataContext).removepicturefile();
+        }
+
+        private void OpenFileMenuItem_Click(object sender, System.Windows.RoutedEventArgs e)
+        {
+            ((HomePagePictureToPDFDialogViewModel)this.DataContext).openfiledialog();
+        }
+
+        private void RadioButton_Click(object sender, System.Windows.RoutedEventArgs e)
+        {
+            var radiobutton = sender as RadioButton;
+            switch (radiobutton.Name.ToString())
+            {
+                case "NewFilesRadioButtom":
+                    {
+                        ((HomePagePictureToPDFDialogViewModel)this.DataContext).pictureToPDFModel.Mode = HomePagePictureToPDFDialogModel.ToPDFFileMode.NewFiles;
+                    }
+                    break;
+                case "OneNewFileNameRadioButtom":
+                    {
+                        ((HomePagePictureToPDFDialogViewModel)this.DataContext).pictureToPDFModel.Mode = HomePagePictureToPDFDialogModel.ToPDFFileMode.OneNewFile;
+                    }
+                    break;
+                case "SelectFileNameRadioButton":
+                    {
+                        ((HomePagePictureToPDFDialogViewModel)this.DataContext).pictureToPDFModel.Mode = HomePagePictureToPDFDialogModel.ToPDFFileMode.SelectFileName;
+                    }
+                    break;
+                default:
+                    break;
+
+            }
+        }
+
+       
+    }
+}

+ 1 - 1
PDF Office/Views/HomePanel/HomeToolsContent.xaml

@@ -11,6 +11,6 @@
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800">
     <Grid>
-        <toolBar:PDFToolsContent Loaded="PDFToolsContent_Loaded"/>
+        <toolBar:PDFToolsContent/>
     </Grid>
 </UserControl>