瀏覽代碼

压缩,转换-更新

liyijie 2 年之前
父節點
當前提交
19c73b3f59

二進制
PDF Office/ComPDFKit.Viewer.dll


+ 140 - 0
PDF Office/Model/Dialog/ConverterDialogs/ConverterDialogsModel.cs

@@ -6,6 +6,8 @@ using System.Text;
 using System.Threading.Tasks;
 using ComDocumentAIKit;
 using ComPDFKit_Conversion.Options;
+using Microsoft.Office.Interop.Word;
+using PDF_Office.Helper;
 
 namespace PDF_Office.Model.Dialog.ConverterDialogs
 {
@@ -64,6 +66,144 @@ namespace PDF_Office.Model.Dialog.ConverterDialogs
         /// </summary>
         public ConvertOptions Options=new ConvertOptions();
 
+        private void ConverterClear()
+        {
+            ConverterHelper.Clear();
+            App.mainWindowViewModel.IsProcessVisible = System.Windows.Visibility.Collapsed;
+        }
+        private void SetProgress(int pageIndex)
+        {
+            App.mainWindowViewModel.Value = pageIndex;
+            
+            if (App.mainWindowViewModel.Value == App.mainWindowViewModel.MaxValue) { App.mainWindowViewModel.IsProcessVisible = System.Windows.Visibility.Collapsed; }
+        }
+
+        public async void OnOpened(Prism.Services.Dialogs.DialogResult e)
+        {
+            if (e.Result == Prism.Services.Dialogs.ButtonResult.Cancel) { return; }
+            bool result = false;
+            string convertType = "";
+            OnProgress GetProgress = null;
+            GetProgress += SetProgress;
+            App.mainWindowViewModel.ProcessCloseAction = ConverterClear;
+            convertType = e.Parameters.GetValue<string>(ParameterNames.ConverterType).ToString();
+            App.mainWindowViewModel.ProgressTitle = "Converting";
+            App.mainWindowViewModel.Value = 0;
+            App.mainWindowViewModel.IsProcessVisible = System.Windows.Visibility.Visible;
+            switch (convertType)
+            {
+                case "CSV":
+                    ConverterCSVDialogModel ConverterCSVModel = e.Parameters.GetValue<ConverterCSVDialogModel>(ParameterNames.ConverterTypeModel);
+
+                    if (ConverterCSVModel != null)
+                    {
+                        App.mainWindowViewModel.MaxValue = ConverterCSVModel.PageIndexLists.Count();
+
+                        for (int i = 0; ConverterCSVModel.PageIndexLists.Count > i; i++)
+                        {
+                            ConverterCSVModel.PageIndexLists[i] = ConverterCSVModel.PageIndexLists[i] + 1;
+                        }
+                        result = await ConverterHelper.CSVConvert(ConverterCSVModel.InputPath, ConverterCSVModel.OutputPath, GetProgress, ConverterCSVModel.PageIndexLists, ConverterCSVModel.Pawssword, ConverterCSVModel.csvOptions);
+
+                    }
+                    else { App.mainWindowViewModel.IsProcessVisible = System.Windows.Visibility.Collapsed; }
+                    break;
+                case "Excel":
+                    ConverterExcelDialogModel ConverterExcelModel = e.Parameters.GetValue<ConverterExcelDialogModel>(ParameterNames.ConverterTypeModel);
+                    if (ConverterExcelModel != null)
+                    {
+                        App.mainWindowViewModel.MaxValue = ConverterExcelModel.PageIndexLists.Count();
+                        for (int i = 0; ConverterExcelModel.PageIndexLists.Count > i; i++)
+                        {
+                            ConverterExcelModel.PageIndexLists[i] = ConverterExcelModel.PageIndexLists[i] + 1;
+                        }
+                        result = await ConverterHelper.ExcelConvert(ConverterExcelModel.InputPath, ConverterExcelModel.OutputPath, GetProgress, ConverterExcelModel.PageIndexLists, ConverterExcelModel.Pawssword, ConverterExcelModel.excelOptions);
+                    }
+                    else { App.mainWindowViewModel.IsProcessVisible = System.Windows.Visibility.Collapsed; }
+                    break;
+                case "HTML":
+                    ConverterHTMLDialogModel ConverterHTMLModel = e.Parameters.GetValue<ConverterHTMLDialogModel>(ParameterNames.ConverterTypeModel);
+                    if (ConverterHTMLModel != null)
+                    {
+                        App.mainWindowViewModel.MaxValue = ConverterHTMLModel.PageIndexLists.Count();
+                        for (int i = 0; ConverterHTMLModel.PageIndexLists.Count > i; i++)
+                        {
+                            ConverterHTMLModel.PageIndexLists[i] = ConverterHTMLModel.PageIndexLists[i] + 1;
+                        }
+                        result = await ConverterHelper.HTMLConvert(ConverterHTMLModel.InputPath, ConverterHTMLModel.OutputPath, GetProgress, ConverterHTMLModel.PageIndexLists, ConverterHTMLModel.Pawssword, ConverterHTMLModel.htmlOptions);
+                    }
+                    else { App.mainWindowViewModel.IsProcessVisible = System.Windows.Visibility.Collapsed; }
+                    break;
+                case "Img":
+                    ConverterImgDialogModel ConverterImgModel = e.Parameters.GetValue<ConverterImgDialogModel>(ParameterNames.ConverterTypeModel);
+                    if (ConverterImgModel != null)
+                    {
+                        App.mainWindowViewModel.MaxValue = ConverterImgModel.PageIndexLists.Count();
+                        for (int i = 0; ConverterImgModel.PageIndexLists.Count > i; i++)
+                        {
+                            ConverterImgModel.PageIndexLists[i] = ConverterImgModel.PageIndexLists[i] + 1;
+                        }
+                        result = await ConverterHelper.ImgConvert(ConverterImgModel.InputPath, ConverterImgModel.OutputPath, GetProgress, ConverterImgModel.PageIndexLists, ConverterImgModel.Pawssword, ConverterImgModel.imageType, ConverterImgModel.imgOptions);
+                    }
+                    else { App.mainWindowViewModel.IsProcessVisible = System.Windows.Visibility.Collapsed; }
+                    break;
+                case "PPT":
+                    ConverterPPTDialogModel ConverterPPTModel = e.Parameters.GetValue<ConverterPPTDialogModel>(ParameterNames.ConverterTypeModel);
+                    if (ConverterPPTModel != null)
+                    {
+                        App.mainWindowViewModel.MaxValue = ConverterPPTModel.PageIndexLists.Count();
+                        for (int i = 0; ConverterPPTModel.PageIndexLists.Count > i; i++)
+                        {
+                            ConverterPPTModel.PageIndexLists[i] = ConverterPPTModel.PageIndexLists[i] + 1;
+                        }
+                        result = await ConverterHelper.PPTConvert(ConverterPPTModel.InputPath, ConverterPPTModel.OutputPath, GetProgress, ConverterPPTModel.PageIndexLists, ConverterPPTModel.Pawssword, ConverterPPTModel.pPTOptions);
+                    }
+                    else { App.mainWindowViewModel.IsProcessVisible = System.Windows.Visibility.Collapsed; }
+                    break;
+                case "RTF":
+                    ConverterRTFDialogModel ConverterRTFModel = e.Parameters.GetValue<ConverterRTFDialogModel>(ParameterNames.ConverterTypeModel);
+                    if (ConverterRTFModel != null)
+                    {
+                        App.mainWindowViewModel.MaxValue = ConverterRTFModel.PageIndexLists.Count();
+                        for (int i = 0; ConverterRTFModel.PageIndexLists.Count > i; i++)
+                        {
+                            ConverterRTFModel.PageIndexLists[i] = ConverterRTFModel.PageIndexLists[i] + 1;
+                        }
+                        result = await ConverterHelper.RTFConvert(ConverterRTFModel.InputPath, ConverterRTFModel.OutputPath, GetProgress, ConverterRTFModel.PageIndexLists, ConverterRTFModel.Pawssword, ConverterRTFModel.rTFOptions);
+                    }
+                    else { App.mainWindowViewModel.IsProcessVisible = System.Windows.Visibility.Collapsed; }
+                    break;
+                case "Text":
+                    ConverterTextDialogModel ConverterTextModel = e.Parameters.GetValue<ConverterTextDialogModel>(ParameterNames.ConverterTypeModel);
+                    if (ConverterTextModel != null)
+                    {
+                        App.mainWindowViewModel.MaxValue = ConverterTextModel.PageIndexLists.Count();
+                        for (int i = 0; ConverterTextModel.PageIndexLists.Count > i; i++)
+                        {
+                            ConverterTextModel.PageIndexLists[i] = ConverterTextModel.PageIndexLists[i] + 1;
+                        }
+                        result = await ConverterHelper.TxtConvert(ConverterTextModel.InputPath, ConverterTextModel.OutputPath, GetProgress, ConverterTextModel.PageIndexLists, ConverterTextModel.Pawssword, ConverterTextModel.txtOptions);
+                    }
+                    else { App.mainWindowViewModel.IsProcessVisible = System.Windows.Visibility.Collapsed; }
+                    break;
+                case "Word":
+                    ConverterWordDialogModel ConverterWordModel = e.Parameters.GetValue<ConverterWordDialogModel>(ParameterNames.ConverterTypeModel);
+                    if (ConverterWordModel != null)
+                    {
+                        App.mainWindowViewModel.MaxValue = ConverterWordModel.PageIndexLists.Count();
+                        for (int i = 0; ConverterWordModel.PageIndexLists.Count > i; i++)
+                        {
+                            ConverterWordModel.PageIndexLists[i] = ConverterWordModel.PageIndexLists[i] + 1;
+                        }
+                        result = await ConverterHelper.WordConvert(ConverterWordModel.InputPath, ConverterWordModel.OutputPath, GetProgress, ConverterWordModel.PageIndexLists, ConverterWordModel.Pawssword, ConverterWordModel.wordOptions);
+                    }
+                    else { App.mainWindowViewModel.IsProcessVisible = System.Windows.Visibility.Collapsed; }
+                    break;
+                default:
+                    break;
+            }
+        }
+
     }
 
 }

