12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- using ComPDFKit.PDFDocument;
- using ComPDFKitViewer.PdfViewer;
- using PDF_Office.CustomControl;
- using PDF_Office.Model;
- using PDF_Office.Model.PDFTool;
- using PDF_Office.Views.HomePanel.PDFTools;
- using Prism.Commands;
- using Prism.Mvvm;
- using Prism.Services.Dialogs;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Xml.Linq;
- namespace PDF_Office.ViewModels.HomePanel
- {
- public class HomeGuidContentViewModel:BindableBase
- {
- public IDialogService dialogs;
- public DelegateCommand<ToolItem> QuickToolsCommand { get; set; }
- public HomeGuidContentViewModel(IDialogService dialogService)
- {
- QuickToolsCommand = new DelegateCommand<ToolItem>(QuickTools_Click);
- dialogs = dialogService;
- }
- 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 (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- CPDFViewer viewer=new CPDFViewer();
- viewer.InitDocument(dlg.FileName);
- switch (toolItem.Tag)
- {
- case PDFToolType.Split:
- Split_Click();
- DialogParameters splitvalue = new DialogParameters();
- splitvalue.Add(ParameterNames.PDFViewer, viewer);
- splitvalue.Add(ParameterNames.FilePath, dlg.FileName);
- PageTurningPreview.document = viewer.Document;
- dialogs.ShowDialog(DialogNames.HomePageSplitDialog, splitvalue, e => { });
- break;
- case PDFToolType.Extract:
- DialogParameters extractvalue = new DialogParameters();
- extractvalue.Add(ParameterNames.PDFViewer, viewer);
- extractvalue.Add(ParameterNames.FilePath, dlg.FileName);
- PageTurningPreview.document = viewer.Document;
- dialogs.ShowDialog(DialogNames.HomePageExtractDialog, extractvalue, e => { });
- break;
- case PDFToolType.Insert:
- DialogParameters insertvalue = new DialogParameters();
- insertvalue.Add(ParameterNames.PDFViewer, viewer);
- insertvalue.Add(ParameterNames.FilePath, dlg.FileName);
- PageTurningPreview.document = viewer.Document;
- dialogs.ShowDialog(DialogNames.HomePageInsertDialog, insertvalue, e => { });
- break;
- case PDFToolType.Compress:
- break;
- case PDFToolType.Merge:
- break;
- case PDFToolType.Print:
- DialogParameters printvalue = new DialogParameters();
- printvalue.Add(ParameterNames.PDFViewer, viewer); ;
- printvalue.Add(ParameterNames.FilePath, dlg.FileName);
- dialogs.ShowDialog(DialogNames.HomePagePrinterDialog, printvalue, e => { });
- break;
- case PDFToolType.Security:
- break;
- }
- }
- }
- private void Split_Click()
- {
- }
- }
- }
|