|
@@ -27,6 +27,8 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
|
|
private int fileNamesIndex = 0;
|
|
private int fileNamesIndex = 0;
|
|
private int FileNameNumber = 0;
|
|
private int FileNameNumber = 0;
|
|
|
|
|
|
|
|
+ public IDialogService dialogs;
|
|
|
|
+
|
|
public List<int> fileNamesView = new List<int>();
|
|
public List<int> fileNamesView = new List<int>();
|
|
|
|
|
|
public HomePagePictureToPDFDialogModel pictureToPDFModel=new HomePagePictureToPDFDialogModel();
|
|
public HomePagePictureToPDFDialogModel pictureToPDFModel=new HomePagePictureToPDFDialogModel();
|
|
@@ -124,8 +126,9 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
|
|
public DelegateCommand SelectFileCommand { get; set; }
|
|
public DelegateCommand SelectFileCommand { get; set; }
|
|
|
|
|
|
#endregion
|
|
#endregion
|
|
- public HomePagePictureToPDFDialogViewModel()
|
|
|
|
|
|
+ public HomePagePictureToPDFDialogViewModel(IDialogService dialogs)
|
|
{
|
|
{
|
|
|
|
+ this.dialogs = dialogs;
|
|
ToPDFCommand = new DelegateCommand(topdf);
|
|
ToPDFCommand = new DelegateCommand(topdf);
|
|
ADDPictureCommand = new DelegateCommand(addpicture);
|
|
ADDPictureCommand = new DelegateCommand(addpicture);
|
|
ADDPictureFilesCommand = new DelegateCommand(addpicturefiles);
|
|
ADDPictureFilesCommand = new DelegateCommand(addpicturefiles);
|
|
@@ -201,14 +204,34 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
|
|
Trace.WriteLine("Document==null");
|
|
Trace.WriteLine("Document==null");
|
|
//TODO
|
|
//TODO
|
|
MessageBoxEx.Show("文档为空");
|
|
MessageBoxEx.Show("文档为空");
|
|
|
|
+ PictureToPDFGridIsEnabled = "True";
|
|
return;
|
|
return;
|
|
|
|
+
|
|
}
|
|
}
|
|
- if (topdfdoc.IsEncrypted)
|
|
|
|
|
|
+ if (topdfdoc.IsLocked)
|
|
{
|
|
{
|
|
- Trace.WriteLine("youmima");
|
|
|
|
- MessageBoxEx.Show("文档加密");
|
|
|
|
- //TODO
|
|
|
|
- return;
|
|
|
|
|
|
+ DialogParameters value = new DialogParameters();
|
|
|
|
+ value.Add(ParameterNames.PDFDocument, topdfdoc);
|
|
|
|
+ dialogs.ShowDialog(DialogNames.VerifyPassWordDialog, value, e =>
|
|
|
|
+ {
|
|
|
|
+ if (e.Result == ButtonResult.OK)
|
|
|
|
+ {
|
|
|
|
+ if (e.Parameters.ContainsKey(ParameterNames.PassWord) && e.Parameters.GetValue<string>(ParameterNames.PassWord) != null)
|
|
|
|
+ {
|
|
|
|
+ topdfdoc.UnlockWithPassword(e.Parameters.GetValue<string>(ParameterNames.PassWord).ToString());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ if (topdfdoc.IsLocked)
|
|
|
|
+ {
|
|
|
|
+ //未成功解密文档时,释放Document对象,返回
|
|
|
|
+ ImagesDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
|
|
|
|
+ ImagesCurrentDataTable.Rows[fileNamesIndex]["FileState"] = "文件出错";
|
|
|
|
+ fileNamesIndex++;
|
|
|
|
+ PictureToPDFGridIsEnabled = "True";
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
int pageindex = topdfdoc.PageCount;
|
|
int pageindex = topdfdoc.PageCount;
|
|
foreach (var filename in fileNames)
|
|
foreach (var filename in fileNames)
|