using DM_Weight.Report; using Prism.Mvvm; using Prism.Services.Dialogs; using System; using System.Collections.Generic; using System.Dynamic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DM_Weight.ViewModels { internal class PrintPdfViewModel: BindableBase , IDialogAware { private string _pdfFilePath; public string pdfFilePath { get=>_pdfFilePath; set =>SetProperty(ref _pdfFilePath, value); } public PrintPdfViewModel() { pdfFilePath = GridReportUtil.PrintReportStockNewTest(DateTime.Now.AddDays(-1),DateTime.Now).Result; } private string _template; /// /// PDF 的 html 模板 /// public string Template { get => _template; set => SetProperty(ref _template, value); } private ExpandoObject _data; public event Action RequestClose; /// /// 传递给 pdf 的数据 /// public ExpandoObject Data { get => _data; set => SetProperty(ref _data, value); } public void OnDialogOpened(IDialogParameters parameters) { // 弹窗接收 template 和 data 两个参数 //parameters.TryGetValue("template", out _template); //parameters.TryGetValue("data", out _data); } public bool CanCloseDialog() { return true; } public void OnDialogClosed() { //throw new NotImplementedException(); } public string Title => "预览 PDF"; } }