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 CreateFromScanner { get; set; } public HomeFilesContentViewModel() { OpenFileCommand = new DelegateCommand(OpenFile); CreateBlackPDFCommand = new DelegateCommand(CreatBlankPDF); CreateFromOtherFile = new DelegateCommand(createFromOtherFile); CreateFromScanner = new DelegateCommand(createFromScanner); } /// /// 从扫描仪创建 /// private async void createFromScanner(string args) { if (homeContentViewModel != null) { homeContentViewModel.createFromScanner(""); } } /// /// 打开文件 /// public async void OpenFile() { if (homeContentViewModel != null) { homeContentViewModel.OpenFile(); } } /// /// 创建空白文档 /// public void CreatBlankPDF() { if (homeContentViewModel != null) { homeContentViewModel.CreatBlankPDF(); } } /// /// 从其他格式文件创建PDF /// private async void createFromOtherFile() { if (homeContentViewModel != null) { homeContentViewModel.createFromOtherFile(); } } public void OnNavigatedTo(NavigationContext navigationContext) { navigationContext.Parameters.TryGetValue(ParameterNames.HomeContentViewModel, out homeContentViewModel); } public bool IsNavigationTarget(NavigationContext navigationContext) { return true; } public void OnNavigatedFrom(NavigationContext navigationContext) { } } }