123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- using Microsoft.Office.Interop.Word;
- 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;
- private int creatGridRowIndex = 0;
- public int CreatGridRowIndex
- {
- get { return creatGridRowIndex; }
- set
- {
- SetProperty(ref creatGridRowIndex, value);
- }
- }
- private int creatGridColumnIndex = 1;
- public int CreatGridColumnIndex
- {
- get { return creatGridColumnIndex; }
- set
- {
- SetProperty(ref creatGridColumnIndex, value);
- }
- }
- 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)
- {
- }
- }
- }
|