123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- 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;
- <<<<<<< Updated upstream
- 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;
- }
- =======
- case PDFToolType.Print:
- DialogParameters printvalue = new DialogParameters();
- dialogs.ShowDialog(DialogNames.HomePagePrinterDialog, printvalue, e => { });
- break;
- >>>>>>> Stashed changes
- }
- }
- private void Split_Click()
- {
- }
- }
- }
|