+ 59 - 5
PDF Office/Model/Dialog/ToolsDialogs/CompressDialogModel/CompressDialogModel.cs

@@ -1,14 +1,21 @@
-using System;
+using ComPDFKit.PDFDocument;
+using Microsoft.Office.Interop.Word;
+using PDF_Office.Helper;
+using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
-
+using Task = System.Threading.Tasks.Task;
+
 namespace PDF_Office.Model.Dialog.ToolsDialogs
 {
     public class CompressDialogModel
-    {
-       public enum EnumQualityLevel {  
+    {
+        CPDFDocument tempDocument = null;
+        IntPtr compressingIntpr = IntPtr.Zero;
+        public enum EnumQualityLevel {  
         StatusLarge=100,
         StatusStandard=80,
         StatusDefault=40,
@@ -19,5 +26,52 @@ namespace PDF_Office.Model.Dialog.ToolsDialogs
         public EnumQualityLevel CompressQuality { get; set; }
 
         public static string PageIndex { get; set; }
-    }
+
+        public void CompressClear()
+        {
+            tempDocument.CompressFile_Cancel(compressingIntpr);
+            App.mainWindowViewModel.IsProcessVisible = System.Windows.Visibility.Collapsed;
+        }
+        private int GetIndex(int pageindex)
+        {
+            App.mainWindowViewModel.Value = (pageindex + 1);
+           
+            if (App.mainWindowViewModel.Value == App.mainWindowViewModel.MaxValue) { App.mainWindowViewModel.IsProcessVisible = System.Windows.Visibility.Collapsed; }
+            return 0;
+        }
+
+        public async void OnOpened(Prism.Services.Dialogs.DialogResult e)
+        {
+            if (e.Result == Prism.Services.Dialogs.ButtonResult.Cancel) { return; }
+            CPDFDocument doc = null;
+            CPDFDocument.GetPageIndexDelegate indexDelegate = null;
+           
+            string filepath = "";
+            string password = "";
+            int compressquality = 45;
+            doc = e.Parameters.GetValue<CPDFDocument>(ParameterNames.PDFDocument);
+            filepath = e.Parameters.GetValue<string>(ParameterNames.FilePath);
+            password = e.Parameters.GetValue<string>(ParameterNames.PassWord);
+            compressquality = e.Parameters.GetValue<int>("compressDialogModel.CompressQuality");
+            if (doc != null)
+            {
+                App.mainWindowViewModel.Value = 0;
+                App.mainWindowViewModel.ProgressTitle = "Compressing";
+                App.mainWindowViewModel.IsProcessVisible = System.Windows.Visibility.Visible;
+                App.mainWindowViewModel.MaxValue = doc.PageCount;
+                CPDFDocument document = CPDFDocument.InitWithFilePath(doc.FilePath);
+                document.UnlockWithPassword(password);
+                indexDelegate += GetIndex;
+                compressingIntpr = document.CompressFile_Init(compressquality, indexDelegate);
+                //GC.KeepAlive(indexDelegate);
+                tempDocument = document;
+                Trace.WriteLine("compressDialogModel.CompressQuality" + compressquality);
+                App.mainWindowViewModel.ProcessCloseAction = CompressClear;
+                await Task.Run<bool>(() => { return document.CompressFile_Start(compressingIntpr, filepath); });
+                CommonHelper.ShowFileBrowser(filepath);
+                document.Release();
+            }
+        }
+    }
+    
 }

+ 1 - 1
PDF Office/ViewModels/FillAndSign/FillAndSignContentViewModel.cs

@@ -178,7 +178,7 @@ namespace PDF_Office.ViewModels.FillAndSign
                 case "RbtnPoint":
                     Shape = "DotShape";
                     ShapePoints = new List<List<Point>> { new List<Point> { new Point(12.19995, 10), new Point(12.19995, 10) } };
-                    LineWidthMultiple = 4;
+                    LineWidthMultiple = 5;
                     annotArgs = GetStamp();
                     break;
                 default://图章

+ 2 - 0
PDF Office/ViewModels/FillAndSign/PropertyPanel/ShapFillPropertyViewModel.cs

@@ -49,6 +49,7 @@ namespace PDF_Office.ViewModels.FillAndSign.PropertyPanel
                 fillAndSignContentViewModel.SelectColor = value;
                 if (FillAndSignContentViewModel.IsEdit)
                 {
+                  //  PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, LineWidth * fillAndSignContentViewModel.LineWidthMultiple);
                     PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Color, (selectColor as SolidColorBrush).Color);
                 }
                 else { fillAndSignContentViewModel.SetStamp(); }
@@ -66,6 +67,7 @@ namespace PDF_Office.ViewModels.FillAndSign.PropertyPanel
                 fillAndSignContentViewModel.FillOpacity = value;
 
                 if (FillAndSignContentViewModel.IsEdit) { PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Transparency, fillOpacity); }
