|
@@ -1,9 +1,11 @@
|
|
|
using ComPDFKit.PDFDocument;
|
|
|
using Microsoft.Office.Interop.Word;
|
|
|
+using PDF_Master.CustomControl;
|
|
|
using PDF_Master.Helper;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Diagnostics;
|
|
|
+using System.IO;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
@@ -54,6 +56,13 @@ namespace PDF_Master.Model.Dialog.ToolsDialogs
|
|
|
int compressquality = 45;
|
|
|
doc = e.Parameters.GetValue<CPDFDocument>(ParameterNames.PDFDocument);
|
|
|
filepath = e.Parameters.GetValue<string>(ParameterNames.FilePath);
|
|
|
+ try { if (File.Exists(filepath)) File.Delete(filepath); }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+ AlertsMessage alertsMessage = new AlertsMessage();
|
|
|
+ alertsMessage.ShowDialog("", App.MainPageLoader.GetString("FileNotExistWarning"), App.ServiceLoader.GetString("Text_ok"));
|
|
|
+ return;
|
|
|
+ }
|
|
|
password = e.Parameters.GetValue<string>(ParameterNames.PassWord);
|
|
|
compressquality = e.Parameters.GetValue<int>("compressDialogModel.CompressQuality");
|
|
|
if (doc != null)
|
|
@@ -71,12 +80,16 @@ namespace PDF_Master.Model.Dialog.ToolsDialogs
|
|
|
tempDocument = document;
|
|
|
Trace.WriteLine("compressDialogModel.CompressQuality" + compressquality);
|
|
|
App.mainWindowViewModel.ProcessCloseAction = CompressClear;
|
|
|
- if (await Task.Run<bool>(() => { return document.CompressFile_Start(compressingIntpr, filepath); })) { CommonHelper.ShowFileBrowser(filepath); }
|
|
|
+ if (await Task.Run<bool>(() => { return document.CompressFile_Start(compressingIntpr, filepath); })) {
|
|
|
+ CommonHelper.ShowFileBrowser(filepath);
|
|
|
+ }
|
|
|
|
|
|
document.Release();
|
|
|
}
|
|
|
}
|
|
|
catch {
|
|
|
+ AlertsMessage alertsMessage = new AlertsMessage();
|
|
|
+ alertsMessage.ShowDialog("", "Compress file error", App.ServiceLoader.GetString("Text_ok"));
|
|
|
tempDocument.CompressFile_Cancel(compressingIntpr);
|
|
|
App.mainWindowViewModel.IsProcessVisible = System.Windows.Visibility.Collapsed;
|
|
|
}
|