1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- using ComPDFKitViewer.PdfViewer;
- using PDF_Office.Model;
- 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_Office.ViewModels.Tools
- {
- public class ConverterBarContentViewModel : BindableBase, INavigationAware
- {
- private bool isFirstLoad = true;
- private CPDFViewer PDFViewer;
- public IDialogService dialogs;
- private ViewContentViewModel viewContentViewModel;
- public DelegateCommand<object> ToConverterCommand { get; set; }
- public ConverterBarContentViewModel(IDialogService dialogService)
- {
- dialogs = dialogService;
- ToConverterCommand = new DelegateCommand<object>(toconverter);
- }
- private void toconverter(object sender)
- {
- 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 => { });
- break;
- case "ConverterExcelBtn":
- dialogs.ShowDialog(DialogNames.ConverterExcelDialog, value, e => { });
- break;
- case "ConverterPPTBtn":
- dialogs.ShowDialog(DialogNames.ConverterPPTDialog, value, e => { });
- break;
- case "ConverterRTFBtn":
- dialogs.ShowDialog(DialogNames.ConverterRTFDialog, value, e => { });
- break;
- case "ConverterCSVBtn":
- dialogs.ShowDialog(DialogNames.ConverterCSVDialog, value, e => { });
- break;
- case "ConverterHTMLBtn":
- dialogs.ShowDialog(DialogNames.ConverterHTMLDialog, value, e => { });
- break;
- case "ConverterTextBtn":
- dialogs.ShowDialog(DialogNames.ConverterTextDialog, value, e => { });
- break;
- case "ConverterImgBtn":
- dialogs.ShowDialog(DialogNames.ConverterImgDialog, value, 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;
- }
- }
- }
- }
|