+
                 else { fillAndSignContentViewModel.SetStamp(); }
 
             }

+ 75 - 30
PDF Office/ViewModels/HomePanel/PDFTools/QuickToolsContentViewModel.cs

@@ -1,7 +1,9 @@
 using ComPDFKitViewer.PdfViewer;
 using PDF_Office.Helper;
 using PDF_Office.Model;
+using PDF_Office.Model.Dialog.ConverterDialogs;
 using PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePageBatchProcessing;
+using PDF_Office.Model.Dialog.ToolsDialogs;
 using PDF_Office.Model.PDFTool;
 using PDF_Office.Views;
 using PDFSettings;
@@ -142,12 +144,24 @@ namespace PDF_Office.ViewModels.HomePanel.PDFTools
                         break;
 
                     case PDFFnType.Compress:
+
+                        viewer.InitDocument(dlg.FileName);
+                        if (!CheckPassword(viewer)) { return; }
                         DialogParameters compresspdf = new DialogParameters();
-                        compresspdf.Add(ParameterNames.BatchProcessing_Name, "1");
-                        HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
-                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 1;
-                        compresspdf.Add(ParameterNames.FilePath, dlg.FileNames);
-                        dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, compresspdf, e => { });
+                        compresspdf.Add(ParameterNames.PDFViewer, viewer);
+                        dialogs.ShowDialog(DialogNames.CompressDialog, compresspdf, e =>
+                        {
+                            CompressDialogModel compressDialogModel = new CompressDialogModel();
+                            compressDialogModel.OnOpened((Prism.Services.Dialogs.DialogResult)e);
+                            // OnOpened((Prism.Services.Dialogs.DialogResult)e);
+                        });
+                        //批量
+                        //DialogParameters compresspdf = new DialogParameters();
+                        //compresspdf.Add(ParameterNames.BatchProcessing_Name, "1");
+                        //HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
+                        //HomePageBatchProcessingDialogModel.BatchProcessingIndex = 1;
+                        //compresspdf.Add(ParameterNames.FilePath, dlg.FileNames);
+                        //dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, compresspdf, e => { });
                         break;
 
                     case PDFFnType.ImageToPDF:
