123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285 |
- using ComPDFKit_Conversion.Converter;
- using ComPDFKitViewer.PdfViewer;
- using Microsoft.Office.Interop.Word;
- using PDF_Master.Helper;
- using PDF_Master.Model;
- using PDF_Master.Model.Dialog.ConverterDialogs;
- using Prism.Commands;
- using Prism.Mvvm;
- using Prism.Regions;
- using Prism.Services.Dialogs;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Windows.Controls;
- namespace PDF_Master.ViewModels.Tools
- {
- public class ConverterBarContentViewModel : BindableBase, INavigationAware
- {
- private bool isFirstLoad = true;
- private CPDFViewer PDFViewer;
- public IDialogService dialogs;
- private ViewContentViewModel viewContentViewModel;
- private string _pageIndex = "0";
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- public DelegateCommand<object> ToConverterCommand { get; set; }
- public ConverterBarContentViewModel(IDialogService dialogService)
- {
- dialogs = dialogService;
- ToConverterCommand = new DelegateCommand<object>(toconverter);
- }
- private void toconverter(object sender)
- {
-
- if(!App.IsLogin)
- {
- dialogs.ShowDialog(DialogNames.IAPCompareDialog);
- return;
- }
- var args = sender as Button;
- if (args != null)
- {
- DialogParameters value = new DialogParameters();
- value.Add(ParameterNames.PDFViewer, PDFViewer);
- switch (args.Name)
- {
- case "ConverterWordBtn":
- dialogs.ShowDialog(DialogNames.ConverterWordDialog, value, e =>
- {
- ConverterDialogsModel converterDialogsModel = new ConverterDialogsModel();
- converterDialogsModel. OnOpened((DialogResult)e);
- });
- break;
- case "ConverterExcelBtn":
- dialogs.ShowDialog(DialogNames.ConverterExcelDialog, value, e => {
- ConverterDialogsModel converterDialogsModel = new ConverterDialogsModel();
- converterDialogsModel.OnOpened((DialogResult)e);
- });
- break;
- case "ConverterPPTBtn":
- dialogs.ShowDialog(DialogNames.ConverterPPTDialog, value, e => {
- ConverterDialogsModel converterDialogsModel = new ConverterDialogsModel();
- converterDialogsModel.OnOpened((DialogResult)e);
- });
- break;
- case "ConverterRTFBtn":
- dialogs.ShowDialog(DialogNames.ConverterRTFDialog, value, e => {
- ConverterDialogsModel converterDialogsModel = new ConverterDialogsModel();
- converterDialogsModel.OnOpened((DialogResult)e);
- });
- break;
- case "ConverterCSVBtn":
- dialogs.ShowDialog(DialogNames.ConverterCSVDialog, value, e => {
- ConverterDialogsModel converterDialogsModel = new ConverterDialogsModel();
- converterDialogsModel.OnOpened((DialogResult)e);
- });
- break;
- case "ConverterHTMLBtn":
- dialogs.ShowDialog(DialogNames.ConverterHTMLDialog, value, e => {
- ConverterDialogsModel converterDialogsModel = new ConverterDialogsModel();
- converterDialogsModel.OnOpened((DialogResult)e);
- });
- break;
- case "ConverterTextBtn":
- dialogs.ShowDialog(DialogNames.ConverterTextDialog, value, e => {
- ConverterDialogsModel converterDialogsModel = new ConverterDialogsModel();
- converterDialogsModel.OnOpened((DialogResult)e);
- });
- break;
- case "ConverterImgBtn":
- dialogs.ShowDialog(DialogNames.ConverterImgDialog, value, e => {
- ConverterDialogsModel converterDialogsModel = new ConverterDialogsModel();
- converterDialogsModel.OnOpened((DialogResult)e);
- });
- break;
- default:
- break;
- }
- }
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- public bool IsNavigationTarget(NavigationContext navigationContext)
- {
- return true;
- }
- public void OnNavigatedFrom(NavigationContext navigationContext)
- {
- }
- public void OnNavigatedTo(NavigationContext navigationContext)
- {
- navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out viewContentViewModel);
- navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
- if (PDFViewer != null)
- {
- isFirstLoad = false;
- viewContentViewModel.IsPropertyOpen = false;
- PDFViewer.SetMouseMode(MouseModes.PanTool);
- }
- }
- }
- }
|