1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- using Microsoft.Win32;
- using PDF_Master.Helper;
- using PDF_Master.Model;
- using Prism.Commands;
- using Prism.Mvvm;
- using Prism.Regions;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace PDF_Master.ViewModels.HomePanel.PDFTools
- {
- public class HomeFilesContentViewModel : BindableBase, INavigationAware
- {
- HomeContentViewModel homeContentViewModel = null;
- public DelegateCommand OpenFileCommand { get; set; }
- public DelegateCommand CreateBlackPDFCommand { get; set; }
- public DelegateCommand CreateFromOtherFile { get; set; }
- public DelegateCommand<string> CreateFromScanner { get; set; }
- public HomeFilesContentViewModel()
- {
- OpenFileCommand = new DelegateCommand(OpenFile);
- CreateBlackPDFCommand = new DelegateCommand(CreatBlankPDF);
- CreateFromOtherFile = new DelegateCommand(createFromOtherFile);
- CreateFromScanner = new DelegateCommand<string>(createFromScanner);
- }
- /// <summary>
- /// 从扫描仪创建
- /// </summary>
- private async void createFromScanner(string args)
- {
- if (homeContentViewModel != null)
- {
- homeContentViewModel.createFromScanner("");
- }
- }
- /// <summary>
- /// 打开文件
- /// </summary>
- public async void OpenFile()
- {
- if (homeContentViewModel != null)
- {
- homeContentViewModel.OpenFile();
- }
- }
- /// <summary>
- /// 创建空白文档
- /// </summary>
- public void CreatBlankPDF()
- {
- if (homeContentViewModel != null)
- {
- homeContentViewModel.CreatBlankPDF();
- }
- }
- /// <summary>
- /// 从其他格式文件创建PDF
- /// </summary>
- private async void createFromOtherFile()
- {
- if (homeContentViewModel != null)
- {
- homeContentViewModel.createFromOtherFile();
- }
- }
- public void OnNavigatedTo(NavigationContext navigationContext)
- {
- navigationContext.Parameters.TryGetValue<HomeContentViewModel>(ParameterNames.HomeContentViewModel, out homeContentViewModel);
- }
- public bool IsNavigationTarget(NavigationContext navigationContext)
- {
- return true;
- }
- public void OnNavigatedFrom(NavigationContext navigationContext)
- {
- }
- }
- }
|