@@ -183,12 +197,13 @@ namespace PDF_Office.ViewModels.HomePanel.PDFTools
 
                         break;
                     case PDFFnType.ConvertPDF:
-                        DialogParameters convertpdf = new DialogParameters();
-                        convertpdf.Add(ParameterNames.BatchProcessing_Name, "0");
-                        HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
-                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 0;
-                        convertpdf.Add(ParameterNames.FilePath, dlg.FileNames);
-                        dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, convertpdf, e => { });
+                        
+                        //DialogParameters convertpdf = new DialogParameters();
+                        //convertpdf.Add(ParameterNames.BatchProcessing_Name, "0");
+                        //HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
+                        //HomePageBatchProcessingDialogModel.BatchProcessingIndex = 0;
+                        //convertpdf.Add(ParameterNames.FilePath, dlg.FileNames);
+                        //dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, convertpdf, e => { });
 
                         break;
                     case PDFFnType.BatchRemove:
@@ -241,31 +256,61 @@ namespace PDF_Office.ViewModels.HomePanel.PDFTools
                         dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, convertpdftoimage, e => { });
                         break;
                     case PDFFnType.PDFToExcel:
+
+                        viewer.InitDocument(dlg.FileName);
+                        if (!CheckPassword(viewer)) { return; }
                         DialogParameters convertpdftoexcel = new DialogParameters();
-                        convertpdftoexcel.Add(ParameterNames.BatchProcessing_Name, "0");
-                        convertpdftoexcel.Add("ConverterTypeIndex", 1);
-                        HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
-                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 0;
-                        convertpdftoexcel.Add(ParameterNames.FilePath, dlg.FileNames);
-                        dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, convertpdftoexcel, e => { });
+                        convertpdftoexcel.Add(ParameterNames.PDFViewer, viewer);
+                        dialogs.ShowDialog(DialogNames.ConverterExcelDialog, convertpdftoexcel, e =>
+                        {
+                            ConverterDialogsModel converterDialogsModel = new ConverterDialogsModel();
+                            converterDialogsModel.OnOpened((DialogResult)e);
+                        });
+                        //DialogParameters convertpdftoexcel = new DialogParameters();
+                        //convertpdftoexcel.Add(ParameterNames.BatchProcessing_Name, "0");
+                        //convertpdftoexcel.Add("ConverterTypeIndex", 1);
+                        //HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
+                        //HomePageBatchProcessingDialogModel.BatchProcessingIndex = 0;
+                        //convertpdftoexcel.Add(ParameterNames.FilePath, dlg.FileNames);
+                        //dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, convertpdftoexcel, e => { });
                         break;
                     case PDFFnType.PDFToPPT:
-                        DialogParameters convertpdftoppt = new DialogParameters();
-                        convertpdftoppt.Add(ParameterNames.BatchProcessing_Name, "0");
-                        convertpdftoppt.Add("ConverterTypeIndex", 2);
-                        HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
-                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 0;
-                        convertpdftoppt.Add(ParameterNames.FilePath, dlg.FileNames);
-                        dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, convertpdftoppt, e => { });
+                        viewer.InitDocument(dlg.FileName);
+                        if (!CheckPassword(viewer)) { return; }
+                        DialogParameters convertpdf = new DialogParameters();
+                        convertpdf.Add(ParameterNames.PDFViewer, viewer);
+                        dialogs.ShowDialog(DialogNames.ConverterPPTDialog, convertpdf, e =>
+                        {
+                            ConverterDialogsModel converterDialogsModel = new ConverterDialogsModel();
+                            converterDialogsModel.OnOpened((DialogResult)e);
+                        });
+                        //批量处理
+                        //DialogParameters convertpdftoppt = new DialogParameters();
+                        //convertpdftoppt.Add(ParameterNames.BatchProcessing_Name, "0");
+                        //convertpdftoppt.Add("ConverterTypeIndex", 2);
+                        //HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
+                        //HomePageBatchProcessingDialogModel.BatchProcessingIndex = 0;
+                        //convertpdftoppt.Add(ParameterNames.FilePath, dlg.FileNames);
+                        //dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, convertpdftoppt, e => { });
                         break;
                     case PDFFnType.PDFToWord:
+                        viewer.InitDocument(dlg.FileName);
+                        if (!CheckPassword(viewer)) { return; }
                         DialogParameters convertpdftoword = new DialogParameters();
-                        convertpdftoword.Add(ParameterNames.BatchProcessing_Name, "0");
-                        convertpdftoword.Add("ConverterTypeIndex", 0);
-                        HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
-                        HomePageBatchProcessingDialogModel.BatchProcessingIndex = 0;
-                        convertpdftoword.Add(ParameterNames.FilePath, dlg.FileNames);
-                        dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, convertpdftoword, e => { });
+                        convertpdftoword.Add(ParameterNames.PDFViewer, viewer);
+                        dialogs.ShowDialog(DialogNames.ConverterWordDialog, convertpdftoword, e =>
+                        {
+                            ConverterDialogsModel converterDialogsModel = new ConverterDialogsModel();
+                            converterDialogsModel.OnOpened((DialogResult)e);
+                        });
+                        //批量处理
+                        //DialogParameters convertpdftoword = new DialogParameters();
+                        //convertpdftoword.Add(ParameterNames.BatchProcessing_Name, "0");
+                        //convertpdftoword.Add("ConverterTypeIndex", 0);
+                        //HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
+                        //HomePageBatchProcessingDialogModel.BatchProcessingIndex = 0;
+                        //convertpdftoword.Add(ParameterNames.FilePath, dlg.FileNames);
+                        //dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, convertpdftoword, e => { });
                         break;
                     case PDFFnType.Batch:
                         DialogParameters batcpdf = new DialogParameters();

+ 30 - 9
PDF Office/ViewModels/Tools/ConverterBarContentViewModel.cs

@@ -74,30 +74,51 @@ namespace PDF_Office.ViewModels.Tools
                     case "ConverterWordBtn":
                         dialogs.ShowDialog(DialogNames.ConverterWordDialog, value, e =>
                         {
-                            
-                            OnOpened((DialogResult)e);
+                            ConverterDialogsModel converterDialogsModel = new ConverterDialogsModel();
+                            converterDialogsModel. OnOpened((DialogResult)e);
                         });
                         break;
                     case "ConverterExcelBtn":
-                        dialogs.ShowDialog(DialogNames.ConverterExcelDialog, value, e => { OnOpened((DialogResult)e); });
+                        dialogs.ShowDialog(DialogNames.ConverterExcelDialog, value, e => {
+                            ConverterDialogsModel converterDialogsModel = new ConverterDialogsModel();
+                            converterDialogsModel.OnOpened((DialogResult)e);
+                        });
                         break;
                     case "ConverterPPTBtn":
-                        dialogs.ShowDialog(DialogNames.ConverterPPTDialog, value, e => { OnOpened((DialogResult)e); });
+                        dialogs.ShowDialog(DialogNames.ConverterPPTDialog, value, e => {
+                            ConverterDialogsModel converterDialogsModel = new ConverterDialogsModel();
+                            converterDialogsModel.OnOpened((DialogResult)e);
+                        });
                         break;
                     case "ConverterRTFBtn":
-                        dialogs.ShowDialog(DialogNames.ConverterRTFDialog, value, e => { OnOpened((DialogResult)e); });
+                        dialogs.ShowDialog(DialogNames.ConverterRTFDialog, value, e => {
+                            ConverterDialogsModel converterDialogsModel = new ConverterDialogsModel();
+                            converterDialogsModel.OnOpened((DialogResult)e);
+                        });
                         break;
                     case "ConverterCSVBtn":
-                        dialogs.ShowDialog(DialogNames.ConverterCSVDialog, value, e => { OnOpened((DialogResult)e); });
+                        dialogs.ShowDialog(DialogNames.ConverterCSVDialog, value, e => {
+                            ConverterDialogsModel converterDialogsModel = new ConverterDialogsModel();
+                            converterDialogsModel.OnOpened((DialogResult)e);
+                        });
                         break;
                     case "ConverterHTMLBtn":
-                        dialogs.ShowDialog(DialogNames.ConverterHTMLDialog, value, e => { OnOpened((DialogResult)e); });
+                        dialogs.ShowDialog(DialogNames.ConverterHTMLDialog, value, e => {
+                            ConverterDialogsModel converterDialogsModel = new ConverterDialogsModel();
+                            converterDialogsModel.OnOpened((DialogResult)e);
+                        });
                         break;
                     case "ConverterTextBtn":
-                        dialogs.ShowDialog(DialogNames.ConverterTextDialog, value, e => { OnOpened((DialogResult)e); });
+                        dialogs.ShowDialog(DialogNames.ConverterTextDialog, value, e => {
+                            ConverterDialogsModel converterDialogsModel = new ConverterDialogsModel();
+                            converterDialogsModel.OnOpened((DialogResult)e);
+                        });
                         break;
                     case "ConverterImgBtn":
-                        dialogs.ShowDialog(DialogNames.ConverterImgDialog, value, e => { OnOpened((DialogResult)e); });
+                        dialogs.ShowDialog(DialogNames.ConverterImgDialog, value, e => {
+                            ConverterDialogsModel converterDialogsModel = new ConverterDialogsModel();
+                            converterDialogsModel.OnOpened((DialogResult)e);
+                        });
                         break;
                     default:
                         break;

+ 4 - 2
PDF Office/ViewModels/Tools/ToolsBarContentViewModel.cs

@@ -20,6 +20,7 @@ using System.Windows;
 using System.Threading.Tasks;
 using static PDF_Office.Model.Dialog.ToolsDialogs.SaftyDialogs.DeleteSafetySettintgsModel;
 using Task = System.Threading.Tasks.Task;
+using PDF_Office.Model.Dialog.ToolsDialogs;
 
 namespace PDF_Office.ViewModels.Tools
 {
@@ -108,8 +109,9 @@ namespace PDF_Office.ViewModels.Tools
             value.Add(ParameterNames.PDFViewer, PDFViewer);
             dialogs.ShowDialog(DialogNames.CompressDialog, value, e =>
             {
-
-                OnOpened((Prism.Services.Dialogs.DialogResult)e);
+                CompressDialogModel compressDialogModel = new CompressDialogModel();
+                compressDialogModel.OnOpened((Prism.Services.Dialogs.DialogResult)e);
+               // OnOpened((Prism.Services.Dialogs.DialogResult)e);
             });
         }